|
@@ -289,12 +289,13 @@ void MarlinSettings::postprocess() {
|
289
|
289
|
#define EEPROM_FINISH() HAL::PersistentStore::access_finish()
|
290
|
290
|
#define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR)
|
291
|
291
|
#define EEPROM_WRITE(VAR) HAL::PersistentStore::write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
|
292
|
|
- #define EEPROM_READ(VAR) HAL::PersistentStore::read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
|
|
292
|
+ #define EEPROM_READ(VAR) HAL::PersistentStore::read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating)
|
|
293
|
+ #define EEPROM_READ_ALWAYS(VAR) HAL::PersistentStore::read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc)
|
293
|
294
|
#define EEPROM_ASSERT(TST,ERR) if (!(TST)) do{ SERIAL_ERROR_START(); SERIAL_ERRORLNPGM(ERR); eeprom_read_error = true; }while(0)
|
294
|
295
|
|
295
|
296
|
const char version[4] = EEPROM_VERSION;
|
296
|
297
|
|
297
|
|
- bool MarlinSettings::eeprom_error;
|
|
298
|
+ bool MarlinSettings::eeprom_error, MarlinSettings::validating;
|
298
|
299
|
|
299
|
300
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
300
|
301
|
int16_t MarlinSettings::meshes_begin;
|
|
@@ -718,6 +719,9 @@ void MarlinSettings::postprocess() {
|
718
|
719
|
for (uint8_t q = MAX_EXTRUDERS * 2; q--;) EEPROM_WRITE(dummy);
|
719
|
720
|
#endif
|
720
|
721
|
|
|
722
|
+ //
|
|
723
|
+ // Validate CRC
|
|
724
|
+ //
|
721
|
725
|
if (!eeprom_error) {
|
722
|
726
|
#if ENABLED(EEPROM_CHITCHAT)
|
723
|
727
|
const int eeprom_size = eeprom_index;
|
|
@@ -741,6 +745,9 @@ void MarlinSettings::postprocess() {
|
741
|
745
|
}
|
742
|
746
|
EEPROM_FINISH();
|
743
|
747
|
|
|
748
|
+ //
|
|
749
|
+ // UBL Mesh
|
|
750
|
+ //
|
744
|
751
|
#if ENABLED(UBL_SAVE_ACTIVE_ON_M500)
|
745
|
752
|
if (ubl.storage_slot >= 0)
|
746
|
753
|
store_mesh(ubl.storage_slot);
|
|
@@ -752,16 +759,16 @@ void MarlinSettings::postprocess() {
|
752
|
759
|
/**
|
753
|
760
|
* M501 - Retrieve Configuration
|
754
|
761
|
*/
|
755
|
|
- bool MarlinSettings::load() {
|
|
762
|
+ bool MarlinSettings::_load() {
|
756
|
763
|
uint16_t working_crc = 0;
|
757
|
764
|
|
758
|
765
|
EEPROM_START();
|
759
|
766
|
|
760
|
767
|
char stored_ver[4];
|
761
|
|
- EEPROM_READ(stored_ver);
|
|
768
|
+ EEPROM_READ_ALWAYS(stored_ver);
|
762
|
769
|
|
763
|
770
|
uint16_t stored_crc;
|
764
|
|
- EEPROM_READ(stored_crc);
|
|
771
|
+ EEPROM_READ_ALWAYS(stored_crc);
|
765
|
772
|
|
766
|
773
|
// Version has to match or defaults are used
|
767
|
774
|
if (strncmp(version, stored_ver, 3) != 0) {
|
|
@@ -775,7 +782,8 @@ void MarlinSettings::postprocess() {
|
775
|
782
|
SERIAL_ECHOPAIR("(EEPROM=", stored_ver);
|
776
|
783
|
SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")");
|
777
|
784
|
#endif
|
778
|
|
- reset();
|
|
785
|
+ if (!validating) reset();
|
|
786
|
+ eeprom_error = true;
|
779
|
787
|
}
|
780
|
788
|
else {
|
781
|
789
|
float dummy = 0;
|
|
@@ -787,7 +795,7 @@ void MarlinSettings::postprocess() {
|
787
|
795
|
|
788
|
796
|
// Number of esteppers may change
|
789
|
797
|
uint8_t esteppers;
|
790
|
|
- EEPROM_READ(esteppers);
|
|
798
|
+ EEPROM_READ_ALWAYS(esteppers);
|
791
|
799
|
|
792
|
800
|
//
|
793
|
801
|
// Planner Motion
|
|
@@ -802,7 +810,7 @@ void MarlinSettings::postprocess() {
|
802
|
810
|
EEPROM_READ(tmp1);
|
803
|
811
|
EEPROM_READ(tmp2);
|
804
|
812
|
EEPROM_READ(tmp3);
|
805
|
|
- LOOP_XYZE_N(i) {
|
|
813
|
+ if (!validating) LOOP_XYZE_N(i) {
|
806
|
814
|
planner.axis_steps_per_mm[i] = i < XYZ + esteppers ? tmp1[i] : def1[i < COUNT(def1) ? i : COUNT(def1) - 1];
|
807
|
815
|
planner.max_feedrate_mm_s[i] = i < XYZ + esteppers ? tmp2[i] : def2[i < COUNT(def2) ? i : COUNT(def2) - 1];
|
808
|
816
|
planner.max_acceleration_mm_per_s2[i] = i < XYZ + esteppers ? tmp3[i] : def3[i < COUNT(def3) ? i : COUNT(def3) - 1];
|
|
@@ -851,21 +859,23 @@ void MarlinSettings::postprocess() {
|
851
|
859
|
|
852
|
860
|
bool leveling_is_on;
|
853
|
861
|
uint8_t mesh_num_x, mesh_num_y;
|
854
|
|
- EEPROM_READ(leveling_is_on);
|
|
862
|
+ EEPROM_READ_ALWAYS(leveling_is_on);
|
855
|
863
|
EEPROM_READ(dummy);
|
856
|
|
- EEPROM_READ(mesh_num_x);
|
857
|
|
- EEPROM_READ(mesh_num_y);
|
|
864
|
+ EEPROM_READ_ALWAYS(mesh_num_x);
|
|
865
|
+ EEPROM_READ_ALWAYS(mesh_num_y);
|
858
|
866
|
|
859
|
867
|
#if ENABLED(MESH_BED_LEVELING)
|
860
|
|
- mbl.has_mesh = leveling_is_on;
|
861
|
|
- mbl.z_offset = dummy;
|
|
868
|
+ if (!validating) {
|
|
869
|
+ mbl.has_mesh = leveling_is_on;
|
|
870
|
+ mbl.z_offset = dummy;
|
|
871
|
+ }
|
862
|
872
|
if (mesh_num_x == GRID_MAX_POINTS_X && mesh_num_y == GRID_MAX_POINTS_Y) {
|
863
|
873
|
// EEPROM data fits the current mesh
|
864
|
874
|
EEPROM_READ(mbl.z_values);
|
865
|
875
|
}
|
866
|
876
|
else {
|
867
|
877
|
// EEPROM data is stale
|
868
|
|
- mbl.reset();
|
|
878
|
+ if (!validating) mbl.reset();
|
869
|
879
|
for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy);
|
870
|
880
|
}
|
871
|
881
|
#else
|
|
@@ -893,11 +903,11 @@ void MarlinSettings::postprocess() {
|
893
|
903
|
//
|
894
|
904
|
|
895
|
905
|
uint8_t grid_max_x, grid_max_y;
|
896
|
|
- EEPROM_READ(grid_max_x); // 1 byte
|
897
|
|
- EEPROM_READ(grid_max_y); // 1 byte
|
|
906
|
+ EEPROM_READ_ALWAYS(grid_max_x); // 1 byte
|
|
907
|
+ EEPROM_READ_ALWAYS(grid_max_y); // 1 byte
|
898
|
908
|
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
899
|
909
|
if (grid_max_x == GRID_MAX_POINTS_X && grid_max_y == GRID_MAX_POINTS_Y) {
|
900
|
|
- set_bed_leveling_enabled(false);
|
|
910
|
+ if (!validating) set_bed_leveling_enabled(false);
|
901
|
911
|
EEPROM_READ(bilinear_grid_spacing); // 2 ints
|
902
|
912
|
EEPROM_READ(bilinear_start); // 2 ints
|
903
|
913
|
EEPROM_READ(z_values); // 9 to 256 floats
|
|
@@ -989,7 +999,7 @@ void MarlinSettings::postprocess() {
|
989
|
999
|
EEPROM_READ(dummy); // Kp
|
990
|
1000
|
if (e < HOTENDS && dummy != DUMMY_PID_VALUE) {
|
991
|
1001
|
// do not need to scale PID values as the values in EEPROM are already scaled
|
992
|
|
- PID_PARAM(Kp, e) = dummy;
|
|
1002
|
+ if (!validating) PID_PARAM(Kp, e) = dummy;
|
993
|
1003
|
EEPROM_READ(PID_PARAM(Ki, e));
|
994
|
1004
|
EEPROM_READ(PID_PARAM(Kd, e));
|
995
|
1005
|
#if ENABLED(PID_EXTRUSION_SCALING)
|
|
@@ -1023,7 +1033,7 @@ void MarlinSettings::postprocess() {
|
1023
|
1033
|
#if ENABLED(PIDTEMPBED)
|
1024
|
1034
|
EEPROM_READ(dummy); // bedKp
|
1025
|
1035
|
if (dummy != DUMMY_PID_VALUE) {
|
1026
|
|
- thermalManager.bedKp = dummy;
|
|
1036
|
+ if (!validating) thermalManager.bedKp = dummy;
|
1027
|
1037
|
EEPROM_READ(thermalManager.bedKi);
|
1028
|
1038
|
EEPROM_READ(thermalManager.bedKd);
|
1029
|
1039
|
}
|
|
@@ -1068,7 +1078,8 @@ void MarlinSettings::postprocess() {
|
1068
|
1078
|
|
1069
|
1079
|
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
1070
|
1080
|
EEPROM_READ(dummy);
|
1071
|
|
- if (q < COUNT(planner.filament_size)) planner.filament_size[q] = dummy;
|
|
1081
|
+ if (!validating && q < COUNT(planner.filament_size))
|
|
1082
|
+ planner.filament_size[q] = dummy;
|
1072
|
1083
|
}
|
1073
|
1084
|
|
1074
|
1085
|
#else
|
|
@@ -1081,55 +1092,48 @@ void MarlinSettings::postprocess() {
|
1081
|
1092
|
//
|
1082
|
1093
|
// TMC2130 Stepper Current
|
1083
|
1094
|
//
|
1084
|
|
-
|
1085
|
|
- uint16_t val;
|
1086
|
1095
|
#if HAS_TRINAMIC
|
|
1096
|
+ #define SET_CURR(N,Q) stepper##Q.setCurrent(val[N], R_SENSE, HOLD_MULTIPLIER)
|
|
1097
|
+ uint16_t val[11];
|
1087
|
1098
|
EEPROM_READ(val);
|
1088
|
|
- #if X_IS_TRINAMIC
|
1089
|
|
- stepperX.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1090
|
|
- #endif
|
1091
|
|
- EEPROM_READ(val);
|
1092
|
|
- #if Y_IS_TRINAMIC
|
1093
|
|
- stepperY.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1094
|
|
- #endif
|
1095
|
|
- EEPROM_READ(val);
|
1096
|
|
- #if Z_IS_TRINAMIC
|
1097
|
|
- stepperZ.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1098
|
|
- #endif
|
1099
|
|
- EEPROM_READ(val);
|
1100
|
|
- #if X2_IS_TRINAMIC
|
1101
|
|
- stepperX2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1102
|
|
- #endif
|
1103
|
|
- EEPROM_READ(val);
|
1104
|
|
- #if Y2_IS_TRINAMIC
|
1105
|
|
- stepperY2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1106
|
|
- #endif
|
1107
|
|
- EEPROM_READ(val);
|
1108
|
|
- #if Z2_IS_TRINAMIC
|
1109
|
|
- stepperZ2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1110
|
|
- #endif
|
1111
|
|
- EEPROM_READ(val);
|
1112
|
|
- #if E0_IS_TRINAMIC
|
1113
|
|
- stepperE0.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1114
|
|
- #endif
|
1115
|
|
- EEPROM_READ(val);
|
1116
|
|
- #if E1_IS_TRINAMIC
|
1117
|
|
- stepperE1.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1118
|
|
- #endif
|
1119
|
|
- EEPROM_READ(val);
|
1120
|
|
- #if E2_IS_TRINAMIC
|
1121
|
|
- stepperE2.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1122
|
|
- #endif
|
1123
|
|
- EEPROM_READ(val);
|
1124
|
|
- #if E3_IS_TRINAMIC
|
1125
|
|
- stepperE3.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1126
|
|
- #endif
|
1127
|
|
- EEPROM_READ(val);
|
1128
|
|
- #if E4_IS_TRINAMIC
|
1129
|
|
- stepperE4.setCurrent(val, R_SENSE, HOLD_MULTIPLIER);
|
1130
|
|
- #endif
|
|
1099
|
+ if (!validating) {
|
|
1100
|
+ #if X_IS_TRINAMIC
|
|
1101
|
+ SET_CURR(0, X);
|
|
1102
|
+ #endif
|
|
1103
|
+ #if Y_IS_TRINAMIC
|
|
1104
|
+ SET_CURR(1, Y);
|
|
1105
|
+ #endif
|
|
1106
|
+ #if Z_IS_TRINAMIC
|
|
1107
|
+ SET_CURR(2, Z);
|
|
1108
|
+ #endif
|
|
1109
|
+ #if X2_IS_TRINAMIC
|
|
1110
|
+ SET_CURR(3, X2);
|
|
1111
|
+ #endif
|
|
1112
|
+ #if Y2_IS_TRINAMIC
|
|
1113
|
+ SET_CURR(4, Y2);
|
|
1114
|
+ #endif
|
|
1115
|
+ #if Z2_IS_TRINAMIC
|
|
1116
|
+ SET_CURR(5, Z2);
|
|
1117
|
+ #endif
|
|
1118
|
+ #if E0_IS_TRINAMIC
|
|
1119
|
+ SET_CURR(6, E0);
|
|
1120
|
+ #endif
|
|
1121
|
+ #if E1_IS_TRINAMIC
|
|
1122
|
+ SET_CURR(7, E1);
|
|
1123
|
+ #endif
|
|
1124
|
+ #if E2_IS_TRINAMIC
|
|
1125
|
+ SET_CURR(8, E2);
|
|
1126
|
+ #endif
|
|
1127
|
+ #if E3_IS_TRINAMIC
|
|
1128
|
+ SET_CURR(9, E3);
|
|
1129
|
+ #endif
|
|
1130
|
+ #if E4_IS_TRINAMIC
|
|
1131
|
+ SET_CURR(10, E4);
|
|
1132
|
+ #endif
|
|
1133
|
+ }
|
1131
|
1134
|
#else
|
1132
|
|
- for (uint8_t q = 11; q--;) EEPROM_READ(val);
|
|
1135
|
+ uint16_t val;
|
|
1136
|
+ for (uint8_t q=11; q--;) EEPROM_READ(val);
|
1133
|
1137
|
#endif
|
1134
|
1138
|
|
1135
|
1139
|
/*
|
|
@@ -1140,19 +1144,23 @@ void MarlinSettings::postprocess() {
|
1140
|
1144
|
int16_t thrs;
|
1141
|
1145
|
#if ENABLED(SENSORLESS_HOMING)
|
1142
|
1146
|
EEPROM_READ(thrs);
|
1143
|
|
- #if ENABLED(X_IS_TMC2130)
|
1144
|
|
- stepperX.sgt(thrs);
|
1145
|
|
- #endif
|
1146
|
|
- #if ENABLED(X2_IS_TMC2130)
|
1147
|
|
- stepperX2.sgt(thrs);
|
1148
|
|
- #endif
|
|
1147
|
+ if (!validating) {
|
|
1148
|
+ #if ENABLED(X_IS_TMC2130)
|
|
1149
|
+ stepperX.sgt(thrs);
|
|
1150
|
+ #endif
|
|
1151
|
+ #if ENABLED(X2_IS_TMC2130)
|
|
1152
|
+ stepperX2.sgt(thrs);
|
|
1153
|
+ #endif
|
|
1154
|
+ }
|
1149
|
1155
|
EEPROM_READ(thrs);
|
1150
|
|
- #if ENABLED(Y_IS_TMC2130)
|
1151
|
|
- stepperY.sgt(thrs);
|
1152
|
|
- #endif
|
1153
|
|
- #if ENABLED(Y2_IS_TMC2130)
|
1154
|
|
- stepperY2.sgt(thrs);
|
1155
|
|
- #endif
|
|
1156
|
+ if (!validating) {
|
|
1157
|
+ #if ENABLED(Y_IS_TMC2130)
|
|
1158
|
+ stepperY.sgt(thrs);
|
|
1159
|
+ #endif
|
|
1160
|
+ #if ENABLED(Y2_IS_TMC2130)
|
|
1161
|
+ stepperY2.sgt(thrs);
|
|
1162
|
+ #endif
|
|
1163
|
+ }
|
1156
|
1164
|
#else
|
1157
|
1165
|
for (uint8_t q = 0; q < 2; q++) EEPROM_READ(thrs);
|
1158
|
1166
|
#endif
|
|
@@ -1185,7 +1193,7 @@ void MarlinSettings::postprocess() {
|
1185
|
1193
|
//
|
1186
|
1194
|
|
1187
|
1195
|
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
1188
|
|
- (void)gcode.select_coordinate_system(-1); // Go back to machine space
|
|
1196
|
+ if (!validating) (void)gcode.select_coordinate_system(-1); // Go back to machine space
|
1189
|
1197
|
EEPROM_READ(gcode.coordinate_system); // 27 floats
|
1190
|
1198
|
#else
|
1191
|
1199
|
for (uint8_t q = 27; q--;) EEPROM_READ(dummy);
|
|
@@ -1215,25 +1223,27 @@ void MarlinSettings::postprocess() {
|
1215
|
1223
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
1216
|
1224
|
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
1217
|
1225
|
EEPROM_READ(dummy);
|
1218
|
|
- if (q < COUNT(filament_change_unload_length)) filament_change_unload_length[q] = dummy;
|
|
1226
|
+ if (!validating && q < COUNT(filament_change_unload_length)) filament_change_unload_length[q] = dummy;
|
1219
|
1227
|
}
|
1220
|
1228
|
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
1221
|
1229
|
EEPROM_READ(dummy);
|
1222
|
|
- if (q < COUNT(filament_change_load_length)) filament_change_load_length[q] = dummy;
|
|
1230
|
+ if (!validating && q < COUNT(filament_change_load_length)) filament_change_load_length[q] = dummy;
|
1223
|
1231
|
}
|
1224
|
1232
|
#else
|
1225
|
1233
|
for (uint8_t q = MAX_EXTRUDERS * 2; q--;) EEPROM_READ(dummy);
|
1226
|
1234
|
#endif
|
1227
|
1235
|
|
1228
|
1236
|
if (working_crc == stored_crc) {
|
1229
|
|
- postprocess();
|
1230
|
|
- #if ENABLED(EEPROM_CHITCHAT)
|
1231
|
|
- SERIAL_ECHO_START();
|
1232
|
|
- SERIAL_ECHO(version);
|
1233
|
|
- SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
|
1234
|
|
- SERIAL_ECHOPAIR(" bytes; crc ", (uint32_t)working_crc);
|
1235
|
|
- SERIAL_ECHOLNPGM(")");
|
1236
|
|
- #endif
|
|
1237
|
+ if (!validating) {
|
|
1238
|
+ postprocess();
|
|
1239
|
+ #if ENABLED(EEPROM_CHITCHAT)
|
|
1240
|
+ SERIAL_ECHO_START();
|
|
1241
|
+ SERIAL_ECHO(version);
|
|
1242
|
+ SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET));
|
|
1243
|
+ SERIAL_ECHOPAIR(" bytes; crc ", (uint32_t)working_crc);
|
|
1244
|
+ SERIAL_ECHOLNPGM(")");
|
|
1245
|
+ #endif
|
|
1246
|
+ }
|
1237
|
1247
|
}
|
1238
|
1248
|
else {
|
1239
|
1249
|
#if ENABLED(EEPROM_CHITCHAT)
|
|
@@ -1253,46 +1263,62 @@ void MarlinSettings::postprocess() {
|
1253
|
1263
|
// disrupting the mesh data
|
1254
|
1264
|
ubl.report_state();
|
1255
|
1265
|
|
1256
|
|
- if (!ubl.sanity_check()) {
|
1257
|
|
- SERIAL_EOL();
|
1258
|
|
- #if ENABLED(EEPROM_CHITCHAT)
|
1259
|
|
- ubl.echo_name();
|
1260
|
|
- SERIAL_ECHOLNPGM(" initialized.\n");
|
1261
|
|
- #endif
|
1262
|
|
- }
|
1263
|
|
- else {
|
1264
|
|
- #if ENABLED(EEPROM_CHITCHAT)
|
1265
|
|
- SERIAL_PROTOCOLPGM("?Can't enable ");
|
1266
|
|
- ubl.echo_name();
|
1267
|
|
- SERIAL_PROTOCOLLNPGM(".");
|
1268
|
|
- #endif
|
1269
|
|
- ubl.reset();
|
1270
|
|
- }
|
|
1266
|
+ if (!validating) {
|
|
1267
|
+ if (!ubl.sanity_check()) {
|
|
1268
|
+ SERIAL_EOL();
|
|
1269
|
+ #if ENABLED(EEPROM_CHITCHAT)
|
|
1270
|
+ ubl.echo_name();
|
|
1271
|
+ SERIAL_ECHOLNPGM(" initialized.\n");
|
|
1272
|
+ #endif
|
|
1273
|
+ }
|
|
1274
|
+ else {
|
|
1275
|
+ eeprom_error = true;
|
|
1276
|
+ #if ENABLED(EEPROM_CHITCHAT)
|
|
1277
|
+ SERIAL_PROTOCOLPGM("?Can't enable ");
|
|
1278
|
+ ubl.echo_name();
|
|
1279
|
+ SERIAL_PROTOCOLLNPGM(".");
|
|
1280
|
+ #endif
|
|
1281
|
+ ubl.reset();
|
|
1282
|
+ }
|
1271
|
1283
|
|
1272
|
|
- if (ubl.storage_slot >= 0) {
|
1273
|
|
- load_mesh(ubl.storage_slot);
|
1274
|
|
- #if ENABLED(EEPROM_CHITCHAT)
|
1275
|
|
- SERIAL_ECHOPAIR("Mesh ", ubl.storage_slot);
|
1276
|
|
- SERIAL_ECHOLNPGM(" loaded from storage.");
|
1277
|
|
- #endif
|
1278
|
|
- }
|
1279
|
|
- else {
|
1280
|
|
- ubl.reset();
|
1281
|
|
- #if ENABLED(EEPROM_CHITCHAT)
|
1282
|
|
- SERIAL_ECHOLNPGM("UBL System reset()");
|
1283
|
|
- #endif
|
|
1284
|
+ if (ubl.storage_slot >= 0) {
|
|
1285
|
+ load_mesh(ubl.storage_slot);
|
|
1286
|
+ #if ENABLED(EEPROM_CHITCHAT)
|
|
1287
|
+ SERIAL_ECHOPAIR("Mesh ", ubl.storage_slot);
|
|
1288
|
+ SERIAL_ECHOLNPGM(" loaded from storage.");
|
|
1289
|
+ #endif
|
|
1290
|
+ }
|
|
1291
|
+ else {
|
|
1292
|
+ ubl.reset();
|
|
1293
|
+ #if ENABLED(EEPROM_CHITCHAT)
|
|
1294
|
+ SERIAL_ECHOLNPGM("UBL System reset()");
|
|
1295
|
+ #endif
|
|
1296
|
+ }
|
1284
|
1297
|
}
|
1285
|
1298
|
#endif
|
1286
|
1299
|
}
|
1287
|
1300
|
|
1288
|
1301
|
#if ENABLED(EEPROM_CHITCHAT) && DISABLED(DISABLE_M503)
|
1289
|
|
- report();
|
|
1302
|
+ if (!validating) report();
|
1290
|
1303
|
#endif
|
1291
|
1304
|
EEPROM_FINISH();
|
1292
|
1305
|
|
1293
|
1306
|
return !eeprom_error;
|
1294
|
1307
|
}
|
1295
|
1308
|
|
|
1309
|
+ bool MarlinSettings::validate() {
|
|
1310
|
+ validating = true;
|
|
1311
|
+ const bool success = _load();
|
|
1312
|
+ validating = false;
|
|
1313
|
+ return success;
|
|
1314
|
+ }
|
|
1315
|
+
|
|
1316
|
+ bool MarlinSettings::load() {
|
|
1317
|
+ if (validate()) return _load();
|
|
1318
|
+ reset();
|
|
1319
|
+ return true;
|
|
1320
|
+ }
|
|
1321
|
+
|
1296
|
1322
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
1297
|
1323
|
|
1298
|
1324
|
#if ENABLED(EEPROM_CHITCHAT)
|