|
@@ -45,6 +45,17 @@
|
45
|
45
|
//#define DEBUG_EEPROM_READWRITE
|
46
|
46
|
|
47
|
47
|
#include "configuration_store.h"
|
|
48
|
+
|
|
49
|
+#if ADD_PORT_ARG
|
|
50
|
+ #define PORTARG_SOLO const int8_t port
|
|
51
|
+ #define PORTARG_AFTER ,const int8_t port
|
|
52
|
+ #define PORTVAR_SOLO port
|
|
53
|
+#else
|
|
54
|
+ #define PORTARG_SOLO
|
|
55
|
+ #define PORTARG_AFTER
|
|
56
|
+ #define PORTVAR_SOLO
|
|
57
|
+#endif
|
|
58
|
+
|
48
|
59
|
#include "endstops.h"
|
49
|
60
|
#include "planner.h"
|
50
|
61
|
#include "stepper.h"
|
|
@@ -345,11 +356,7 @@ void MarlinSettings::postprocess() {
|
345
|
356
|
|
346
|
357
|
bool MarlinSettings::eeprom_error, MarlinSettings::validating;
|
347
|
358
|
|
348
|
|
- bool MarlinSettings::size_error(const uint16_t size
|
349
|
|
- #if ADD_PORT_ARG
|
350
|
|
- , const int8_t port/*=-1*/
|
351
|
|
- #endif
|
352
|
|
- ) {
|
|
359
|
+ bool MarlinSettings::size_error(const uint16_t size PORTARG_AFTER) {
|
353
|
360
|
if (size != datasize()) {
|
354
|
361
|
#if ENABLED(EEPROM_CHITCHAT)
|
355
|
362
|
SERIAL_ERROR_START_P(port);
|
|
@@ -363,11 +370,7 @@ void MarlinSettings::postprocess() {
|
363
|
370
|
/**
|
364
|
371
|
* M500 - Store Configuration
|
365
|
372
|
*/
|
366
|
|
- bool MarlinSettings::save(
|
367
|
|
- #if ADD_PORT_ARG
|
368
|
|
- const int8_t port/*=-1*/
|
369
|
|
- #endif
|
370
|
|
- ) {
|
|
373
|
+ bool MarlinSettings::save(PORTARG_SOLO) {
|
371
|
374
|
float dummy = 0.0f;
|
372
|
375
|
char ver[4] = "ERR";
|
373
|
376
|
|
|
@@ -853,11 +856,7 @@ void MarlinSettings::postprocess() {
|
853
|
856
|
/**
|
854
|
857
|
* M501 - Retrieve Configuration
|
855
|
858
|
*/
|
856
|
|
- bool MarlinSettings::_load(
|
857
|
|
- #if ADD_PORT_ARG
|
858
|
|
- const int8_t port/*=-1*/
|
859
|
|
- #endif
|
860
|
|
- ) {
|
|
859
|
+ bool MarlinSettings::_load(PORTARG_SOLO) {
|
861
|
860
|
uint16_t working_crc = 0;
|
862
|
861
|
|
863
|
862
|
EEPROM_START();
|
|
@@ -1431,46 +1430,22 @@ void MarlinSettings::postprocess() {
|
1431
|
1430
|
}
|
1432
|
1431
|
|
1433
|
1432
|
#if ENABLED(EEPROM_CHITCHAT) && DISABLED(DISABLE_M503)
|
1434
|
|
- if (!validating) report(
|
1435
|
|
- #if ADD_PORT_ARG
|
1436
|
|
- port
|
1437
|
|
- #endif
|
1438
|
|
- );
|
|
1433
|
+ if (!validating) report(PORTVAR_SOLO);
|
1439
|
1434
|
#endif
|
1440
|
1435
|
EEPROM_FINISH();
|
1441
|
1436
|
|
1442
|
1437
|
return !eeprom_error;
|
1443
|
1438
|
}
|
1444
|
1439
|
|
1445
|
|
- bool MarlinSettings::validate(
|
1446
|
|
- #if ADD_PORT_ARG
|
1447
|
|
- const int8_t port/*=-1*/
|
1448
|
|
- #endif
|
1449
|
|
- ) {
|
|
1440
|
+ bool MarlinSettings::validate(PORTARG_SOLO) {
|
1450
|
1441
|
validating = true;
|
1451
|
|
- const bool success = _load(
|
1452
|
|
- #if ADD_PORT_ARG
|
1453
|
|
- port
|
1454
|
|
- #endif
|
1455
|
|
- );
|
|
1442
|
+ const bool success = _load(PORTVAR_SOLO);
|
1456
|
1443
|
validating = false;
|
1457
|
1444
|
return success;
|
1458
|
1445
|
}
|
1459
|
1446
|
|
1460
|
|
- bool MarlinSettings::load(
|
1461
|
|
- #if ADD_PORT_ARG
|
1462
|
|
- const int8_t port/*=-1*/
|
1463
|
|
- #endif
|
1464
|
|
- ) {
|
1465
|
|
- if (validate(
|
1466
|
|
- #if ADD_PORT_ARG
|
1467
|
|
- port
|
1468
|
|
- #endif
|
1469
|
|
- )) return _load(
|
1470
|
|
- #if ADD_PORT_ARG
|
1471
|
|
- port
|
1472
|
|
- #endif
|
1473
|
|
- );
|
|
1447
|
+ bool MarlinSettings::load(PORTARG_SOLO) {
|
|
1448
|
+ if (validate(PORTVAR_SOLO)) return _load(PORTVAR_SOLO);
|
1474
|
1449
|
reset();
|
1475
|
1450
|
return true;
|
1476
|
1451
|
}
|
|
@@ -1581,11 +1556,7 @@ void MarlinSettings::postprocess() {
|
1581
|
1556
|
|
1582
|
1557
|
#else // !EEPROM_SETTINGS
|
1583
|
1558
|
|
1584
|
|
- bool MarlinSettings::save(
|
1585
|
|
- #if ADD_PORT_ARG
|
1586
|
|
- const int8_t port/*=-1*/
|
1587
|
|
- #endif
|
1588
|
|
- ) {
|
|
1559
|
+ bool MarlinSettings::save(PORTARG_SOLO) {
|
1589
|
1560
|
#if ENABLED(EEPROM_CHITCHAT)
|
1590
|
1561
|
SERIAL_ERROR_START_P(port);
|
1591
|
1562
|
SERIAL_ERRORLNPGM_P(port, "EEPROM disabled");
|
|
@@ -1598,11 +1569,7 @@ void MarlinSettings::postprocess() {
|
1598
|
1569
|
/**
|
1599
|
1570
|
* M502 - Reset Configuration
|
1600
|
1571
|
*/
|
1601
|
|
-void MarlinSettings::reset(
|
1602
|
|
- #if ADD_PORT_ARG
|
1603
|
|
- const int8_t port/*=-1*/
|
1604
|
|
- #endif
|
1605
|
|
-) {
|
|
1572
|
+void MarlinSettings::reset(PORTARG_SOLO) {
|
1606
|
1573
|
static const float tmp1[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] PROGMEM = DEFAULT_MAX_FEEDRATE;
|
1607
|
1574
|
static const uint32_t tmp3[] PROGMEM = DEFAULT_MAX_ACCELERATION;
|
1608
|
1575
|
LOOP_XYZE_N(i) {
|
|
@@ -1860,11 +1827,7 @@ void MarlinSettings::reset(
|
1860
|
1827
|
|
1861
|
1828
|
#if DISABLED(DISABLE_M503)
|
1862
|
1829
|
|
1863
|
|
- #if ADD_PORT_ARG
|
1864
|
|
- #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0)
|
1865
|
|
- #else
|
1866
|
|
- #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START(); }while(0)
|
1867
|
|
- #endif
|
|
1830
|
+ #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(PORTVAR_SOLO); }while(0)
|
1868
|
1831
|
|
1869
|
1832
|
/**
|
1870
|
1833
|
* M503 - Report current settings in RAM
|
|
@@ -2129,11 +2092,7 @@ void MarlinSettings::reset(
|
2129
|
2092
|
SERIAL_ECHOLNPGM_P(port, " meshes.\n");
|
2130
|
2093
|
}
|
2131
|
2094
|
|
2132
|
|
- ubl.report_current_mesh(
|
2133
|
|
- #if ADD_PORT_ARG
|
2134
|
|
- port
|
2135
|
|
- #endif
|
2136
|
|
- );
|
|
2095
|
+ ubl.report_current_mesh(PORTVAR_SOLO);
|
2137
|
2096
|
|
2138
|
2097
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
2139
|
2098
|
|