From fbfacd76a46d02ba326ad0938e665b3a041cc86b Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Thu, 29 Dec 2022 16:06:02 +0100 Subject: [PATCH] wizard: Resume the wizard for missing calibrations during upgrades Instead of checking for explicit versions, resume the wizard if some (new) wizard is missing. This handles both the old SELFTEST check, the new thermal model and any future check in the same fashion. --- Firmware/Marlin_main.cpp | 7 ++++++- Firmware/util.cpp | 2 +- Firmware/util.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 77f6c2129..82ee6f0d9 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1553,11 +1553,16 @@ void setup() // printer upgraded from FW<3.2.0.4 and requires re-running selftest lcd_show_fullscreen_message_and_wait_P(_i("Selftest will be run to calibrate accurate sensorless rehoming."));////MSG_FORCE_SELFTEST c=20 r=8 calibration_status &= ~CALIBRATION_STATUS_SELFTEST; - run_wizard = true; } } eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_V2, calibration_status); } + if (eeprom_fw_version_older_than_p(FW_VERSION_NR)) { + if (!calibration_status_get(CALIBRATION_WIZARD_STEPS)) { + // we just did a FW upgrade and some (new) wizard step is missing: resume the wizard + run_wizard = true; + } + } update_current_firmware_version_to_eeprom(); if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { diff --git a/Firmware/util.cpp b/Firmware/util.cpp index f36b8daef..49d3d397f 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -10,7 +10,7 @@ // Allocate the version string in the program memory. Otherwise the string lands either on the stack or in the global RAM. static const char FW_VERSION_STR[] PROGMEM = FW_VERSION; -static const uint16_t FW_VERSION_NR[4] PROGMEM = { +const uint16_t FW_VERSION_NR[4] PROGMEM = { FW_MAJOR, FW_MINOR, FW_REVISION, diff --git a/Firmware/util.h b/Firmware/util.h index 9a3ce9bbd..3c8aaa385 100644 --- a/Firmware/util.h +++ b/Firmware/util.h @@ -1,6 +1,7 @@ #pragma once #include +extern const uint16_t FW_VERSION_NR[4]; extern const char* FW_VERSION_STR_P(); // Definition of a firmware flavor numerical values.