2024-02-10 00:38:50 -04:00
|
|
|
#include "AP_Vehicle.h"
|
|
|
|
|
2024-02-13 00:15:48 -04:00
|
|
|
#if AP_VEHICLE_ENABLED
|
|
|
|
|
2024-02-10 00:38:50 -04:00
|
|
|
#include <AP_Param/AP_Param.h>
|
|
|
|
#include <StorageManager/StorageManager.h>
|
|
|
|
|
|
|
|
void AP_Vehicle::load_parameters(AP_Int16 &format_version, const uint16_t expected_format_version)
|
|
|
|
{
|
|
|
|
if (!format_version.load() ||
|
|
|
|
format_version != expected_format_version) {
|
|
|
|
|
|
|
|
// erase all parameters
|
|
|
|
hal.console->printf("Firmware change: erasing EEPROM...\n");
|
|
|
|
StorageManager::erase();
|
|
|
|
AP_Param::erase_all();
|
|
|
|
|
|
|
|
// save the current format version
|
|
|
|
format_version.set_and_save(expected_format_version);
|
|
|
|
hal.console->printf("done.\n");
|
|
|
|
}
|
|
|
|
format_version.set_default(expected_format_version);
|
|
|
|
|
|
|
|
// Load all auto-loaded EEPROM variables
|
|
|
|
AP_Param::load_all();
|
|
|
|
}
|
2024-02-13 00:15:48 -04:00
|
|
|
|
|
|
|
#endif // AP_VEHICLE_ENABLED
|