From 892050920af969ee0eab6bf65ce3eac92fec7f29 Mon Sep 17 00:00:00 2001 From: Erik Nyquist Date: Tue, 10 Jan 2017 10:31:56 -0800 Subject: [PATCH] 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 --- libraries/CurieIMU/src/CurieIMU.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/CurieIMU/src/CurieIMU.cpp b/libraries/CurieIMU/src/CurieIMU.cpp index 8b24c5a5..0def7306 100644 --- a/libraries/CurieIMU/src/CurieIMU.cpp +++ b/libraries/CurieIMU/src/CurieIMU.cpp @@ -47,7 +47,12 @@ bool CurieIMUClass::begin() * MakgetGyroRatee sure the device is connected and responds as expected. * @return True if connection is valid, false otherwise */ - return (CURIE_IMU_CHIP_ID == getDeviceID()); + if (CURIE_IMU_CHIP_ID != getDeviceID()) + return false; + + accel_range = (float) getAccelerometerRange(); + gyro_range = (float) getGyroRange(); + return true; } void CurieIMUClass::end()