wizard: Allow partial resuming after reset

Update the eeprom FW version as soon as migration is complete, to avoid
resetting the CALIBRATION_V2 variable at each reset.

Do not implicitly reset the calibration steps for WizState::Run: do this
only for the menu action.
This commit is contained in:
Yuri D'Elia 2022-12-29 13:21:52 +01:00 committed by DRracer
parent f158a75041
commit d8ae372309
2 changed files with 3 additions and 5 deletions

View File

@ -1540,7 +1540,7 @@ void setup()
Config_StoreSettings(); Config_StoreSettings();
} }
// handle calibration status upgrade // handle FW and calibration status upgrade
bool run_wizard = false; bool run_wizard = false;
if (calibration_status_get(CALIBRATION_STATUS_UNKNOWN)) { if (calibration_status_get(CALIBRATION_STATUS_UNKNOWN)) {
CalibrationStatus calibration_status = 0; CalibrationStatus calibration_status = 0;
@ -1557,6 +1557,7 @@ void setup()
} }
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_V2, calibration_status); eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_V2, calibration_status);
} }
update_current_firmware_version_to_eeprom();
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) {
// first time run of wizard or service prep // first time run of wizard or service prep
@ -1590,9 +1591,6 @@ void setup()
lcd_update_enable(true); lcd_update_enable(true);
lcd_clear(); lcd_clear();
lcd_update(2); lcd_update(2);
// Store the currently running firmware into an eeprom,
// so the next time the firmware gets updated, it will know from which version it has been updated.
update_current_firmware_version_to_eeprom();
#ifdef TMC2130 #ifdef TMC2130
tmc2130_home_origin[X_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_HOME_X_ORIGIN); tmc2130_home_origin[X_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_HOME_X_ORIGIN);

View File

@ -3974,6 +3974,7 @@ void lcd_wizard() {
result = !lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Running Wizard will delete current calibration results and start from the beginning. Continue?"), false);////MSG_WIZARD_RERUN c=20 r=7 result = !lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Running Wizard will delete current calibration results and start from the beginning. Continue?"), false);////MSG_WIZARD_RERUN c=20 r=7
} }
if (result) { if (result) {
calibration_status_clear(CALIBRATION_WIZARD_STEPS);
lcd_wizard(WizState::Run); lcd_wizard(WizState::Run);
} else { } else {
lcd_return_to_status(); lcd_return_to_status();
@ -4135,7 +4136,6 @@ void lcd_wizard(WizState state)
if (wizard_event == LCD_LEFT_BUTTON_CHOICE) { if (wizard_event == LCD_LEFT_BUTTON_CHOICE) {
state = S::Restore; state = S::Restore;
eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1);
calibration_status_clear(CALIBRATION_WIZARD_STEPS);
} else { } else {
// user interrupted // user interrupted
eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0);