Implement the EEPROM_CHITCHAT option

This commit is contained in:
Scott Lahteine 2017-07-01 21:48:18 -05:00
parent dcec7178d1
commit cf96109056

View File

@ -655,10 +655,12 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(final_crc); EEPROM_WRITE(final_crc);
// Report storage size // Report storage size
SERIAL_ECHO_START(); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOPAIR("Settings Stored (", eeprom_size - (EEPROM_OFFSET)); SERIAL_ECHO_START();
SERIAL_ECHOPAIR(" bytes; crc ", final_crc); SERIAL_ECHOPAIR("Settings Stored (", eeprom_size - (EEPROM_OFFSET));
SERIAL_ECHOLNPGM(")"); SERIAL_ECHOPAIR(" bytes; crc ", final_crc);
SERIAL_ECHOLNPGM(")");
#endif
} }
#if ENABLED(UBL_SAVE_ACTIVE_ON_M500) #if ENABLED(UBL_SAVE_ACTIVE_ON_M500)
@ -689,10 +691,12 @@ void MarlinSettings::postprocess() {
stored_ver[0] = '?'; stored_ver[0] = '?';
stored_ver[1] = '\0'; stored_ver[1] = '\0';
} }
SERIAL_ECHO_START(); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOPGM("EEPROM version mismatch "); SERIAL_ECHO_START();
SERIAL_ECHOPAIR("(EEPROM=", stored_ver); SERIAL_ECHOPGM("EEPROM version mismatch ");
SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")"); SERIAL_ECHOPAIR("(EEPROM=", stored_ver);
SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")");
#endif
reset(); reset();
} }
else { else {
@ -1004,20 +1008,24 @@ void MarlinSettings::postprocess() {
#endif #endif
if (working_crc == stored_crc) { if (working_crc == stored_crc) {
postprocess(); postprocess();
#if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHO_START(); SERIAL_ECHO_START();
SERIAL_ECHO(version); SERIAL_ECHO(version);
SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET)); SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
SERIAL_ECHOPAIR(" bytes; crc ", working_crc); SERIAL_ECHOPAIR(" bytes; crc ", working_crc);
SERIAL_ECHOLNPGM(")"); SERIAL_ECHOLNPGM(")");
#endif
} }
else { else {
SERIAL_ERROR_START(); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_ERRORPGM("EEPROM CRC mismatch - (stored) "); SERIAL_ERROR_START();
SERIAL_ERROR(stored_crc); SERIAL_ERRORPGM("EEPROM CRC mismatch - (stored) ");
SERIAL_ERRORPGM(" != "); SERIAL_ERROR(stored_crc);
SERIAL_ERROR(working_crc); SERIAL_ERRORPGM(" != ");
SERIAL_ERRORLNPGM(" (calculated)!"); SERIAL_ERROR(working_crc);
SERIAL_ERRORLNPGM(" (calculated)!");
#endif
reset(); reset();
} }
@ -1029,24 +1037,32 @@ void MarlinSettings::postprocess() {
if (!ubl.sanity_check()) { if (!ubl.sanity_check()) {
SERIAL_EOL(); SERIAL_EOL();
ubl.echo_name(); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOLNPGM(" initialized.\n"); ubl.echo_name();
SERIAL_ECHOLNPGM(" initialized.\n");
#endif
} }
else { else {
SERIAL_PROTOCOLPGM("?Can't enable "); #if ENABLED(EEPROM_CHITCHAT)
ubl.echo_name(); SERIAL_PROTOCOLPGM("?Can't enable ");
SERIAL_PROTOCOLLNPGM("."); ubl.echo_name();
SERIAL_PROTOCOLLNPGM(".");
#endif
ubl.reset(); ubl.reset();
} }
if (ubl.state.storage_slot >= 0) { if (ubl.state.storage_slot >= 0) {
load_mesh(ubl.state.storage_slot); load_mesh(ubl.state.storage_slot);
SERIAL_ECHOPAIR("Mesh ", ubl.state.storage_slot); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOLNPGM(" loaded from storage."); SERIAL_ECHOPAIR("Mesh ", ubl.state.storage_slot);
SERIAL_ECHOLNPGM(" loaded from storage.");
#endif
} }
else { else {
ubl.reset(); ubl.reset();
SERIAL_ECHOLNPGM("UBL System reset()"); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOLNPGM("UBL System reset()");
#endif
} }
#endif #endif
} }
@ -1060,11 +1076,13 @@ void MarlinSettings::postprocess() {
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
void ubl_invalid_slot(const int s) { #if ENABLED(EEPROM_CHITCHAT)
SERIAL_PROTOCOLLNPGM("?Invalid slot."); void ubl_invalid_slot(const int s) {
SERIAL_PROTOCOL(s); SERIAL_PROTOCOLLNPGM("?Invalid slot.");
SERIAL_PROTOCOLLNPGM(" mesh slots available."); SERIAL_PROTOCOL(s);
} SERIAL_PROTOCOLLNPGM(" mesh slots available.");
}
#endif
int MarlinSettings::calc_num_meshes() { int MarlinSettings::calc_num_meshes() {
//obviously this will get more sophisticated once we've added an actual MAT //obviously this will get more sophisticated once we've added an actual MAT
@ -1079,11 +1097,13 @@ void MarlinSettings::postprocess() {
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
const int a = calc_num_meshes(); const int a = calc_num_meshes();
if (!WITHIN(slot, 0, a - 1)) { if (!WITHIN(slot, 0, a - 1)) {
ubl_invalid_slot(a); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_PROTOCOLPAIR("E2END=", E2END); ubl_invalid_slot(a);
SERIAL_PROTOCOLPAIR(" meshes_end=", meshes_end); SERIAL_PROTOCOLPAIR("E2END=", E2END);
SERIAL_PROTOCOLLNPAIR(" slot=", slot); SERIAL_PROTOCOLPAIR(" meshes_end=", meshes_end);
SERIAL_EOL(); SERIAL_PROTOCOLLNPAIR(" slot=", slot);
SERIAL_EOL();
#endif
return; return;
} }
@ -1094,7 +1114,9 @@ void MarlinSettings::postprocess() {
// Write crc to MAT along with other data, or just tack on to the beginning or end // Write crc to MAT along with other data, or just tack on to the beginning or end
SERIAL_PROTOCOLLNPAIR("Mesh saved in slot ", slot); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_PROTOCOLLNPAIR("Mesh saved in slot ", slot);
#endif
#else #else
@ -1110,7 +1132,9 @@ void MarlinSettings::postprocess() {
const int16_t a = settings.calc_num_meshes(); const int16_t a = settings.calc_num_meshes();
if (!WITHIN(slot, 0, a - 1)) { if (!WITHIN(slot, 0, a - 1)) {
ubl_invalid_slot(a); #if ENABLED(EEPROM_CHITCHAT)
ubl_invalid_slot(a);
#endif
return; return;
} }
@ -1121,7 +1145,9 @@ void MarlinSettings::postprocess() {
// Compare crc with crc from MAT, or read from end // Compare crc with crc from MAT, or read from end
SERIAL_PROTOCOLLNPAIR("Mesh loaded from slot ", slot); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_PROTOCOLLNPAIR("Mesh loaded from slot ", slot);
#endif
#else #else
@ -1345,8 +1371,10 @@ void MarlinSettings::reset() {
postprocess(); postprocess();
SERIAL_ECHO_START(); #if ENABLED(EEPROM_CHITCHAT)
SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded"); SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
#endif
} }
#if DISABLED(DISABLE_M503) #if DISABLED(DISABLE_M503)