1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

Improved compass calibration.

This commit is contained in:
mikeller 2019-11-16 23:54:37 +13:00
parent cfa4055132
commit a045a9c672
11 changed files with 79 additions and 45 deletions

View file

@ -98,8 +98,8 @@
#include "sensors/barometer.h"
#include "sensors/battery.h"
#include "sensors/boardalignment.h"
#include "sensors/compass.h"
#include "sensors/gyro.h"
#include "sensors/sensors.h"
#include "telemetry/telemetry.h"
@ -177,21 +177,17 @@ PG_RESET_TEMPLATE(throttleCorrectionConfig_t, throttleCorrectionConfig,
static bool isCalibrating(void)
{
#ifdef USE_BARO
if (sensors(SENSOR_BARO) && !isBaroCalibrationComplete()) {
return true;
}
#endif
// Note: compass calibration is handled completely differently, outside of the main loop, see f.CALIBRATE_MAG
return (
return !isGyroCalibrationComplete()
#ifdef USE_ACC
!accIsCalibrationComplete()
#else
false
|| (sensors(SENSOR_ACC) && !accIsCalibrationComplete())
#endif
&& sensors(SENSOR_ACC)) || (!isGyroCalibrationComplete());
#ifdef USE_BARO
|| (sensors(SENSOR_BARO) && !isBaroCalibrationComplete())
#endif
#ifdef USE_MAG
|| (sensors(SENSOR_MAG) && !isCompassCalibrationComplete())
#endif
;
}
#ifdef USE_LAUNCH_CONTROL