From 8fa0a22b8dd9631df691b5ab53bb62822078c3f7 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 2f2a04655..37cc51c37 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1521,7 +1521,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; @@ -1538,6 +1538,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 @@ -1571,9 +1572,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_init_default_byte((uint8_t*)EEPROM_TMC2130_HOME_X_ORIGIN, 0); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0c6c76864..514a764a0 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3827,6 +3827,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(); @@ -3984,7 +3985,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);