Skip to content

Commit

Permalink
Correctly restore IMU settings after accel calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
okalachev committed Mar 15, 2024
1 parent 32f29dc commit f782f64
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions flix/imu.ino
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ void calibrateGyro() {

void calibrateAccel() {
Serial.println("Calibrating accelerometer");
IMU.setAccelRange(IMU.ACCEL_RANGE_2G);
IMU.setAccelRange(IMU.ACCEL_RANGE_2G); // the most sensitive mode
IMU.setDlpfBandwidth(IMU.DLPF_BANDWIDTH_20HZ);
IMU.setSrd(19);

Serial.setTimeout(60000);
Serial.print("Place level [enter] "); Serial.readStringUntil('\n');
calibrateAccelOnce();
Expand All @@ -78,10 +79,9 @@ void calibrateAccel() {
calibrateAccelOnce();
Serial.print("Place upside down [enter] "); Serial.readStringUntil('\n');
calibrateAccelOnce();

printIMUCal();
IMU.setAccelRange(IMU.ACCEL_RANGE_16G);
IMU.setDlpfBandwidth(IMU.DLPF_BANDWIDTH_184HZ);
IMU.setSrd(0);
configureIMU();
}

void calibrateAccelOnce() {
Expand Down

0 comments on commit f782f64

Please sign in to comment.