Skip to content

Commit d019671

Browse files
committed
Resolve #87
1 parent 22c24e4 commit d019671

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

Firmware/OpenLog_Artemis/OpenLog_Artemis.ino

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,13 @@ void beginIMU(bool silent)
11731173
SerialPrintln(F("Error: Could not startup the IMU in DMP mode!"));
11741174
success = false;
11751175
}
1176+
1177+
int ODR = 0; // Set ODR to 55Hz
1178+
if (settings.usBetweenReadings >= 500000ULL)
1179+
ODR = 3; // 17Hz ODR rate when DMP is running at 55Hz
1180+
if (settings.usBetweenReadings >= 1000000ULL)
1181+
ODR = 10; // 5Hz ODR rate when DMP is running at 55Hz
1182+
11761183
if (settings.imuLogDMPQuat6)
11771184
{
11781185
retval = myICM.enableDMPSensor(INV_ICM20948_SENSOR_GAME_ROTATION_VECTOR);
@@ -1181,7 +1188,7 @@ void beginIMU(bool silent)
11811188
SerialPrintln(F("Error: Could not enable the Game Rotation Vector (Quat6)!"));
11821189
success = false;
11831190
}
1184-
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Quat6, 0); // Set ODR to 55Hz
1191+
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Quat6, ODR);
11851192
if (retval != ICM_20948_Stat_Ok)
11861193
{
11871194
SerialPrintln(F("Error: Could not set the Quat6 ODR!"));
@@ -1196,7 +1203,7 @@ void beginIMU(bool silent)
11961203
SerialPrintln(F("Error: Could not enable the Rotation Vector (Quat9)!"));
11971204
success = false;
11981205
}
1199-
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Quat9, 0); // Set ODR to 55Hz
1206+
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Quat9, ODR);
12001207
if (retval != ICM_20948_Stat_Ok)
12011208
{
12021209
SerialPrintln(F("Error: Could not set the Quat9 ODR!"));
@@ -1211,7 +1218,7 @@ void beginIMU(bool silent)
12111218
SerialPrintln(F("Error: Could not enable the DMP Accelerometer!"));
12121219
success = false;
12131220
}
1214-
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Accel, 0); // Set ODR to 55Hz
1221+
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Accel, ODR);
12151222
if (retval != ICM_20948_Stat_Ok)
12161223
{
12171224
SerialPrintln(F("Error: Could not set the Accel ODR!"));
@@ -1226,13 +1233,13 @@ void beginIMU(bool silent)
12261233
SerialPrintln(F("Error: Could not enable the DMP Gyroscope!"));
12271234
success = false;
12281235
}
1229-
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Gyro, 0); // Set ODR to 55Hz
1236+
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Gyro, ODR);
12301237
if (retval != ICM_20948_Stat_Ok)
12311238
{
12321239
SerialPrintln(F("Error: Could not set the Gyro ODR!"));
12331240
success = false;
12341241
}
1235-
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Gyro_Calibr, 0); // Set ODR to 55Hz
1242+
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Gyro_Calibr, ODR);
12361243
if (retval != ICM_20948_Stat_Ok)
12371244
{
12381245
SerialPrintln(F("Error: Could not set the Gyro Calibr ODR!"));
@@ -1247,13 +1254,13 @@ void beginIMU(bool silent)
12471254
SerialPrintln(F("Error: Could not enable the DMP Compass!"));
12481255
success = false;
12491256
}
1250-
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Cpass, 0); // Set ODR to 55Hz
1257+
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Cpass, ODR);
12511258
if (retval != ICM_20948_Stat_Ok)
12521259
{
12531260
SerialPrintln(F("Error: Could not set the Compass ODR!"));
12541261
success = false;
12551262
}
1256-
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Cpass_Calibr, 0); // Set ODR to 55Hz
1263+
retval = myICM.setDMPODRrate(DMP_ODR_Reg_Cpass_Calibr, ODR);
12571264
if (retval != ICM_20948_Stat_Ok)
12581265
{
12591266
SerialPrintln(F("Error: Could not set the Compass Calibr ODR!"));

0 commit comments

Comments
 (0)