Skip to content

Commit 7c97231

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 7c97231

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: libraries/CurieIMU/src/CurieIMU.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ 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) getAccelerometerRange();
54+
gyro_range = (float) getGyroRange();
55+
return true;
5156
}
5257

5358
void CurieIMUClass::end()

0 commit comments

Comments
 (0)