Line data Source code
1 : #include "AP_Vehicle.h" 2 : 3 : #if AP_VEHICLE_ENABLED 4 : 5 : #include <AP_Param/AP_Param.h> 6 : #include <StorageManager/StorageManager.h> 7 : 8 2094 : void AP_Vehicle::load_parameters(AP_Int16 &format_version, const uint16_t expected_format_version) 9 : { 10 3893 : if (!format_version.load() || 11 1799 : format_version != expected_format_version) { 12 : 13 : // erase all parameters 14 295 : hal.console->printf("Firmware change: erasing EEPROM...\n"); 15 295 : StorageManager::erase(); 16 295 : AP_Param::erase_all(); 17 : 18 : // save the current format version 19 295 : format_version.set_and_save(expected_format_version); 20 295 : hal.console->printf("done.\n"); 21 : } 22 2094 : format_version.set_default(expected_format_version); 23 : 24 : // Load all auto-loaded EEPROM variables 25 2094 : AP_Param::load_all(); 26 2094 : } 27 : 28 : #endif // AP_VEHICLE_ENABLED