|
@@ -572,13 +572,6 @@ void MarlinSettings::postprocess() {
|
572
|
572
|
|
573
|
573
|
#if ENABLED(EEPROM_SETTINGS)
|
574
|
574
|
|
575
|
|
- #define EEPROM_START() if (!persistentStore.access_start()) { SERIAL_ECHO_MSG("No EEPROM."); return false; } \
|
576
|
|
- int eeprom_index = EEPROM_OFFSET
|
577
|
|
- #define EEPROM_FINISH() persistentStore.access_finish()
|
578
|
|
- #define EEPROM_SKIP(VAR) (eeprom_index += sizeof(VAR))
|
579
|
|
- #define EEPROM_WRITE(VAR) do{ persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc); }while(0)
|
580
|
|
- #define EEPROM_READ(VAR) do{ persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating); }while(0)
|
581
|
|
- #define EEPROM_READ_ALWAYS(VAR) do{ persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc); }while(0)
|
582
|
575
|
#define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0)
|
583
|
576
|
|
584
|
577
|
#if ENABLED(DEBUG_EEPROM_READWRITE)
|
|
@@ -594,6 +587,8 @@ void MarlinSettings::postprocess() {
|
594
|
587
|
const char version[4] = EEPROM_VERSION;
|
595
|
588
|
|
596
|
589
|
bool MarlinSettings::eeprom_error, MarlinSettings::validating;
|
|
590
|
+ int MarlinSettings::eeprom_index;
|
|
591
|
+ uint16_t MarlinSettings::working_crc;
|
597
|
592
|
|
598
|
593
|
bool MarlinSettings::size_error(const uint16_t size) {
|
599
|
594
|
if (size != datasize()) {
|
|
@@ -610,9 +605,7 @@ void MarlinSettings::postprocess() {
|
610
|
605
|
float dummyf = 0;
|
611
|
606
|
char ver[4] = "ERR";
|
612
|
607
|
|
613
|
|
- uint16_t working_crc = 0;
|
614
|
|
-
|
615
|
|
- EEPROM_START();
|
|
608
|
+ if (!EEPROM_START(EEPROM_OFFSET)) return false;
|
616
|
609
|
|
617
|
610
|
eeprom_error = false;
|
618
|
611
|
|
|
@@ -1456,9 +1449,7 @@ void MarlinSettings::postprocess() {
|
1456
|
1449
|
* M501 - Retrieve Configuration
|
1457
|
1450
|
*/
|
1458
|
1451
|
bool MarlinSettings::_load() {
|
1459
|
|
- uint16_t working_crc = 0;
|
1460
|
|
-
|
1461
|
|
- EEPROM_START();
|
|
1452
|
+ if (!EEPROM_START(EEPROM_OFFSET)) return false;
|
1462
|
1453
|
|
1463
|
1454
|
char stored_ver[4];
|
1464
|
1455
|
EEPROM_READ_ALWAYS(stored_ver);
|
|
@@ -1496,10 +1487,10 @@ void MarlinSettings::postprocess() {
|
1496
|
1487
|
uint32_t tmp1[XYZ + esteppers];
|
1497
|
1488
|
float tmp2[XYZ + esteppers];
|
1498
|
1489
|
feedRate_t tmp3[XYZ + esteppers];
|
1499
|
|
- EEPROM_READ(tmp1); // max_acceleration_mm_per_s2
|
|
1490
|
+ EEPROM_READ((uint8_t *)tmp1, sizeof(tmp1)); // max_acceleration_mm_per_s2
|
1500
|
1491
|
EEPROM_READ(planner.settings.min_segment_time_us);
|
1501
|
|
- EEPROM_READ(tmp2); // axis_steps_per_mm
|
1502
|
|
- EEPROM_READ(tmp3); // max_feedrate_mm_s
|
|
1492
|
+ EEPROM_READ((uint8_t *)tmp2, sizeof(tmp2)); // axis_steps_per_mm
|
|
1493
|
+ EEPROM_READ((uint8_t *)tmp3, sizeof(tmp3)); // max_feedrate_mm_s
|
1503
|
1494
|
|
1504
|
1495
|
if (!validating) LOOP_XYZE_N(i) {
|
1505
|
1496
|
const bool in = (i < esteppers + XYZ);
|