Skip to content

Commit

Permalink
Removes the division by 10 in the getDistance function so that it ret…
Browse files Browse the repository at this point in the history
…urns mm by default

* Updates example one with a few commented out lines of code that print out measurements in different units
* Rolls version
  • Loading branch information
edspark committed Apr 18, 2024
1 parent a7ebb41 commit 49d74c4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ void loop()
Serial.print("Presence Detected: ");
Serial.print(distance);
Serial.println("mm");
//Serial.print(distance * .01);
//Serial.println("cm");
//Serial.print(distance * .001);
//Serial.println("m");
//Serial.print(distance * .001);
//Serial.println("m");
//Serial.print(distance * .03937008);
//Serial.println("In");
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SparkFun XM125 Arduino Library
version=1.0.1
version=1.0.2
author=SparkFun Electronics <[email protected]>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=An Arduino library to make use of the Qwiic XM125 A121 Pulsed Radar Module from Acconeer.
Expand All @@ -8,4 +8,4 @@ category=Sensors
url=https://github.com/sparkfun/SparkFun_Qwiic_XM125_Arduino_Library
architectures=*
depends=SparkFun Toolkit
includes=SparkFun_Qwiic_XM125_Arduino_Library.h, sfeQwiicXM125.h, sfeXM125Regs.h
includes=SparkFun_Qwiic_XM125_Arduino_Library.h, sfeQwiicXM125.h, sfeXM125Regs.h
3 changes: 1 addition & 2 deletions src/sfeQwiicXM125.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,6 @@ int32_t QwDevXM125::getPresenceDistance(uint32_t &distance)
size_t readBytes = 0;
int32_t retVal = _theBus->readRegister16Region(SFE_XM125_PRESENCE_DISTANCE, (uint8_t*)&distance, 4, readBytes);
distance = __builtin_bswap32(distance);
distance = distance/10;
return retVal;
}

Expand Down Expand Up @@ -1474,4 +1473,4 @@ int32_t QwDevXM125::presenceBusyWait()
return retVal;
}
return 0; // 0 on success
}
}

0 comments on commit 49d74c4

Please sign in to comment.