|
41 | 41 | #define SMART_ACCEL_STABLE 0.8f |
42 | 42 | #define SMART_CORRECT_TIME_MS 2000.f |
43 | 43 | #define SMART_BETA 0.2f |
44 | | - #define M2S 1.0f / 1000000.0f |
| 44 | + #define MS2S 1.0f / 1000.0f |
45 | 45 | #endif |
46 | 46 |
|
47 | 47 | #define CALIB_MODE_INIT 0 |
@@ -133,8 +133,7 @@ void BNO080Sensor::motionLoop() |
133 | 133 | //Look for reports from the IMU |
134 | 134 | while (imu.dataAvailable()) |
135 | 135 | { |
136 | | - unsigned long timeStamp = micros(); |
137 | | - |
| 136 | + unsigned long timeStamp = millis(); |
138 | 137 | hadData = true; |
139 | 138 |
|
140 | 139 | #if ENABLE_INSPECTION |
@@ -214,15 +213,15 @@ void BNO080Sensor::motionLoop() |
214 | 213 |
|
215 | 214 | if(last_gyro_timestamp != 0) |
216 | 215 | { |
217 | | - float gyroDelta = (timeStamp - last_gyro_timestamp) * M2S; |
| 216 | + float gyroDelta = (timeStamp - last_gyro_timestamp) * MS2S; |
218 | 217 |
|
219 | 218 | avgGxyz[0] += Gxyz[0] * gyroDelta; |
220 | 219 | avgGxyz[1] += Gxyz[1] * gyroDelta; |
221 | 220 | avgGxyz[2] += Gxyz[2] * gyroDelta; |
222 | 221 |
|
223 | | - if ((timeStamp - elapsed_gyro_time) * M2S > MADGWICK_UPDATE_RATE_MS / 1000.0f) |
| 222 | + if ((timeStamp - elapsed_gyro_time) * MS2S > MADGWICK_UPDATE_RATE_MS / 1000.0f) |
224 | 223 | { |
225 | | - float totalTime = (timeStamp - elapsed_gyro_time) * M2S; |
| 224 | + float totalTime = (timeStamp - elapsed_gyro_time) * MS2S; |
226 | 225 |
|
227 | 226 | float newGxyz[3]; |
228 | 227 | newGxyz[0] = avgGxyz[0] / totalTime; |
@@ -443,7 +442,7 @@ void BNO080Sensor::saveCalibration() |
443 | 442 |
|
444 | 443 | #if BNO_USE_MADGWICK |
445 | 444 | void BNO080Sensor::doMadgwickUpdate(float Axyz[3], float Gxyz[3], float Mxyz[3], float timestamp) { |
446 | | - float lastDelta = (timestamp - lastMadgwick) * M2S; |
| 445 | + float lastDelta = (timestamp - lastMadgwick) * MS2S; |
447 | 446 | lastMadgwick = timestamp; |
448 | 447 |
|
449 | 448 | //m_Logger.debug("lastDelta : %f", lastDelta); |
|
0 commit comments