Browse Source

AP_Compass: added force_save_calibration()

zr-v5.1
Andrew Tridgell 4 years ago
parent
commit
f8e0227c8c
  1. 11
      libraries/AP_Compass/AP_Compass.cpp
  2. 5
      libraries/AP_Compass/AP_Compass.h

11
libraries/AP_Compass/AP_Compass.cpp

@ -2020,6 +2020,17 @@ void Compass::handle_external(const AP_ExternalAHRS::mag_data_message_t &pkt) @@ -2020,6 +2020,17 @@ void Compass::handle_external(const AP_ExternalAHRS::mag_data_message_t &pkt)
}
#endif // HAL_EXTERNAL_AHRS_ENABLED
// force save of current calibration as valid
void Compass::force_save_calibration(void)
{
for (StateIndex i(0); i<COMPASS_MAX_INSTANCES; i++) {
if (_state[i].dev_id != 0) {
_state[i].dev_id.save();
}
}
}
// singleton instance
Compass *Compass::_singleton;

5
libraries/AP_Compass/AP_Compass.h

@ -354,7 +354,10 @@ public: @@ -354,7 +354,10 @@ public:
#if HAL_EXTERNAL_AHRS_ENABLED
void handle_external(const AP_ExternalAHRS::mag_data_message_t &pkt);
#endif
// force save of current calibration as valid
void force_save_calibration(void);
private:
static Compass *_singleton;

Loading…
Cancel
Save