Skip to content

Commit 435df9b

Browse files
committed
CurieIMU.cpp: initialize saved accel/gyro ranges in begin()
This ensures that "read[Accelerometer/Gyro]Scaled()" will work as expected even if a range has not been explicitly set using the API
1 parent 17d2e2f commit 435df9b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libraries/CurieIMU/src/CurieIMU.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ bool CurieIMUClass::begin()
4747
* MakgetGyroRatee sure the device is connected and responds as expected.
4848
* @return True if connection is valid, false otherwise
4949
*/
50-
return (CURIE_IMU_CHIP_ID == getDeviceID());
50+
if (CURIE_IMU_CHIP_ID != getDeviceID())
51+
return false;
52+
53+
accel_range = (float) getAccelRange();
54+
gyro_range = (float) getGyroRange();
5155
}
5256

5357
void CurieIMUClass::end()

0 commit comments

Comments
 (0)