AP_Compass: added force_save_calibration()

This commit is contained in:
Andrew Tridgell 2021-02-11 11:49:21 +11:00
parent 25dd08a1fd
commit f8e0227c8c
2 changed files with 15 additions and 1 deletions

View File

@ -2020,6 +2020,17 @@ void Compass::handle_external(const AP_ExternalAHRS::mag_data_message_t &pkt)
} }
#endif // HAL_EXTERNAL_AHRS_ENABLED #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 // singleton instance
Compass *Compass::_singleton; Compass *Compass::_singleton;

View File

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