mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 17:49:33 +00:00
Don't calibrate gyro on start since MPU9250 library does that on begin
This commit is contained in:
parent
9ad718cb85
commit
c22961e5ff
12
flix/imu.ino
12
flix/imu.ino
@ -7,12 +7,12 @@
|
|||||||
#include <MPU9250.h>
|
#include <MPU9250.h>
|
||||||
|
|
||||||
#define IMU_CS_PIN 4 // chip-select pin for IMU SPI connection
|
#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);
|
MPU9250 IMU(SPI, IMU_CS_PIN);
|
||||||
|
|
||||||
void setupIMU() {
|
void setupIMU() {
|
||||||
Serial.println("Setup IMU");
|
Serial.println("Setup IMU, stand still");
|
||||||
|
|
||||||
auto status = IMU.begin();
|
auto status = IMU.begin();
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
@ -22,12 +22,7 @@ void setupIMU() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CALIBRATE_GYRO_ON_START) {
|
if (LOAD_GYRO_CAL) loadGyroCal();
|
||||||
calibrateGyro();
|
|
||||||
} else {
|
|
||||||
loadGyroCal();
|
|
||||||
}
|
|
||||||
|
|
||||||
loadAccelCal();
|
loadAccelCal();
|
||||||
|
|
||||||
IMU.setSrd(0); // set sample rate to 1000 Hz
|
IMU.setSrd(0); // set sample rate to 1000 Hz
|
||||||
@ -54,7 +49,6 @@ bool readIMU() {
|
|||||||
|
|
||||||
void calibrateGyro() {
|
void calibrateGyro() {
|
||||||
Serial.println("Calibrating gyro, stand still");
|
Serial.println("Calibrating gyro, stand still");
|
||||||
delay(500);
|
|
||||||
int status = IMU.calibrateGyro();
|
int status = IMU.calibrateGyro();
|
||||||
Serial.printf("Calibration status: %d\n", status);
|
Serial.printf("Calibration status: %d\n", status);
|
||||||
IMU.setSrd(0);
|
IMU.setSrd(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user