From 6af010fe6309a8b8304a5c0210e2ff2ec4171411 Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Wed, 13 Aug 2014 21:41:46 -0600 Subject: [PATCH] Added EEPROM force clear. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - When updating from v0.8, the settings will wipe the startup lines and build info locations so that it won’t use whatever is already there in the EEPROM. Parameters (coord offsets) are retained. They should be ok during an upgrade. --- settings.c | 10 ++++++++++ settings.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/settings.c b/settings.c index 9cdd147..ef880c6 100644 --- a/settings.c +++ b/settings.c @@ -68,6 +68,16 @@ void write_global_settings() // Method to reset Grbl global settings back to defaults. void settings_reset() { + // Clear startup lines and build info user data. Parameters should be ok. + // TODO: For next version, remove these clears. Only here because line buffer increased. + eeprom_put_char(EEPROM_ADDR_BUILD_INFO , 0); + #if N_STARTUP_LINE > 0 + eeprom_put_char(EEPROM_ADDR_STARTUP_BLOCK, 0); + #endif + #if N_STARTUP_LINE > 1 + eeprom_put_char(EEPROM_ADDR_STARTUP_BLOCK+(LINE_BUFFER_SIZE+1), 0); + #endif + settings.pulse_microseconds = DEFAULT_STEP_PULSE_MICROSECONDS; settings.stepper_idle_lock_time = DEFAULT_STEPPER_IDLE_LOCK_TIME; settings.step_invert_mask = DEFAULT_STEPPING_INVERT_MASK; diff --git a/settings.h b/settings.h index 3fa4501..1441446 100644 --- a/settings.h +++ b/settings.h @@ -33,7 +33,7 @@ // Version of the EEPROM data. Will be used to migrate existing data from older versions of Grbl // when firmware is upgraded. Always stored in byte 0 of eeprom -#define SETTINGS_VERSION 9 +#define SETTINGS_VERSION 9 // NOTE: Check settings_reset() when moving to next version. // Define bit flag masks for the boolean settings in settings.flag. #define BITFLAG_REPORT_INCHES bit(0)