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 <voinea.dragos.alexandru@gmail.com>
Date:        3 weeks ago (9/12/2019 6:16:31 AM)
Commit hash: 78708903e8

Also update eeprom value
This commit is contained in:
Marek Bel 2019-10-02 18:38:46 +02:00
parent d68ad6f8c6
commit 7feb763643

View File

@ -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();