From 702c8acdd5ac009363c12e532924b828a3e804ac Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Fri, 5 Jan 2018 19:00:26 -0600
Subject: [PATCH] Settings FIELD_TEST fix
---
Marlin/src/module/configuration_store.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp
index 6c4d21f96c..48dd33649a 100644
--- a/Marlin/src/module/configuration_store.cpp
+++ b/Marlin/src/module/configuration_store.cpp
@@ -330,10 +330,10 @@ void MarlinSettings::postprocess() {
#define EEPROM_ASSERT(TST,ERR) if (!(TST)) do{ SERIAL_ERROR_START(); SERIAL_ERRORLNPGM(ERR); eeprom_error = true; }while(0)
#if ENABLED(DEBUG_EEPROM_READWRITE)
- #define _FIELD_TEST(FIELD) \
- EEPROM_ASSERT( \
- eeprom_error || eeprom_index == offsetof(SettingsData, FIELD), \
- "Field " STRINGIFY(FIELD) " mismatch." \
+ #define _FIELD_TEST(FIELD) \
+ EEPROM_ASSERT( \
+ eeprom_error || eeprom_index == offsetof(SettingsData, FIELD) + EEPROM_OFFSET, \
+ "Field " STRINGIFY(FIELD) " mismatch." \
)
#else
#define _FIELD_TEST(FIELD) NOOP
@@ -357,7 +357,7 @@ void MarlinSettings::postprocess() {
*/
bool MarlinSettings::save() {
float dummy = 0.0f;
- char ver[4] = "000";
+ char ver[4] = "ERR";
uint16_t working_crc = 0;
@@ -840,7 +840,7 @@ void MarlinSettings::postprocess() {
// Version has to match or defaults are used
if (strncmp(version, stored_ver, 3) != 0) {
- if (stored_ver[0] != 'V') {
+ if (stored_ver[3] != '\0') {
stored_ver[0] = '?';
stored_ver[1] = '\0';
}
--
GitLab