From 7feb763643d008786190804507b1deed6aa48029 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 2 Oct 2019 18:38:46 +0200 Subject: [PATCH] Move check for clear EEPROM just after factory_reset() to ensure nothing is written to EEPROM before check. Fix wizard not starting after Factory RESET / All Data on MK25 printer. This was broken by: Author: leptun Date: 3 weeks ago (9/12/2019 6:16:31 AM) Commit hash: 78708903e83dfa0f9353e8a2083731b158281249 Also update eeprom value --- Firmware/Marlin_main.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6d48686c..45dd118c 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1234,6 +1234,21 @@ void setup() plan_init(); // Initialize planner; factory_reset(); + if (eeprom_read_dword((uint32_t*)(EEPROM_TOP - 4)) == 0x0ffffffff && + eeprom_read_dword((uint32_t*)(EEPROM_TOP - 8)) == 0x0ffffffff) + { + // Maiden startup. The firmware has been loaded and first started on a virgin RAMBo board, + // where all the EEPROM entries are set to 0x0ff. + // Once a firmware boots up, it forces at least a language selection, which changes + // EEPROM_LANG to number lower than 0x0ff. + // 1) Set a high power mode. +#ifdef TMC2130 + eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0); + tmc2130_mode = TMC2130_MODE_NORMAL; +#endif //TMC2130 + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard + } + lcd_encoder_diff=0; #ifdef TMC2130 @@ -1345,20 +1360,6 @@ void setup() // Enable Toshiba FlashAir SD card / WiFi enahanced card. card.ToshibaFlashAir_enable(eeprom_read_byte((unsigned char*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY) == 1); - if (eeprom_read_dword((uint32_t*)(EEPROM_TOP - 4)) == 0x0ffffffff && - eeprom_read_dword((uint32_t*)(EEPROM_TOP - 8)) == 0x0ffffffff) { - // Maiden startup. The firmware has been loaded and first started on a virgin RAMBo board, - // where all the EEPROM entries are set to 0x0ff. - // Once a firmware boots up, it forces at least a language selection, which changes - // EEPROM_LANG to number lower than 0x0ff. - // 1) Set a high power mode. -#ifdef TMC2130 - eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0); - tmc2130_mode = TMC2130_MODE_NORMAL; -#endif //TMC2130 - eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard - } - // Force SD card update. Otherwise the SD card update is done from loop() on card.checkautostart(false), // but this times out if a blocking dialog is shown in setup(). card.initsd();