diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp
index 4ea56ff6f8451354e010eae65872f7e73c8a9e12..a6a33061613326da81fa294d042f1fd291742d91 100644
--- a/Marlin/configuration_store.cpp
+++ b/Marlin/configuration_store.cpp
@@ -625,15 +625,18 @@ void MarlinSettings::postprocess() {
if (!eeprom_error) {
const int eeprom_size = eeprom_index;
+ const uint16_t tcrc = working_crc;
+
// Write the EEPROM header
eeprom_index = EEPROM_OFFSET;
+
EEPROM_WRITE(version);
- EEPROM_WRITE(working_crc);
+ EEPROM_WRITE(tcrc);
// Report storage size
SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Settings Stored (", eeprom_size - (EEPROM_OFFSET));
- SERIAL_ECHOPAIR(" bytes; crc ", working_crc);
+ SERIAL_ECHOPAIR(" bytes; crc ", tcrc);
SERIAL_ECHOLNPGM(")");
}
@@ -982,11 +985,11 @@ void MarlinSettings::postprocess() {
}
else {
SERIAL_ERROR_START;
- SERIAL_ERRORPGM("EEPROM checksum mismatch - (stored CRC)");
+ SERIAL_ERRORPGM("EEPROM CRC mismatch - (stored) ");
SERIAL_ERROR(stored_crc);
SERIAL_ERRORPGM(" != ");
SERIAL_ERROR(working_crc);
- SERIAL_ERRORLNPGM(" (calculated CRC)!");
+ SERIAL_ERRORLNPGM(" (calculated)!");
reset();
}
@@ -1027,7 +1030,6 @@ void MarlinSettings::postprocess() {
return !eeprom_error;
}
-
#if ENABLED(AUTO_BED_LEVELING_UBL)
void ubl_invalid_slot(const int s) {
@@ -1051,7 +1053,7 @@ void MarlinSettings::postprocess() {
if (!WITHIN(slot, 0, a - 1)) {
ubl_invalid_slot(a);
SERIAL_PROTOCOLPAIR("E2END=", E2END);
- SERIAL_PROTOCOLPAIR(" meshes_end=", (int)meshes_end);
+ SERIAL_PROTOCOLPAIR(" meshes_end=", meshes_end);
SERIAL_PROTOCOLLNPAIR(" slot=", slot);
SERIAL_EOL;
return;
diff --git a/Marlin/configuration_store.h b/Marlin/configuration_store.h
index 1166ed29ea628dcc9a4c4c2a1f4c6446804af304..23a716a94f617c5b3e155e0dbb5e58974a7a5f02 100644
--- a/Marlin/configuration_store.h
+++ b/Marlin/configuration_store.h
@@ -67,8 +67,8 @@ class MarlinSettings {
#if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
// That can store is enabled
static int meshes_begin;
- const static int mat_end = E2END; // Mesh allocation table; this may not end up being necessary
- const static int meshes_end = mat_end - 128; // 128 is a placeholder for the size of the MAT
+ const static int meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always
+ // live at the very end of the eeprom
#endif
diff --git a/Marlin/utility.cpp b/Marlin/utility.cpp
index 43544106eb75647aeea0adf61ef987f723e07792..15378fb629b98a43fa859aa997b9b407b5497d44 100644
--- a/Marlin/utility.cpp
+++ b/Marlin/utility.cpp
@@ -37,8 +37,8 @@ void safe_delay(millis_t ms) {
#if ENABLED(EEPROM_SETTINGS)
void crc16(uint16_t *crc, const void * const data, uint16_t cnt) {
- uint8_t *ptr = (uint8_t*)data;
- while (cnt-- > 0) {
+ uint8_t *ptr = (uint8_t *)data;
+ while (cnt--) {
*crc = (uint16_t)(*crc ^ (uint16_t)(((uint16_t)*ptr++) << 8));
for (uint8_t x = 0; x < 8; x++)
*crc = (uint16_t)((*crc & 0x8000) ? ((uint16_t)(*crc << 1) ^ 0x1021) : (*crc << 1));