From d8ae372309102b5288ca5133e0ce2e1b4e2b488b Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Thu, 29 Dec 2022 13:21:52 +0100 Subject: [PATCH] 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. --- Firmware/Marlin_main.cpp | 6 ++---- Firmware/ultralcd.cpp | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3993017a..bc6c68fb 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1540,7 +1540,7 @@ void setup() Config_StoreSettings(); } - // handle calibration status upgrade + // handle FW and calibration status upgrade bool run_wizard = false; if (calibration_status_get(CALIBRATION_STATUS_UNKNOWN)) { CalibrationStatus calibration_status = 0; @@ -1557,6 +1557,7 @@ void setup() } 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)) { // first time run of wizard or service prep @@ -1590,9 +1591,6 @@ void setup() lcd_update_enable(true); lcd_clear(); 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 tmc2130_home_origin[X_AXIS] = eeprom_read_byte((uint8_t*)EEPROM_TMC2130_HOME_X_ORIGIN); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 51ea623d..910b545c 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -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 } if (result) { + calibration_status_clear(CALIBRATION_WIZARD_STEPS); lcd_wizard(WizState::Run); } else { lcd_return_to_status(); @@ -4135,7 +4136,6 @@ void lcd_wizard(WizState state) if (wizard_event == LCD_LEFT_BUTTON_CHOICE) { state = S::Restore; eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); - calibration_status_clear(CALIBRATION_WIZARD_STEPS); } else { // user interrupted eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0);