dont show message that default settings are used if user has never run M500
This commit is contained in:
parent
f2d34d4cd9
commit
df342c646d
|
|
@ -273,13 +273,12 @@ void Config_PrintSettings()
|
||||||
bool Config_RetrieveSettings()
|
bool Config_RetrieveSettings()
|
||||||
{
|
{
|
||||||
int i=EEPROM_OFFSET;
|
int i=EEPROM_OFFSET;
|
||||||
bool settings_from_eeprom;
|
bool previous_settings_retrieved = true;
|
||||||
char stored_ver[4];
|
char stored_ver[4];
|
||||||
char ver[4]=EEPROM_VERSION;
|
char ver[4]=EEPROM_VERSION;
|
||||||
EEPROM_READ_VAR(i,stored_ver); //read stored version
|
EEPROM_READ_VAR(i,stored_ver); //read stored version
|
||||||
SERIAL_ECHOLNPGM("Stored EEPROM version:");
|
|
||||||
MYSERIAL.println(stored_ver);
|
// SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
|
||||||
// SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
|
|
||||||
if (strncmp(ver,stored_ver,3) == 0)
|
if (strncmp(ver,stored_ver,3) == 0)
|
||||||
{
|
{
|
||||||
// version number match
|
// version number match
|
||||||
|
|
@ -362,17 +361,23 @@ bool Config_RetrieveSettings()
|
||||||
|
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOLNPGM("Stored settings retrieved");
|
SERIAL_ECHOLNPGM("Stored settings retrieved");
|
||||||
settings_from_eeprom = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Config_ResetDefault();
|
Config_ResetDefault();
|
||||||
settings_from_eeprom = false;
|
|
||||||
|
//Return false to inform user that eeprom version was changed and firmware is using default hardcoded settings now.
|
||||||
|
//In case that storing to eeprom was not used yet, do not inform user that hardcoded settings are used.
|
||||||
|
if (eeprom_read_byte((uint8_t *)EEPROM_OFFSET) != 0xFF ||
|
||||||
|
eeprom_read_byte((uint8_t *)EEPROM_OFFSET + 1) != 0xFF ||
|
||||||
|
eeprom_read_byte((uint8_t *)EEPROM_OFFSET + 2) != 0xFF) {
|
||||||
|
previous_settings_retrieved = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef EEPROM_CHITCHAT
|
#ifdef EEPROM_CHITCHAT
|
||||||
Config_PrintSettings();
|
Config_PrintSettings();
|
||||||
#endif
|
#endif
|
||||||
return settings_from_eeprom;
|
return previous_settings_retrieved;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1045,7 +1045,7 @@ void setup()
|
||||||
SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
|
SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
|
||||||
lcd_update_enable(false);
|
lcd_update_enable(false);
|
||||||
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
|
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
|
||||||
settings_from_eeprom = Config_RetrieveSettings();
|
bool previous_settings_retrieved = Config_RetrieveSettings();
|
||||||
SdFatUtil::set_stack_guard(); //writes magic number at the end of static variables to protect against overwriting static memory by stack
|
SdFatUtil::set_stack_guard(); //writes magic number at the end of static variables to protect against overwriting static memory by stack
|
||||||
tp_init(); // Initialize temperature loop
|
tp_init(); // Initialize temperature loop
|
||||||
plan_init(); // Initialize planner;
|
plan_init(); // Initialize planner;
|
||||||
|
|
@ -1209,11 +1209,14 @@ void setup()
|
||||||
lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW);
|
lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW);
|
||||||
}
|
}
|
||||||
for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
|
for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
|
||||||
|
|
||||||
|
//If eeprom version for storing parameters to eeprom using M500 changed, default settings are used. Inform user in this case
|
||||||
|
if (!previous_settings_retrieved) {
|
||||||
|
lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED);
|
||||||
|
}
|
||||||
|
|
||||||
lcd_update_enable(true);
|
lcd_update_enable(true);
|
||||||
|
|
||||||
//If eeprom version for storing parameters to eeprom using M500 changed, default settings are used. Inform user in this case.
|
|
||||||
if(!setting_from_eeprom) lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED);
|
|
||||||
|
|
||||||
// Store the currently running firmware into an eeprom,
|
// Store the currently running firmware into an eeprom,
|
||||||
// so the next time the firmware gets updated, it will know from which version it has been updated.
|
// so the next time the firmware gets updated, it will know from which version it has been updated.
|
||||||
update_current_firmware_version_to_eeprom();
|
update_current_firmware_version_to_eeprom();
|
||||||
|
|
@ -4953,10 +4956,6 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case 500: // M500 Store settings in EEPROM
|
case 500: // M500 Store settings in EEPROM
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -775,7 +775,7 @@ const char * const MSG_DATE_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||||
MSG_DATE_DE
|
MSG_DATE_DE
|
||||||
};
|
};
|
||||||
|
|
||||||
const char MSG_DEFAULT_SETTINGS_LOADED_EN[] PROGMEM = "Hardcoded default settings loaded";
|
const char MSG_DEFAULT_SETTINGS_LOADED_EN[] PROGMEM = "Default settings loaded";
|
||||||
const char * const MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE[1] PROGMEM = {
|
const char * const MSG_DEFAULT_SETTINGS_LOADED_LANG_TABLE[1] PROGMEM = {
|
||||||
MSG_DEFAULT_SETTINGS_LOADED_EN
|
MSG_DEFAULT_SETTINGS_LOADED_EN
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -311,4 +311,4 @@
|
||||||
#define(length=15, lines=1) MSG_MEASURED_SKEW "Measured skew:"
|
#define(length=15, lines=1) MSG_MEASURED_SKEW "Measured skew:"
|
||||||
#define(length=15, lines=1) MSG_SLIGHT_SKEW "Slight skew:"
|
#define(length=15, lines=1) MSG_SLIGHT_SKEW "Slight skew:"
|
||||||
#define(length=15, lines=1) MSG_SEVERE_SKEW "Severe skew:"
|
#define(length=15, lines=1) MSG_SEVERE_SKEW "Severe skew:"
|
||||||
#define(length=20, lines=4) MSG_DEFAULT_SETTINGS_LOADED "Hardcoded default settings loaded"
|
#define(length=20, lines=4) MSG_DEFAULT_SETTINGS_LOADED "Default settings loaded"
|
||||||
Loading…
Reference in New Issue