AP_InertialSensor: added force_save_calibration()

This commit is contained in:
Andrew Tridgell 2021-02-11 11:49:08 +11:00
parent 9de1519928
commit 25dd08a1fd
2 changed files with 17 additions and 0 deletions

View File

@ -2382,6 +2382,20 @@ void AP_InertialSensor::handle_external(const AP_ExternalAHRS::ins_data_message_
}
#endif // HAL_EXTERNAL_AHRS_ENABLED
// force save of current calibration as valid
void AP_InertialSensor::force_save_calibration(void)
{
for (uint8_t i=0; i<_accel_count; i++) {
if (_accel_id[i] != 0) {
_accel_id[i].save();
// we also save the scale as the default of 1.0 may be
// over a stored value of 0.0
_accel_scale[i].save();
_accel_id_ok[i] = true;
}
}
}
namespace AP {
AP_InertialSensor &ins()

View File

@ -441,6 +441,9 @@ public:
void get_persistent_params(ExpandingString &str) const;
#endif
// force save of current calibration as valid
void force_save_calibration(void);
private:
// load backend drivers
bool _add_backend(AP_InertialSensor_Backend *backend);