AntennaTracker: move parameter storage formatting up to AP_Vehicle

This commit is contained in:
Peter Barker 2024-02-10 15:38:50 +11:00 committed by Peter Barker
parent 222fe57915
commit 23aeef4bfe
1 changed files with 1 additions and 19 deletions

View File

@ -584,23 +584,7 @@ const AP_Param::Info Tracker::var_info[] = {
void Tracker::load_parameters(void) void Tracker::load_parameters(void)
{ {
if (!g.format_version.load() || AP_Vehicle::load_parameters(g.format_version, Parameters::k_format_version);
g.format_version != Parameters::k_format_version) {
// erase all parameters
hal.console->printf("Firmware change: erasing EEPROM...\n");
StorageManager::erase();
AP_Param::erase_all();
// save the current format version
g.format_version.set_and_save(Parameters::k_format_version);
hal.console->printf("done.\n");
}
g.format_version.set_default(Parameters::k_format_version);
uint32_t before = AP_HAL::micros();
// Load all auto-loaded EEPROM variables
AP_Param::load_all();
#if AP_STATS_ENABLED #if AP_STATS_ENABLED
// PARAMETER_CONVERSION - Added: Jan-2024 // PARAMETER_CONVERSION - Added: Jan-2024
@ -617,8 +601,6 @@ void Tracker::load_parameters(void)
AP_Param::convert_class(g.k_param_logger, &logger, logger.var_info, 0, 0, true); AP_Param::convert_class(g.k_param_logger, &logger, logger.var_info, 0, 0, true);
#endif #endif
hal.console->printf("load_all took %luus\n", (unsigned long)(AP_HAL::micros() - before));
#if HAL_HAVE_SAFETY_SWITCH #if HAL_HAVE_SAFETY_SWITCH
// configure safety switch to allow stopping the motors while armed // configure safety switch to allow stopping the motors while armed
AP_Param::set_default_by_name("BRD_SAFETYOPTION", AP_BoardConfig::BOARD_SAFETY_OPTION_BUTTON_ACTIVE_SAFETY_OFF| AP_Param::set_default_by_name("BRD_SAFETYOPTION", AP_BoardConfig::BOARD_SAFETY_OPTION_BUTTON_ACTIVE_SAFETY_OFF|