Skip to content

Commit

Permalink
Merge pull request #462 from PavelSindler/eeprom_version_change_fix
Browse files Browse the repository at this point in the history
erase eeprom section which belongs to M500 gcode in case that version…
  • Loading branch information
PavelSindler authored Feb 5, 2018
2 parents 8375e2c + 33aa3d5 commit a587672
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Firmware/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// Firmware version
#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.
// The firmware should only be checked into github with this symbol.
#define FW_DEV_VERSION FW_VERSION_UNKNOWN
Expand Down
8 changes: 5 additions & 3 deletions Firmware/ConfigurationStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@ void Config_StoreSettings(uint16_t offset, uint8_t level)
}
#endif //LIN_ADVANCE

/*MYSERIAL.print("Top address used:\n");
/* MYSERIAL.print("Top address used:\n");
MYSERIAL.print(i);
MYSERIAL.print("\n");
*/
MYSERIAL.print("; (0x");
MYSERIAL.print(i, HEX);
MYSERIAL.println(")");
*/
char ver2[4]=EEPROM_VERSION;
i=offset;
EEPROM_WRITE_VAR(i,ver2); // validate data
Expand Down
1 change: 1 addition & 0 deletions Firmware/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ float temp_comp_interpolation(float temperature);
void temp_compensation_apply();
void temp_compensation_start();
void show_fw_version_warnings();
void erase_eeprom_section(uint16_t offset, uint16_t bytes);

#ifdef PINDA_THERMISTOR
float temp_compensation_pinda_thermistor_offset(float temperature_pinda);
Expand Down
13 changes: 11 additions & 2 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,13 @@ void show_fw_version_warnings() {
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.
// 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.
Expand Down Expand Up @@ -1172,8 +1179,10 @@ void setup()

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) {
lcd_wizard(0);
}
Expand Down
4 changes: 2 additions & 2 deletions Firmware/language_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ const char * const MSG_DATE_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_DATE_CZ
};

const char MSG_DEFAULT_SETTINGS_LOADED_EN[] PROGMEM = "Default settings loaded";
const char MSG_DEFAULT_SETTINGS_LOADED_CZ[] PROGMEM = "Nahrano vychozi nastaveni";
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 = "Neplatne hodnoty nastaveni. Bude pouzito vychozi PID, Esteps atd.";
const char * const MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_DEFAULT_SETTINGS_LOADED_EN,
MSG_DEFAULT_SETTINGS_LOADED_CZ
Expand Down
2 changes: 1 addition & 1 deletion Firmware/language_cz.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
#define MSG_CHECK_IDLER "Prosim otevrete idler a manualne odstrante filament."
#define MSG_FILE_INCOMPLETE "Soubor nekompletni. Pokracovat?"
#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_ALPHA "Trideni [Abeceda]"
#define MSG_SORT_NONE "Trideni [Zadne]"
Expand Down
2 changes: 1 addition & 1 deletion Firmware/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
#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=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_ALPHA "Sort: [Alphabet]"
#define(length=17, lines=1) MSG_SORT_NONE "Sort: [None]"
Expand Down

0 comments on commit a587672

Please sign in to comment.