From c22961e5ffe82e94663d37977c40080d166a0c7e Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Fri, 19 Jan 2024 05:05:49 +0300 Subject: [PATCH] Don't calibrate gyro on start since MPU9250 library does that on begin --- flix/imu.ino | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/flix/imu.ino b/flix/imu.ino index c3f511f..acbade5 100644 --- a/flix/imu.ino +++ b/flix/imu.ino @@ -7,12 +7,12 @@ #include #define IMU_CS_PIN 4 // chip-select pin for IMU SPI connection -#define CALIBRATE_GYRO_ON_START true +#define LOAD_GYRO_CAL false MPU9250 IMU(SPI, IMU_CS_PIN); void setupIMU() { - Serial.println("Setup IMU"); + Serial.println("Setup IMU, stand still"); auto status = IMU.begin(); if (status < 0) { @@ -22,12 +22,7 @@ void setupIMU() { } } - if (CALIBRATE_GYRO_ON_START) { - calibrateGyro(); - } else { - loadGyroCal(); - } - + if (LOAD_GYRO_CAL) loadGyroCal(); loadAccelCal(); IMU.setSrd(0); // set sample rate to 1000 Hz @@ -54,7 +49,6 @@ bool readIMU() { void calibrateGyro() { Serial.println("Calibrating gyro, stand still"); - delay(500); int status = IMU.calibrateGyro(); Serial.printf("Calibration status: %d\n", status); IMU.setSrd(0);