Merge pull request #462 from PavelSindler/eeprom_version_change_fix

erase eeprom section which belongs to M500 gcode in case that version…
This commit is contained in:
PavelSindler 2018-02-05 16:58:47 +01:00 committed by GitHub
commit a58767271b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 10 deletions

View file

@ -8,7 +8,7 @@
// Firmware version // Firmware version
#define FW_VERSION "3.1.1" #define FW_VERSION "3.1.1"
#define FW_COMMIT_NR 197 #define FW_COMMIT_NR 201
// FW_VERSION_UNKNOWN means this is an unofficial build. // FW_VERSION_UNKNOWN means this is an unofficial build.
// The firmware should only be checked into github with this symbol. // The firmware should only be checked into github with this symbol.
#define FW_DEV_VERSION FW_VERSION_UNKNOWN #define FW_DEV_VERSION FW_VERSION_UNKNOWN

View file

@ -138,7 +138,9 @@ void Config_StoreSettings(uint16_t offset, uint8_t level)
/* MYSERIAL.print("Top address used:\n"); /* MYSERIAL.print("Top address used:\n");
MYSERIAL.print(i); MYSERIAL.print(i);
MYSERIAL.print("\n"); MYSERIAL.print("; (0x");
MYSERIAL.print(i, HEX);
MYSERIAL.println(")");
*/ */
char ver2[4]=EEPROM_VERSION; char ver2[4]=EEPROM_VERSION;
i=offset; i=offset;

View file

@ -379,6 +379,7 @@ float temp_comp_interpolation(float temperature);
void temp_compensation_apply(); void temp_compensation_apply();
void temp_compensation_start(); void temp_compensation_start();
void show_fw_version_warnings(); void show_fw_version_warnings();
void erase_eeprom_section(uint16_t offset, uint16_t bytes);
#ifdef PINDA_THERMISTOR #ifdef PINDA_THERMISTOR
float temp_compensation_pinda_thermistor_offset(float temperature_pinda); float temp_compensation_pinda_thermistor_offset(float temperature_pinda);

View file

@ -930,6 +930,13 @@ void show_fw_version_warnings() {
lcd_update_enable(true); lcd_update_enable(true);
} }
void erase_eeprom_section(uint16_t offset, uint16_t bytes)
{
for (int i = offset; i < (offset+bytes); i++) eeprom_write_byte((uint8_t*)i, 0xFF);
}
// "Setup" function is called by the Arduino framework on startup. // "Setup" function is called by the Arduino framework on startup.
// Before startup, the Timers-functions (PWM)/Analog RW and HardwareSerial provided by the Arduino-code // Before startup, the Timers-functions (PWM)/Analog RW and HardwareSerial provided by the Arduino-code
// are initialized by the main() routine provided by the Arduino framework. // are initialized by the main() routine provided by the Arduino framework.
@ -1172,8 +1179,10 @@ void setup()
show_fw_version_warnings(); show_fw_version_warnings();
if (!previous_settings_retrieved) lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED); //if EEPROM version was changed, inform user that default setting were loaded if (!previous_settings_retrieved) {
lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED); //if EEPROM version was changed, inform user that default setting were loaded
erase_eeprom_section(EEPROM_OFFSET, 156); //erase M500 part of eeprom
}
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {
lcd_wizard(0); lcd_wizard(0);
} }

View file

@ -478,8 +478,8 @@ const char * const MSG_DATE_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_DATE_CZ MSG_DATE_CZ
}; };
const char MSG_DEFAULT_SETTINGS_LOADED_EN[] PROGMEM = "Default settings loaded"; const char MSG_DEFAULT_SETTINGS_LOADED_EN[] PROGMEM = "Old settings found. Default PID, Esteps etc. will be set.";
const char MSG_DEFAULT_SETTINGS_LOADED_CZ[] PROGMEM = "Nahrano vychozi nastaveni"; const char MSG_DEFAULT_SETTINGS_LOADED_CZ[] PROGMEM = "Neplatne hodnoty nastaveni. Bude pouzito vychozi PID, Esteps atd.";
const char * const MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE[LANG_NUM] PROGMEM = { const char * const MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_DEFAULT_SETTINGS_LOADED_EN, MSG_DEFAULT_SETTINGS_LOADED_EN,
MSG_DEFAULT_SETTINGS_LOADED_CZ MSG_DEFAULT_SETTINGS_LOADED_CZ

View file

@ -375,7 +375,7 @@
#define MSG_CHECK_IDLER "Prosim otevrete idler a manualne odstrante filament." #define MSG_CHECK_IDLER "Prosim otevrete idler a manualne odstrante filament."
#define MSG_FILE_INCOMPLETE "Soubor nekompletni. Pokracovat?" #define MSG_FILE_INCOMPLETE "Soubor nekompletni. Pokracovat?"
#define MSG_FILE_CNT "Nektere soubory nebudou setrideny. Maximalni pocet souboru pro setrideni je 100." #define MSG_FILE_CNT "Nektere soubory nebudou setrideny. Maximalni pocet souboru pro setrideni je 100."
#define MSG_DEFAULT_SETTINGS_LOADED "Nahrano vychozi nastaveni" #define MSG_DEFAULT_SETTINGS_LOADED "Neplatne hodnoty nastaveni. Bude pouzito vychozi PID, Esteps atd."
#define MSG_SORT_TIME "Trideni [Cas]" #define MSG_SORT_TIME "Trideni [Cas]"
#define MSG_SORT_ALPHA "Trideni [Abeceda]" #define MSG_SORT_ALPHA "Trideni [Abeceda]"
#define MSG_SORT_NONE "Trideni [Zadne]" #define MSG_SORT_NONE "Trideni [Zadne]"

View file

@ -392,7 +392,7 @@
#define(length=20, lines=4) MSG_PULL_OUT_FILAMENT "Please pull out filament immediately" #define(length=20, lines=4) MSG_PULL_OUT_FILAMENT "Please pull out filament immediately"
#define(length=20, lines=2) MSG_FILE_INCOMPLETE "File incomplete. Continue anyway?" #define(length=20, lines=2) MSG_FILE_INCOMPLETE "File incomplete. Continue anyway?"
#define(length=20, lines=4) MSG_DEFAULT_SETTINGS_LOADED "Default settings loaded" #define(length=20, lines=4) MSG_DEFAULT_SETTINGS_LOADED "Old settings found. Default PID, Esteps etc. will be set."
#define(length=17, lines=1) MSG_SORT_TIME "Sort: [Time]" #define(length=17, lines=1) MSG_SORT_TIME "Sort: [Time]"
#define(length=17, lines=1) MSG_SORT_ALPHA "Sort: [Alphabet]" #define(length=17, lines=1) MSG_SORT_ALPHA "Sort: [Alphabet]"
#define(length=17, lines=1) MSG_SORT_NONE "Sort: [None]" #define(length=17, lines=1) MSG_SORT_NONE "Sort: [None]"