|
@@ -191,8 +191,10 @@ void Config_Postprocess() {
|
191
|
191
|
#if ENABLED(EEPROM_SETTINGS)
|
192
|
192
|
|
193
|
193
|
#define DUMMY_PID_VALUE 3000.0f
|
194
|
|
- #define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value))
|
195
|
|
- #define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value))
|
|
194
|
+ #define EEPROM_START() int eeprom_index = EEPROM_OFFSET
|
|
195
|
+ #define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR)
|
|
196
|
+ #define EEPROM_WRITE(VAR) _EEPROM_writeData(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
|
|
197
|
+ #define EEPROM_READ(VAR) _EEPROM_readData(eeprom_index, (uint8_t*)&VAR, sizeof(VAR))
|
196
|
198
|
|
197
|
199
|
/**
|
198
|
200
|
* M500 - Store Configuration
|
|
@@ -200,26 +202,27 @@ void Config_Postprocess() {
|
200
|
202
|
void Config_StoreSettings() {
|
201
|
203
|
float dummy = 0.0f;
|
202
|
204
|
char ver[4] = "000";
|
203
|
|
- int i = EEPROM_OFFSET;
|
204
|
205
|
|
205
|
|
- EEPROM_WRITE_VAR(i, ver); // invalidate data first
|
206
|
|
- i += sizeof(eeprom_checksum); // Skip the checksum slot
|
|
206
|
+ EEPROM_START();
|
|
207
|
+
|
|
208
|
+ EEPROM_WRITE(ver); // invalidate data first
|
|
209
|
+ EEPROM_SKIP(eeprom_checksum); // Skip the checksum slot
|
207
|
210
|
|
208
|
211
|
eeprom_checksum = 0; // clear before first "real data"
|
209
|
212
|
|
210
|
|
- EEPROM_WRITE_VAR(i, planner.axis_steps_per_mm);
|
211
|
|
- EEPROM_WRITE_VAR(i, planner.max_feedrate_mm_s);
|
212
|
|
- EEPROM_WRITE_VAR(i, planner.max_acceleration_mm_per_s2);
|
213
|
|
- EEPROM_WRITE_VAR(i, planner.acceleration);
|
214
|
|
- EEPROM_WRITE_VAR(i, planner.retract_acceleration);
|
215
|
|
- EEPROM_WRITE_VAR(i, planner.travel_acceleration);
|
216
|
|
- EEPROM_WRITE_VAR(i, planner.min_feedrate_mm_s);
|
217
|
|
- EEPROM_WRITE_VAR(i, planner.min_travel_feedrate_mm_s);
|
218
|
|
- EEPROM_WRITE_VAR(i, planner.min_segment_time);
|
219
|
|
- EEPROM_WRITE_VAR(i, planner.max_xy_jerk);
|
220
|
|
- EEPROM_WRITE_VAR(i, planner.max_z_jerk);
|
221
|
|
- EEPROM_WRITE_VAR(i, planner.max_e_jerk);
|
222
|
|
- EEPROM_WRITE_VAR(i, home_offset);
|
|
213
|
+ EEPROM_WRITE(planner.axis_steps_per_mm);
|
|
214
|
+ EEPROM_WRITE(planner.max_feedrate_mm_s);
|
|
215
|
+ EEPROM_WRITE(planner.max_acceleration_mm_per_s2);
|
|
216
|
+ EEPROM_WRITE(planner.acceleration);
|
|
217
|
+ EEPROM_WRITE(planner.retract_acceleration);
|
|
218
|
+ EEPROM_WRITE(planner.travel_acceleration);
|
|
219
|
+ EEPROM_WRITE(planner.min_feedrate_mm_s);
|
|
220
|
+ EEPROM_WRITE(planner.min_travel_feedrate_mm_s);
|
|
221
|
+ EEPROM_WRITE(planner.min_segment_time);
|
|
222
|
+ EEPROM_WRITE(planner.max_xy_jerk);
|
|
223
|
+ EEPROM_WRITE(planner.max_z_jerk);
|
|
224
|
+ EEPROM_WRITE(planner.max_e_jerk);
|
|
225
|
+ EEPROM_WRITE(home_offset);
|
223
|
226
|
|
224
|
227
|
#if ENABLED(MESH_BED_LEVELING)
|
225
|
228
|
// Compile time test that sizeof(mbl.z_values) is as expected
|
|
@@ -227,45 +230,45 @@ void Config_StoreSettings() {
|
227
|
230
|
uint8_t mesh_num_x = MESH_NUM_X_POINTS,
|
228
|
231
|
mesh_num_y = MESH_NUM_Y_POINTS,
|
229
|
232
|
dummy_uint8 = mbl.status & _BV(MBL_STATUS_HAS_MESH_BIT);
|
230
|
|
- EEPROM_WRITE_VAR(i, dummy_uint8);
|
231
|
|
- EEPROM_WRITE_VAR(i, mbl.z_offset);
|
232
|
|
- EEPROM_WRITE_VAR(i, mesh_num_x);
|
233
|
|
- EEPROM_WRITE_VAR(i, mesh_num_y);
|
234
|
|
- EEPROM_WRITE_VAR(i, mbl.z_values);
|
|
233
|
+ EEPROM_WRITE(dummy_uint8);
|
|
234
|
+ EEPROM_WRITE(mbl.z_offset);
|
|
235
|
+ EEPROM_WRITE(mesh_num_x);
|
|
236
|
+ EEPROM_WRITE(mesh_num_y);
|
|
237
|
+ EEPROM_WRITE(mbl.z_values);
|
235
|
238
|
#else
|
236
|
239
|
// For disabled MBL write a default mesh
|
237
|
240
|
uint8_t mesh_num_x = 3,
|
238
|
241
|
mesh_num_y = 3,
|
239
|
242
|
dummy_uint8 = 0;
|
240
|
243
|
dummy = 0.0f;
|
241
|
|
- EEPROM_WRITE_VAR(i, dummy_uint8);
|
242
|
|
- EEPROM_WRITE_VAR(i, dummy);
|
243
|
|
- EEPROM_WRITE_VAR(i, mesh_num_x);
|
244
|
|
- EEPROM_WRITE_VAR(i, mesh_num_y);
|
245
|
|
- for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_WRITE_VAR(i, dummy);
|
|
244
|
+ EEPROM_WRITE(dummy_uint8);
|
|
245
|
+ EEPROM_WRITE(dummy);
|
|
246
|
+ EEPROM_WRITE(mesh_num_x);
|
|
247
|
+ EEPROM_WRITE(mesh_num_y);
|
|
248
|
+ for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_WRITE(dummy);
|
246
|
249
|
#endif // MESH_BED_LEVELING
|
247
|
250
|
|
248
|
251
|
#if !HAS_BED_PROBE
|
249
|
252
|
float zprobe_zoffset = 0;
|
250
|
253
|
#endif
|
251
|
|
- EEPROM_WRITE_VAR(i, zprobe_zoffset);
|
|
254
|
+ EEPROM_WRITE(zprobe_zoffset);
|
252
|
255
|
|
253
|
256
|
// 9 floats for DELTA / Z_DUAL_ENDSTOPS
|
254
|
257
|
#if ENABLED(DELTA)
|
255
|
|
- EEPROM_WRITE_VAR(i, endstop_adj); // 3 floats
|
256
|
|
- EEPROM_WRITE_VAR(i, delta_radius); // 1 float
|
257
|
|
- EEPROM_WRITE_VAR(i, delta_diagonal_rod); // 1 float
|
258
|
|
- EEPROM_WRITE_VAR(i, delta_segments_per_second); // 1 float
|
259
|
|
- EEPROM_WRITE_VAR(i, delta_diagonal_rod_trim_tower_1); // 1 float
|
260
|
|
- EEPROM_WRITE_VAR(i, delta_diagonal_rod_trim_tower_2); // 1 float
|
261
|
|
- EEPROM_WRITE_VAR(i, delta_diagonal_rod_trim_tower_3); // 1 float
|
|
258
|
+ EEPROM_WRITE(endstop_adj); // 3 floats
|
|
259
|
+ EEPROM_WRITE(delta_radius); // 1 float
|
|
260
|
+ EEPROM_WRITE(delta_diagonal_rod); // 1 float
|
|
261
|
+ EEPROM_WRITE(delta_segments_per_second); // 1 float
|
|
262
|
+ EEPROM_WRITE(delta_diagonal_rod_trim_tower_1); // 1 float
|
|
263
|
+ EEPROM_WRITE(delta_diagonal_rod_trim_tower_2); // 1 float
|
|
264
|
+ EEPROM_WRITE(delta_diagonal_rod_trim_tower_3); // 1 float
|
262
|
265
|
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
263
|
|
- EEPROM_WRITE_VAR(i, z_endstop_adj); // 1 float
|
|
266
|
+ EEPROM_WRITE(z_endstop_adj); // 1 float
|
264
|
267
|
dummy = 0.0f;
|
265
|
|
- for (uint8_t q = 8; q--;) EEPROM_WRITE_VAR(i, dummy);
|
|
268
|
+ for (uint8_t q = 8; q--;) EEPROM_WRITE(dummy);
|
266
|
269
|
#else
|
267
|
270
|
dummy = 0.0f;
|
268
|
|
- for (uint8_t q = 9; q--;) EEPROM_WRITE_VAR(i, dummy);
|
|
271
|
+ for (uint8_t q = 9; q--;) EEPROM_WRITE(dummy);
|
269
|
272
|
#endif
|
270
|
273
|
|
271
|
274
|
#if DISABLED(ULTIPANEL)
|
|
@@ -273,34 +276,34 @@ void Config_StoreSettings() {
|
273
|
276
|
preheatHotendTemp2 = PREHEAT_2_TEMP_HOTEND, preheatBedTemp2 = PREHEAT_2_TEMP_BED, preheatFanSpeed2 = PREHEAT_2_FAN_SPEED;
|
274
|
277
|
#endif // !ULTIPANEL
|
275
|
278
|
|
276
|
|
- EEPROM_WRITE_VAR(i, preheatHotendTemp1);
|
277
|
|
- EEPROM_WRITE_VAR(i, preheatBedTemp1);
|
278
|
|
- EEPROM_WRITE_VAR(i, preheatFanSpeed1);
|
279
|
|
- EEPROM_WRITE_VAR(i, preheatHotendTemp2);
|
280
|
|
- EEPROM_WRITE_VAR(i, preheatBedTemp2);
|
281
|
|
- EEPROM_WRITE_VAR(i, preheatFanSpeed2);
|
|
279
|
+ EEPROM_WRITE(preheatHotendTemp1);
|
|
280
|
+ EEPROM_WRITE(preheatBedTemp1);
|
|
281
|
+ EEPROM_WRITE(preheatFanSpeed1);
|
|
282
|
+ EEPROM_WRITE(preheatHotendTemp2);
|
|
283
|
+ EEPROM_WRITE(preheatBedTemp2);
|
|
284
|
+ EEPROM_WRITE(preheatFanSpeed2);
|
282
|
285
|
|
283
|
286
|
for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
|
284
|
287
|
|
285
|
288
|
#if ENABLED(PIDTEMP)
|
286
|
289
|
if (e < HOTENDS) {
|
287
|
|
- EEPROM_WRITE_VAR(i, PID_PARAM(Kp, e));
|
288
|
|
- EEPROM_WRITE_VAR(i, PID_PARAM(Ki, e));
|
289
|
|
- EEPROM_WRITE_VAR(i, PID_PARAM(Kd, e));
|
|
290
|
+ EEPROM_WRITE(PID_PARAM(Kp, e));
|
|
291
|
+ EEPROM_WRITE(PID_PARAM(Ki, e));
|
|
292
|
+ EEPROM_WRITE(PID_PARAM(Kd, e));
|
290
|
293
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
291
|
|
- EEPROM_WRITE_VAR(i, PID_PARAM(Kc, e));
|
|
294
|
+ EEPROM_WRITE(PID_PARAM(Kc, e));
|
292
|
295
|
#else
|
293
|
296
|
dummy = 1.0f; // 1.0 = default kc
|
294
|
|
- EEPROM_WRITE_VAR(i, dummy);
|
|
297
|
+ EEPROM_WRITE(dummy);
|
295
|
298
|
#endif
|
296
|
299
|
}
|
297
|
300
|
else
|
298
|
301
|
#endif // !PIDTEMP
|
299
|
302
|
{
|
300
|
303
|
dummy = DUMMY_PID_VALUE; // When read, will not change the existing value
|
301
|
|
- EEPROM_WRITE_VAR(i, dummy); // Kp
|
|
304
|
+ EEPROM_WRITE(dummy); // Kp
|
302
|
305
|
dummy = 0.0f;
|
303
|
|
- for (uint8_t q = 3; q--;) EEPROM_WRITE_VAR(i, dummy); // Ki, Kd, Kc
|
|
306
|
+ for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); // Ki, Kd, Kc
|
304
|
307
|
}
|
305
|
308
|
|
306
|
309
|
} // Hotends Loop
|
|
@@ -308,67 +311,68 @@ void Config_StoreSettings() {
|
308
|
311
|
#if DISABLED(PID_ADD_EXTRUSION_RATE)
|
309
|
312
|
int lpq_len = 20;
|
310
|
313
|
#endif
|
311
|
|
- EEPROM_WRITE_VAR(i, lpq_len);
|
|
314
|
+ EEPROM_WRITE(lpq_len);
|
312
|
315
|
|
313
|
316
|
#if DISABLED(PIDTEMPBED)
|
314
|
317
|
dummy = DUMMY_PID_VALUE;
|
315
|
|
- for (uint8_t q = 3; q--;) EEPROM_WRITE_VAR(i, dummy);
|
|
318
|
+ for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
|
316
|
319
|
#else
|
317
|
|
- EEPROM_WRITE_VAR(i, thermalManager.bedKp);
|
318
|
|
- EEPROM_WRITE_VAR(i, thermalManager.bedKi);
|
319
|
|
- EEPROM_WRITE_VAR(i, thermalManager.bedKd);
|
|
320
|
+ EEPROM_WRITE(thermalManager.bedKp);
|
|
321
|
+ EEPROM_WRITE(thermalManager.bedKi);
|
|
322
|
+ EEPROM_WRITE(thermalManager.bedKd);
|
320
|
323
|
#endif
|
321
|
324
|
|
322
|
325
|
#if !HAS_LCD_CONTRAST
|
323
|
326
|
const int lcd_contrast = 32;
|
324
|
327
|
#endif
|
325
|
|
- EEPROM_WRITE_VAR(i, lcd_contrast);
|
|
328
|
+ EEPROM_WRITE(lcd_contrast);
|
326
|
329
|
|
327
|
330
|
#if ENABLED(SCARA)
|
328
|
|
- EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats
|
|
331
|
+ EEPROM_WRITE(axis_scaling); // 3 floats
|
329
|
332
|
#else
|
330
|
333
|
dummy = 1.0f;
|
331
|
|
- EEPROM_WRITE_VAR(i, dummy);
|
|
334
|
+ EEPROM_WRITE(dummy);
|
332
|
335
|
#endif
|
333
|
336
|
|
334
|
337
|
#if ENABLED(FWRETRACT)
|
335
|
|
- EEPROM_WRITE_VAR(i, autoretract_enabled);
|
336
|
|
- EEPROM_WRITE_VAR(i, retract_length);
|
|
338
|
+ EEPROM_WRITE(autoretract_enabled);
|
|
339
|
+ EEPROM_WRITE(retract_length);
|
337
|
340
|
#if EXTRUDERS > 1
|
338
|
|
- EEPROM_WRITE_VAR(i, retract_length_swap);
|
|
341
|
+ EEPROM_WRITE(retract_length_swap);
|
339
|
342
|
#else
|
340
|
343
|
dummy = 0.0f;
|
341
|
|
- EEPROM_WRITE_VAR(i, dummy);
|
|
344
|
+ EEPROM_WRITE(dummy);
|
342
|
345
|
#endif
|
343
|
|
- EEPROM_WRITE_VAR(i, retract_feedrate_mm_s);
|
344
|
|
- EEPROM_WRITE_VAR(i, retract_zlift);
|
345
|
|
- EEPROM_WRITE_VAR(i, retract_recover_length);
|
|
346
|
+ EEPROM_WRITE(retract_feedrate_mm_s);
|
|
347
|
+ EEPROM_WRITE(retract_zlift);
|
|
348
|
+ EEPROM_WRITE(retract_recover_length);
|
346
|
349
|
#if EXTRUDERS > 1
|
347
|
|
- EEPROM_WRITE_VAR(i, retract_recover_length_swap);
|
|
350
|
+ EEPROM_WRITE(retract_recover_length_swap);
|
348
|
351
|
#else
|
349
|
352
|
dummy = 0.0f;
|
350
|
|
- EEPROM_WRITE_VAR(i, dummy);
|
|
353
|
+ EEPROM_WRITE(dummy);
|
351
|
354
|
#endif
|
352
|
|
- EEPROM_WRITE_VAR(i, retract_recover_feedrate_mm_s);
|
|
355
|
+ EEPROM_WRITE(retract_recover_feedrate_mm_s);
|
353
|
356
|
#endif // FWRETRACT
|
354
|
357
|
|
355
|
|
- EEPROM_WRITE_VAR(i, volumetric_enabled);
|
|
358
|
+ EEPROM_WRITE(volumetric_enabled);
|
356
|
359
|
|
357
|
360
|
// Save filament sizes
|
358
|
361
|
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
359
|
362
|
if (q < COUNT(filament_size)) dummy = filament_size[q];
|
360
|
|
- EEPROM_WRITE_VAR(i, dummy);
|
|
363
|
+ EEPROM_WRITE(dummy);
|
361
|
364
|
}
|
362
|
365
|
|
363
|
|
- uint16_t final_checksum = eeprom_checksum;
|
|
366
|
+ uint16_t final_checksum = eeprom_checksum,
|
|
367
|
+ eeprom_size = eeprom_index;
|
364
|
368
|
|
365
|
|
- int j = EEPROM_OFFSET;
|
366
|
|
- EEPROM_WRITE_VAR(j, version);
|
367
|
|
- EEPROM_WRITE_VAR(j, final_checksum);
|
|
369
|
+ eeprom_index = EEPROM_OFFSET;
|
|
370
|
+ EEPROM_WRITE(version);
|
|
371
|
+ EEPROM_WRITE(final_checksum);
|
368
|
372
|
|
369
|
373
|
// Report storage size
|
370
|
374
|
SERIAL_ECHO_START;
|
371
|
|
- SERIAL_ECHOPAIR("Settings Stored (", i);
|
|
375
|
+ SERIAL_ECHOPAIR("Settings Stored (", eeprom_size);
|
372
|
376
|
SERIAL_ECHOLNPGM(" bytes)");
|
373
|
377
|
}
|
374
|
378
|
|
|
@@ -376,11 +380,15 @@ void Config_StoreSettings() {
|
376
|
380
|
* M501 - Retrieve Configuration
|
377
|
381
|
*/
|
378
|
382
|
void Config_RetrieveSettings() {
|
379
|
|
- int i = EEPROM_OFFSET;
|
|
383
|
+
|
|
384
|
+ EEPROM_START();
|
|
385
|
+
|
380
|
386
|
char stored_ver[4];
|
|
387
|
+ EEPROM_READ(stored_ver);
|
|
388
|
+
|
381
|
389
|
uint16_t stored_checksum;
|
382
|
|
- EEPROM_READ_VAR(i, stored_ver);
|
383
|
|
- EEPROM_READ_VAR(i, stored_checksum);
|
|
390
|
+ EEPROM_READ(stored_checksum);
|
|
391
|
+
|
384
|
392
|
// SERIAL_ECHOPAIR("Version: [", ver);
|
385
|
393
|
// SERIAL_ECHOPAIR("] Stored version: [", stored_ver);
|
386
|
394
|
// SERIAL_ECHOLNPGM("]");
|
|
@@ -394,63 +402,63 @@ void Config_RetrieveSettings() {
|
394
|
402
|
eeprom_checksum = 0; // clear before reading first "real data"
|
395
|
403
|
|
396
|
404
|
// version number match
|
397
|
|
- EEPROM_READ_VAR(i, planner.axis_steps_per_mm);
|
398
|
|
- EEPROM_READ_VAR(i, planner.max_feedrate_mm_s);
|
399
|
|
- EEPROM_READ_VAR(i, planner.max_acceleration_mm_per_s2);
|
400
|
|
-
|
401
|
|
- EEPROM_READ_VAR(i, planner.acceleration);
|
402
|
|
- EEPROM_READ_VAR(i, planner.retract_acceleration);
|
403
|
|
- EEPROM_READ_VAR(i, planner.travel_acceleration);
|
404
|
|
- EEPROM_READ_VAR(i, planner.min_feedrate_mm_s);
|
405
|
|
- EEPROM_READ_VAR(i, planner.min_travel_feedrate_mm_s);
|
406
|
|
- EEPROM_READ_VAR(i, planner.min_segment_time);
|
407
|
|
- EEPROM_READ_VAR(i, planner.max_xy_jerk);
|
408
|
|
- EEPROM_READ_VAR(i, planner.max_z_jerk);
|
409
|
|
- EEPROM_READ_VAR(i, planner.max_e_jerk);
|
410
|
|
- EEPROM_READ_VAR(i, home_offset);
|
|
405
|
+ EEPROM_READ(planner.axis_steps_per_mm);
|
|
406
|
+ EEPROM_READ(planner.max_feedrate_mm_s);
|
|
407
|
+ EEPROM_READ(planner.max_acceleration_mm_per_s2);
|
|
408
|
+
|
|
409
|
+ EEPROM_READ(planner.acceleration);
|
|
410
|
+ EEPROM_READ(planner.retract_acceleration);
|
|
411
|
+ EEPROM_READ(planner.travel_acceleration);
|
|
412
|
+ EEPROM_READ(planner.min_feedrate_mm_s);
|
|
413
|
+ EEPROM_READ(planner.min_travel_feedrate_mm_s);
|
|
414
|
+ EEPROM_READ(planner.min_segment_time);
|
|
415
|
+ EEPROM_READ(planner.max_xy_jerk);
|
|
416
|
+ EEPROM_READ(planner.max_z_jerk);
|
|
417
|
+ EEPROM_READ(planner.max_e_jerk);
|
|
418
|
+ EEPROM_READ(home_offset);
|
411
|
419
|
|
412
|
420
|
uint8_t dummy_uint8 = 0, mesh_num_x = 0, mesh_num_y = 0;
|
413
|
|
- EEPROM_READ_VAR(i, dummy_uint8);
|
414
|
|
- EEPROM_READ_VAR(i, dummy);
|
415
|
|
- EEPROM_READ_VAR(i, mesh_num_x);
|
416
|
|
- EEPROM_READ_VAR(i, mesh_num_y);
|
|
421
|
+ EEPROM_READ(dummy_uint8);
|
|
422
|
+ EEPROM_READ(dummy);
|
|
423
|
+ EEPROM_READ(mesh_num_x);
|
|
424
|
+ EEPROM_READ(mesh_num_y);
|
417
|
425
|
#if ENABLED(MESH_BED_LEVELING)
|
418
|
426
|
mbl.status = dummy_uint8;
|
419
|
427
|
mbl.z_offset = dummy;
|
420
|
428
|
if (mesh_num_x == MESH_NUM_X_POINTS && mesh_num_y == MESH_NUM_Y_POINTS) {
|
421
|
429
|
// EEPROM data fits the current mesh
|
422
|
|
- EEPROM_READ_VAR(i, mbl.z_values);
|
|
430
|
+ EEPROM_READ(mbl.z_values);
|
423
|
431
|
}
|
424
|
432
|
else {
|
425
|
433
|
// EEPROM data is stale
|
426
|
434
|
mbl.reset();
|
427
|
|
- for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_READ_VAR(i, dummy);
|
|
435
|
+ for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_READ(dummy);
|
428
|
436
|
}
|
429
|
437
|
#else
|
430
|
438
|
// MBL is disabled - skip the stored data
|
431
|
|
- for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_READ_VAR(i, dummy);
|
|
439
|
+ for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_READ(dummy);
|
432
|
440
|
#endif // MESH_BED_LEVELING
|
433
|
441
|
|
434
|
442
|
#if !HAS_BED_PROBE
|
435
|
443
|
float zprobe_zoffset = 0;
|
436
|
444
|
#endif
|
437
|
|
- EEPROM_READ_VAR(i, zprobe_zoffset);
|
|
445
|
+ EEPROM_READ(zprobe_zoffset);
|
438
|
446
|
|
439
|
447
|
#if ENABLED(DELTA)
|
440
|
|
- EEPROM_READ_VAR(i, endstop_adj); // 3 floats
|
441
|
|
- EEPROM_READ_VAR(i, delta_radius); // 1 float
|
442
|
|
- EEPROM_READ_VAR(i, delta_diagonal_rod); // 1 float
|
443
|
|
- EEPROM_READ_VAR(i, delta_segments_per_second); // 1 float
|
444
|
|
- EEPROM_READ_VAR(i, delta_diagonal_rod_trim_tower_1); // 1 float
|
445
|
|
- EEPROM_READ_VAR(i, delta_diagonal_rod_trim_tower_2); // 1 float
|
446
|
|
- EEPROM_READ_VAR(i, delta_diagonal_rod_trim_tower_3); // 1 float
|
|
448
|
+ EEPROM_READ(endstop_adj); // 3 floats
|
|
449
|
+ EEPROM_READ(delta_radius); // 1 float
|
|
450
|
+ EEPROM_READ(delta_diagonal_rod); // 1 float
|
|
451
|
+ EEPROM_READ(delta_segments_per_second); // 1 float
|
|
452
|
+ EEPROM_READ(delta_diagonal_rod_trim_tower_1); // 1 float
|
|
453
|
+ EEPROM_READ(delta_diagonal_rod_trim_tower_2); // 1 float
|
|
454
|
+ EEPROM_READ(delta_diagonal_rod_trim_tower_3); // 1 float
|
447
|
455
|
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
448
|
|
- EEPROM_READ_VAR(i, z_endstop_adj);
|
|
456
|
+ EEPROM_READ(z_endstop_adj);
|
449
|
457
|
dummy = 0.0f;
|
450
|
|
- for (uint8_t q=8; q--;) EEPROM_READ_VAR(i, dummy);
|
|
458
|
+ for (uint8_t q=8; q--;) EEPROM_READ(dummy);
|
451
|
459
|
#else
|
452
|
460
|
dummy = 0.0f;
|
453
|
|
- for (uint8_t q=9; q--;) EEPROM_READ_VAR(i, dummy);
|
|
461
|
+ for (uint8_t q=9; q--;) EEPROM_READ(dummy);
|
454
|
462
|
#endif
|
455
|
463
|
|
456
|
464
|
#if DISABLED(ULTIPANEL)
|
|
@@ -458,86 +466,86 @@ void Config_RetrieveSettings() {
|
458
|
466
|
preheatHotendTemp2, preheatBedTemp2, preheatFanSpeed2;
|
459
|
467
|
#endif
|
460
|
468
|
|
461
|
|
- EEPROM_READ_VAR(i, preheatHotendTemp1);
|
462
|
|
- EEPROM_READ_VAR(i, preheatBedTemp1);
|
463
|
|
- EEPROM_READ_VAR(i, preheatFanSpeed1);
|
464
|
|
- EEPROM_READ_VAR(i, preheatHotendTemp2);
|
465
|
|
- EEPROM_READ_VAR(i, preheatBedTemp2);
|
466
|
|
- EEPROM_READ_VAR(i, preheatFanSpeed2);
|
|
469
|
+ EEPROM_READ(preheatHotendTemp1);
|
|
470
|
+ EEPROM_READ(preheatBedTemp1);
|
|
471
|
+ EEPROM_READ(preheatFanSpeed1);
|
|
472
|
+ EEPROM_READ(preheatHotendTemp2);
|
|
473
|
+ EEPROM_READ(preheatBedTemp2);
|
|
474
|
+ EEPROM_READ(preheatFanSpeed2);
|
467
|
475
|
|
468
|
476
|
#if ENABLED(PIDTEMP)
|
469
|
477
|
for (uint8_t e = 0; e < MAX_EXTRUDERS; e++) {
|
470
|
|
- EEPROM_READ_VAR(i, dummy); // Kp
|
|
478
|
+ EEPROM_READ(dummy); // Kp
|
471
|
479
|
if (e < HOTENDS && dummy != DUMMY_PID_VALUE) {
|
472
|
480
|
// do not need to scale PID values as the values in EEPROM are already scaled
|
473
|
481
|
PID_PARAM(Kp, e) = dummy;
|
474
|
|
- EEPROM_READ_VAR(i, PID_PARAM(Ki, e));
|
475
|
|
- EEPROM_READ_VAR(i, PID_PARAM(Kd, e));
|
|
482
|
+ EEPROM_READ(PID_PARAM(Ki, e));
|
|
483
|
+ EEPROM_READ(PID_PARAM(Kd, e));
|
476
|
484
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
477
|
|
- EEPROM_READ_VAR(i, PID_PARAM(Kc, e));
|
|
485
|
+ EEPROM_READ(PID_PARAM(Kc, e));
|
478
|
486
|
#else
|
479
|
|
- EEPROM_READ_VAR(i, dummy);
|
|
487
|
+ EEPROM_READ(dummy);
|
480
|
488
|
#endif
|
481
|
489
|
}
|
482
|
490
|
else {
|
483
|
|
- for (uint8_t q=3; q--;) EEPROM_READ_VAR(i, dummy); // Ki, Kd, Kc
|
|
491
|
+ for (uint8_t q=3; q--;) EEPROM_READ(dummy); // Ki, Kd, Kc
|
484
|
492
|
}
|
485
|
493
|
}
|
486
|
494
|
#else // !PIDTEMP
|
487
|
495
|
// 4 x 4 = 16 slots for PID parameters
|
488
|
|
- for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ_VAR(i, dummy); // Kp, Ki, Kd, Kc
|
|
496
|
+ for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ(dummy); // Kp, Ki, Kd, Kc
|
489
|
497
|
#endif // !PIDTEMP
|
490
|
498
|
|
491
|
499
|
#if DISABLED(PID_ADD_EXTRUSION_RATE)
|
492
|
500
|
int lpq_len;
|
493
|
501
|
#endif
|
494
|
|
- EEPROM_READ_VAR(i, lpq_len);
|
|
502
|
+ EEPROM_READ(lpq_len);
|
495
|
503
|
|
496
|
504
|
#if ENABLED(PIDTEMPBED)
|
497
|
|
- EEPROM_READ_VAR(i, dummy); // bedKp
|
|
505
|
+ EEPROM_READ(dummy); // bedKp
|
498
|
506
|
if (dummy != DUMMY_PID_VALUE) {
|
499
|
507
|
thermalManager.bedKp = dummy;
|
500
|
|
- EEPROM_READ_VAR(i, thermalManager.bedKi);
|
501
|
|
- EEPROM_READ_VAR(i, thermalManager.bedKd);
|
|
508
|
+ EEPROM_READ(thermalManager.bedKi);
|
|
509
|
+ EEPROM_READ(thermalManager.bedKd);
|
502
|
510
|
}
|
503
|
511
|
#else
|
504
|
|
- for (uint8_t q=3; q--;) EEPROM_READ_VAR(i, dummy); // bedKp, bedKi, bedKd
|
|
512
|
+ for (uint8_t q=3; q--;) EEPROM_READ(dummy); // bedKp, bedKi, bedKd
|
505
|
513
|
#endif
|
506
|
514
|
|
507
|
515
|
#if !HAS_LCD_CONTRAST
|
508
|
516
|
int lcd_contrast;
|
509
|
517
|
#endif
|
510
|
|
- EEPROM_READ_VAR(i, lcd_contrast);
|
|
518
|
+ EEPROM_READ(lcd_contrast);
|
511
|
519
|
|
512
|
520
|
#if ENABLED(SCARA)
|
513
|
|
- EEPROM_READ_VAR(i, axis_scaling); // 3 floats
|
|
521
|
+ EEPROM_READ(axis_scaling); // 3 floats
|
514
|
522
|
#else
|
515
|
|
- EEPROM_READ_VAR(i, dummy);
|
|
523
|
+ EEPROM_READ(dummy);
|
516
|
524
|
#endif
|
517
|
525
|
|
518
|
526
|
#if ENABLED(FWRETRACT)
|
519
|
|
- EEPROM_READ_VAR(i, autoretract_enabled);
|
520
|
|
- EEPROM_READ_VAR(i, retract_length);
|
|
527
|
+ EEPROM_READ(autoretract_enabled);
|
|
528
|
+ EEPROM_READ(retract_length);
|
521
|
529
|
#if EXTRUDERS > 1
|
522
|
|
- EEPROM_READ_VAR(i, retract_length_swap);
|
|
530
|
+ EEPROM_READ(retract_length_swap);
|
523
|
531
|
#else
|
524
|
|
- EEPROM_READ_VAR(i, dummy);
|
|
532
|
+ EEPROM_READ(dummy);
|
525
|
533
|
#endif
|
526
|
|
- EEPROM_READ_VAR(i, retract_feedrate_mm_s);
|
527
|
|
- EEPROM_READ_VAR(i, retract_zlift);
|
528
|
|
- EEPROM_READ_VAR(i, retract_recover_length);
|
|
534
|
+ EEPROM_READ(retract_feedrate_mm_s);
|
|
535
|
+ EEPROM_READ(retract_zlift);
|
|
536
|
+ EEPROM_READ(retract_recover_length);
|
529
|
537
|
#if EXTRUDERS > 1
|
530
|
|
- EEPROM_READ_VAR(i, retract_recover_length_swap);
|
|
538
|
+ EEPROM_READ(retract_recover_length_swap);
|
531
|
539
|
#else
|
532
|
|
- EEPROM_READ_VAR(i, dummy);
|
|
540
|
+ EEPROM_READ(dummy);
|
533
|
541
|
#endif
|
534
|
|
- EEPROM_READ_VAR(i, retract_recover_feedrate_mm_s);
|
|
542
|
+ EEPROM_READ(retract_recover_feedrate_mm_s);
|
535
|
543
|
#endif // FWRETRACT
|
536
|
544
|
|
537
|
|
- EEPROM_READ_VAR(i, volumetric_enabled);
|
|
545
|
+ EEPROM_READ(volumetric_enabled);
|
538
|
546
|
|
539
|
547
|
for (uint8_t q = 0; q < MAX_EXTRUDERS; q++) {
|
540
|
|
- EEPROM_READ_VAR(i, dummy);
|
|
548
|
+ EEPROM_READ(dummy);
|
541
|
549
|
if (q < COUNT(filament_size)) filament_size[q] = dummy;
|
542
|
550
|
}
|
543
|
551
|
|
|
@@ -545,7 +553,7 @@ void Config_RetrieveSettings() {
|
545
|
553
|
Config_Postprocess();
|
546
|
554
|
SERIAL_ECHO_START;
|
547
|
555
|
SERIAL_ECHO(version);
|
548
|
|
- SERIAL_ECHOPAIR(" stored settings retrieved (", i);
|
|
556
|
+ SERIAL_ECHOPAIR(" stored settings retrieved (", eeprom_index);
|
549
|
557
|
SERIAL_ECHOLNPGM(" bytes)");
|
550
|
558
|
}
|
551
|
559
|
else {
|