|
@@ -38,7 +38,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
|
38
|
38
|
// wrong data being written to the variables.
|
39
|
39
|
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
|
40
|
40
|
|
41
|
|
-#define EEPROM_VERSION "V13"
|
|
41
|
+#define EEPROM_VERSION "V14"
|
42
|
42
|
|
43
|
43
|
#ifdef EEPROM_SETTINGS
|
44
|
44
|
void Config_StoreSettings()
|
|
@@ -63,11 +63,11 @@ void Config_StoreSettings()
|
63
|
63
|
EEPROM_WRITE_VAR(i,delta_radius);
|
64
|
64
|
EEPROM_WRITE_VAR(i,delta_diagonal_rod);
|
65
|
65
|
EEPROM_WRITE_VAR(i,delta_segments_per_second);
|
66
|
|
- #endif
|
|
66
|
+ #endif//DELTA
|
67
|
67
|
#ifndef ULTIPANEL
|
68
|
68
|
int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
|
69
|
69
|
int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
|
70
|
|
- #endif
|
|
70
|
+ #endif//ULTIPANEL
|
71
|
71
|
EEPROM_WRITE_VAR(i,plaPreheatHotendTemp);
|
72
|
72
|
EEPROM_WRITE_VAR(i,plaPreheatHPBTemp);
|
73
|
73
|
EEPROM_WRITE_VAR(i,plaPreheatFanSpeed);
|
|
@@ -76,37 +76,58 @@ void Config_StoreSettings()
|
76
|
76
|
EEPROM_WRITE_VAR(i,absPreheatFanSpeed);
|
77
|
77
|
EEPROM_WRITE_VAR(i,zprobe_zoffset);
|
78
|
78
|
#ifdef PIDTEMP
|
79
|
|
- EEPROM_WRITE_VAR(i,Kp);
|
80
|
|
- EEPROM_WRITE_VAR(i,Ki);
|
81
|
|
- EEPROM_WRITE_VAR(i,Kd);
|
82
|
|
- #else
|
|
79
|
+ float dummy = 0.0f;
|
|
80
|
+ for (int e = 0; e < 3; e++)
|
|
81
|
+ {
|
|
82
|
+ if (e < EXTRUDERS)
|
|
83
|
+ {
|
|
84
|
+ EEPROM_WRITE_VAR(i,PID_PARAM(Kp,e));
|
|
85
|
+ EEPROM_WRITE_VAR(i,PID_PARAM(Ki,e));
|
|
86
|
+ EEPROM_WRITE_VAR(i,PID_PARAM(Kd,e));
|
|
87
|
+ #ifdef PID_ADD_EXTRUSION_RATE
|
|
88
|
+ EEPROM_WRITE_VAR(i,PID_PARAM(Kc,e));
|
|
89
|
+ #else//PID_ADD_EXTRUSION_RATE
|
|
90
|
+ dummy = 1.0f; // 1.0 = default kc
|
|
91
|
+ EEPROM_WRITE_VAR(dummmy);
|
|
92
|
+ #endif//PID_ADD_EXTRUSION_RATE
|
|
93
|
+ }
|
|
94
|
+ else
|
|
95
|
+ {
|
|
96
|
+ dummy = 3000.0f;
|
|
97
|
+ EEPROM_WRITE_VAR(i, dummy);
|
|
98
|
+ dummy = 0.0f;
|
|
99
|
+ EEPROM_WRITE_VAR(i,dummy);
|
|
100
|
+ EEPROM_WRITE_VAR(i,dummy);
|
|
101
|
+ }
|
|
102
|
+ }
|
|
103
|
+ #else//PIDTEMP
|
83
|
104
|
float dummy = 3000.0f;
|
84
|
105
|
EEPROM_WRITE_VAR(i,dummy);
|
85
|
106
|
dummy = 0.0f;
|
86
|
107
|
EEPROM_WRITE_VAR(i,dummy);
|
87
|
108
|
EEPROM_WRITE_VAR(i,dummy);
|
88
|
|
- #endif
|
|
109
|
+ #endif//PIDTEMP
|
89
|
110
|
#ifndef DOGLCD
|
90
|
111
|
int lcd_contrast = 32;
|
91
|
|
- #endif
|
|
112
|
+ #endif//DOGLCD
|
92
|
113
|
EEPROM_WRITE_VAR(i,lcd_contrast);
|
93
|
114
|
#ifdef SCARA
|
94
|
115
|
EEPROM_WRITE_VAR(i,axis_scaling); // Add scaling for SCARA
|
95
|
|
- #endif
|
|
116
|
+ #endif//SCARA
|
96
|
117
|
#ifdef FWRETRACT
|
97
|
118
|
EEPROM_WRITE_VAR(i,autoretract_enabled);
|
98
|
119
|
EEPROM_WRITE_VAR(i,retract_length);
|
99
|
120
|
#if EXTRUDERS > 1
|
100
|
121
|
EEPROM_WRITE_VAR(i,retract_length_swap);
|
101
|
|
- #endif
|
|
122
|
+ #endif//EXTRUDERS > 1
|
102
|
123
|
EEPROM_WRITE_VAR(i,retract_feedrate);
|
103
|
124
|
EEPROM_WRITE_VAR(i,retract_zlift);
|
104
|
125
|
EEPROM_WRITE_VAR(i,retract_recover_length);
|
105
|
126
|
#if EXTRUDERS > 1
|
106
|
127
|
EEPROM_WRITE_VAR(i,retract_recover_length_swap);
|
107
|
|
- #endif
|
|
128
|
+ #endif//EXTRUDERS > 1
|
108
|
129
|
EEPROM_WRITE_VAR(i,retract_recover_feedrate);
|
109
|
|
- #endif
|
|
130
|
+ #endif//FWRETRACT
|
110
|
131
|
|
111
|
132
|
// Save filament sizes
|
112
|
133
|
EEPROM_WRITE_VAR(i, volumetric_enabled);
|
|
@@ -115,8 +136,8 @@ void Config_StoreSettings()
|
115
|
136
|
EEPROM_WRITE_VAR(i, filament_size[1]);
|
116
|
137
|
#if EXTRUDERS > 2
|
117
|
138
|
EEPROM_WRITE_VAR(i, filament_size[2]);
|
118
|
|
- #endif
|
119
|
|
- #endif
|
|
139
|
+ #endif//EXTRUDERS > 2
|
|
140
|
+ #endif//EXTRUDERS > 1
|
120
|
141
|
|
121
|
142
|
char ver2[4]=EEPROM_VERSION;
|
122
|
143
|
i=EEPROM_OFFSET;
|
|
@@ -149,7 +170,7 @@ SERIAL_ECHOLNPGM("Scaling factors:");
|
149
|
170
|
SERIAL_ECHOLN("");
|
150
|
171
|
|
151
|
172
|
SERIAL_ECHO_START;
|
152
|
|
-#endif
|
|
173
|
+#endif//SCARA
|
153
|
174
|
SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
|
154
|
175
|
SERIAL_ECHO_START;
|
155
|
176
|
SERIAL_ECHOPAIR(" M203 X", max_feedrate[X_AXIS]);
|
|
@@ -206,16 +227,16 @@ SERIAL_ECHOLNPGM("Scaling factors:");
|
206
|
227
|
SERIAL_ECHOPAIR(" R" ,delta_radius );
|
207
|
228
|
SERIAL_ECHOPAIR(" S" ,delta_segments_per_second );
|
208
|
229
|
SERIAL_ECHOLN("");
|
209
|
|
-#endif
|
|
230
|
+#endif//DELTA
|
210
|
231
|
#ifdef PIDTEMP
|
211
|
232
|
SERIAL_ECHO_START;
|
212
|
233
|
SERIAL_ECHOLNPGM("PID settings:");
|
213
|
|
- SERIAL_ECHO_START;
|
214
|
|
- SERIAL_ECHOPAIR(" M301 P",Kp);
|
215
|
|
- SERIAL_ECHOPAIR(" I" ,unscalePID_i(Ki));
|
216
|
|
- SERIAL_ECHOPAIR(" D" ,unscalePID_d(Kd));
|
|
234
|
+ SERIAL_ECHO_START;
|
|
235
|
+ SERIAL_ECHOPAIR(" M301 P", PID_PARAM(Kp,0)); // for compatibility with hosts, only echos values for E0
|
|
236
|
+ SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0)));
|
|
237
|
+ SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0)));
|
217
|
238
|
SERIAL_ECHOLN("");
|
218
|
|
-#endif
|
|
239
|
+#endif//PIDTEMP
|
219
|
240
|
#ifdef FWRETRACT
|
220
|
241
|
SERIAL_ECHO_START;
|
221
|
242
|
SERIAL_ECHOLNPGM("Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)");
|
|
@@ -244,7 +265,7 @@ SERIAL_ECHOLNPGM("Scaling factors:");
|
244
|
265
|
SERIAL_ECHO_START;
|
245
|
266
|
SERIAL_ECHOPAIR(" Swap rec. addl. length (mm): ", retract_recover_length_swap);
|
246
|
267
|
SERIAL_ECHOLN("");
|
247
|
|
-#endif
|
|
268
|
+#endif//EXTRUDERS > 1
|
248
|
269
|
SERIAL_ECHO_START;
|
249
|
270
|
if (volumetric_enabled) {
|
250
|
271
|
SERIAL_ECHOLNPGM("Filament settings:");
|
|
@@ -259,14 +280,14 @@ SERIAL_ECHOLNPGM("Scaling factors:");
|
259
|
280
|
SERIAL_ECHO_START;
|
260
|
281
|
SERIAL_ECHOPAIR(" M200 T2 D", filament_size[2]);
|
261
|
282
|
SERIAL_ECHOLN("");
|
262
|
|
-#endif
|
263
|
|
-#endif
|
|
283
|
+#endif//EXTRUDERS > 2
|
|
284
|
+#endif//EXTRUDERS > 1
|
264
|
285
|
} else {
|
265
|
286
|
SERIAL_ECHOLNPGM("Filament settings: Disabled");
|
266
|
287
|
}
|
267
|
|
-#endif
|
|
288
|
+#endif//FWRETRACT
|
268
|
289
|
}
|
269
|
|
-#endif
|
|
290
|
+#endif//DISABLE_M503
|
270
|
291
|
|
271
|
292
|
|
272
|
293
|
#ifdef EEPROM_SETTINGS
|
|
@@ -301,11 +322,11 @@ void Config_RetrieveSettings()
|
301
|
322
|
EEPROM_READ_VAR(i,delta_radius);
|
302
|
323
|
EEPROM_READ_VAR(i,delta_diagonal_rod);
|
303
|
324
|
EEPROM_READ_VAR(i,delta_segments_per_second);
|
304
|
|
- #endif
|
|
325
|
+ #endif//DELTA
|
305
|
326
|
#ifndef ULTIPANEL
|
306
|
327
|
int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
|
307
|
328
|
int absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed;
|
308
|
|
- #endif
|
|
329
|
+ #endif//ULTIPANEL
|
309
|
330
|
EEPROM_READ_VAR(i,plaPreheatHotendTemp);
|
310
|
331
|
EEPROM_READ_VAR(i,plaPreheatHPBTemp);
|
311
|
332
|
EEPROM_READ_VAR(i,plaPreheatFanSpeed);
|
|
@@ -313,35 +334,68 @@ void Config_RetrieveSettings()
|
313
|
334
|
EEPROM_READ_VAR(i,absPreheatHPBTemp);
|
314
|
335
|
EEPROM_READ_VAR(i,absPreheatFanSpeed);
|
315
|
336
|
EEPROM_READ_VAR(i,zprobe_zoffset);
|
316
|
|
- #ifndef PIDTEMP
|
317
|
|
- float Kp,Ki,Kd;
|
318
|
|
- #endif
|
319
|
|
- // do not need to scale PID values as the values in EEPROM are already scaled
|
320
|
|
- EEPROM_READ_VAR(i,Kp);
|
321
|
|
- EEPROM_READ_VAR(i,Ki);
|
322
|
|
- EEPROM_READ_VAR(i,Kd);
|
|
337
|
+ #ifdef PIDTEMP
|
|
338
|
+ float dummy = 0.0f;
|
|
339
|
+ for (int e = 0; e < 3; e++) // 3 = max extruders supported by marlin
|
|
340
|
+ {
|
|
341
|
+ if (e < EXTRUDERS)
|
|
342
|
+ {
|
|
343
|
+ // do not need to scale PID values as the values in EEPROM are already scaled
|
|
344
|
+ EEPROM_READ_VAR(i,PID_PARAM(Kp,e));
|
|
345
|
+ EEPROM_READ_VAR(i,PID_PARAM(Ki,e));
|
|
346
|
+ EEPROM_READ_VAR(i,PID_PARAM(Kd,e));
|
|
347
|
+#ifdef PID_ADD_EXTRUSION_RATE
|
|
348
|
+ EEPROM_READ_VAR(i,PID_PARAM(Kc,e));
|
|
349
|
+#else//PID_ADD_EXTRUSION_RATE
|
|
350
|
+ EEPROM_READ_VAR(i,dummy);
|
|
351
|
+#endif//PID_ADD_EXTRUSION_RATE
|
|
352
|
+ }
|
|
353
|
+ else
|
|
354
|
+ {
|
|
355
|
+ EEPROM_READ_VAR(i,dummy);
|
|
356
|
+ EEPROM_READ_VAR(i,dummy);
|
|
357
|
+ EEPROM_READ_VAR(i,dummy);
|
|
358
|
+ EEPROM_READ_VAR(i,dummy);
|
|
359
|
+ }
|
|
360
|
+ }
|
|
361
|
+ #else//PIDTEMP
|
|
362
|
+ // 4 x 3 = 12 slots for PID parameters
|
|
363
|
+ float dummy = 0.0f;
|
|
364
|
+ EEPROM_READ_VAR(i,dummy);
|
|
365
|
+ EEPROM_READ_VAR(i,dummy);
|
|
366
|
+ EEPROM_READ_VAR(i,dummy);
|
|
367
|
+ EEPROM_READ_VAR(i,dummy);
|
|
368
|
+ EEPROM_READ_VAR(i,dummy);
|
|
369
|
+ EEPROM_READ_VAR(i,dummy);
|
|
370
|
+ EEPROM_READ_VAR(i,dummy);
|
|
371
|
+ EEPROM_READ_VAR(i,dummy);
|
|
372
|
+ EEPROM_READ_VAR(i,dummy);
|
|
373
|
+ EEPROM_READ_VAR(i,dummy);
|
|
374
|
+ EEPROM_READ_VAR(i,dummy);
|
|
375
|
+ EEPROM_READ_VAR(i,dummy);
|
|
376
|
+ #endif//PIDTEMP
|
323
|
377
|
#ifndef DOGLCD
|
324
|
378
|
int lcd_contrast;
|
325
|
|
- #endif
|
|
379
|
+ #endif//DOGLCD
|
326
|
380
|
EEPROM_READ_VAR(i,lcd_contrast);
|
327
|
381
|
#ifdef SCARA
|
328
|
382
|
EEPROM_READ_VAR(i,axis_scaling);
|
329
|
|
- #endif
|
|
383
|
+ #endif//SCARA
|
330
|
384
|
|
331
|
385
|
#ifdef FWRETRACT
|
332
|
386
|
EEPROM_READ_VAR(i,autoretract_enabled);
|
333
|
387
|
EEPROM_READ_VAR(i,retract_length);
|
334
|
388
|
#if EXTRUDERS > 1
|
335
|
389
|
EEPROM_READ_VAR(i,retract_length_swap);
|
336
|
|
- #endif
|
|
390
|
+ #endif//EXTRUDERS > 1
|
337
|
391
|
EEPROM_READ_VAR(i,retract_feedrate);
|
338
|
392
|
EEPROM_READ_VAR(i,retract_zlift);
|
339
|
393
|
EEPROM_READ_VAR(i,retract_recover_length);
|
340
|
394
|
#if EXTRUDERS > 1
|
341
|
395
|
EEPROM_READ_VAR(i,retract_recover_length_swap);
|
342
|
|
- #endif
|
|
396
|
+ #endif//EXTRUDERS > 1
|
343
|
397
|
EEPROM_READ_VAR(i,retract_recover_feedrate);
|
344
|
|
- #endif
|
|
398
|
+ #endif//FWRETRACT
|
345
|
399
|
|
346
|
400
|
EEPROM_READ_VAR(i, volumetric_enabled);
|
347
|
401
|
EEPROM_READ_VAR(i, filament_size[0]);
|
|
@@ -349,8 +403,8 @@ void Config_RetrieveSettings()
|
349
|
403
|
EEPROM_READ_VAR(i, filament_size[1]);
|
350
|
404
|
#if EXTRUDERS > 2
|
351
|
405
|
EEPROM_READ_VAR(i, filament_size[2]);
|
352
|
|
-#endif
|
353
|
|
-#endif
|
|
406
|
+#endif//EXTRUDERS > 2
|
|
407
|
+#endif//EXTRUDERS > 1
|
354
|
408
|
calculate_volumetric_multipliers();
|
355
|
409
|
// Call updatePID (similar to when we have processed M301)
|
356
|
410
|
updatePID();
|
|
@@ -363,9 +417,9 @@ void Config_RetrieveSettings()
|
363
|
417
|
}
|
364
|
418
|
#ifdef EEPROM_CHITCHAT
|
365
|
419
|
Config_PrintSettings();
|
366
|
|
- #endif
|
|
420
|
+ #endif//EEPROM_CHITCHAT
|
367
|
421
|
}
|
368
|
|
-#endif
|
|
422
|
+#endif//EEPROM_SETTINGS
|
369
|
423
|
|
370
|
424
|
void Config_ResetDefault()
|
371
|
425
|
{
|
|
@@ -379,7 +433,7 @@ void Config_ResetDefault()
|
379
|
433
|
max_acceleration_units_per_sq_second[i]=pgm_read_float(&tmp3[i]);
|
380
|
434
|
#ifdef SCARA
|
381
|
435
|
axis_scaling[i]=1;
|
382
|
|
- #endif
|
|
436
|
+ #endif//SCARA
|
383
|
437
|
}
|
384
|
438
|
|
385
|
439
|
// steps per sq second need to be updated to agree with the units per sq second
|
|
@@ -400,7 +454,7 @@ void Config_ResetDefault()
|
400
|
454
|
delta_diagonal_rod= DELTA_DIAGONAL_ROD;
|
401
|
455
|
delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND;
|
402
|
456
|
recalc_delta_settings(delta_radius, delta_diagonal_rod);
|
403
|
|
-#endif
|
|
457
|
+#endif//DELTA
|
404
|
458
|
#ifdef ULTIPANEL
|
405
|
459
|
plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;
|
406
|
460
|
plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP;
|
|
@@ -408,24 +462,29 @@ void Config_ResetDefault()
|
408
|
462
|
absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP;
|
409
|
463
|
absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP;
|
410
|
464
|
absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
|
411
|
|
-#endif
|
|
465
|
+#endif//ULTIPANEL
|
412
|
466
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
413
|
467
|
zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER;
|
414
|
|
-#endif
|
|
468
|
+#endif//ENABLE_AUTO_BED_LEVELING
|
415
|
469
|
#ifdef DOGLCD
|
416
|
470
|
lcd_contrast = DEFAULT_LCD_CONTRAST;
|
417
|
|
-#endif
|
|
471
|
+#endif//DOGLCD
|
418
|
472
|
#ifdef PIDTEMP
|
419
|
|
- Kp = DEFAULT_Kp;
|
420
|
|
- Ki = scalePID_i(DEFAULT_Ki);
|
421
|
|
- Kd = scalePID_d(DEFAULT_Kd);
|
422
|
|
-
|
|
473
|
+#ifdef PID_PARAMS_PER_EXTRUDER
|
|
474
|
+ for (int e = 0; e < EXTRUDERS; e++)
|
|
475
|
+#else // PID_PARAMS_PER_EXTRUDER
|
|
476
|
+ int e = 0; // only need to write once
|
|
477
|
+#endif // PID_PARAMS_PER_EXTRUDER
|
|
478
|
+ {
|
|
479
|
+ PID_PARAM(Kp,e) = DEFAULT_Kp;
|
|
480
|
+ PID_PARAM(Ki,e) = scalePID_i(DEFAULT_Ki);
|
|
481
|
+ PID_PARAM(Kd,e) = scalePID_d(DEFAULT_Kd);
|
|
482
|
+ #ifdef PID_ADD_EXTRUSION_RATE
|
|
483
|
+ PID_PARAM(Kc,e) = DEFAULT_Kc;
|
|
484
|
+ #endif//PID_ADD_EXTRUSION_RATE
|
|
485
|
+ }
|
423
|
486
|
// call updatePID (similar to when we have processed M301)
|
424
|
487
|
updatePID();
|
425
|
|
-
|
426
|
|
-#ifdef PID_ADD_EXTRUSION_RATE
|
427
|
|
- Kc = DEFAULT_Kc;
|
428
|
|
-#endif//PID_ADD_EXTRUSION_RATE
|
429
|
488
|
#endif//PIDTEMP
|
430
|
489
|
|
431
|
490
|
#ifdef FWRETRACT
|
|
@@ -433,15 +492,15 @@ void Config_ResetDefault()
|
433
|
492
|
retract_length = RETRACT_LENGTH;
|
434
|
493
|
#if EXTRUDERS > 1
|
435
|
494
|
retract_length_swap = RETRACT_LENGTH_SWAP;
|
436
|
|
-#endif
|
|
495
|
+#endif//EXTRUDERS > 1
|
437
|
496
|
retract_feedrate = RETRACT_FEEDRATE;
|
438
|
497
|
retract_zlift = RETRACT_ZLIFT;
|
439
|
498
|
retract_recover_length = RETRACT_RECOVER_LENGTH;
|
440
|
499
|
#if EXTRUDERS > 1
|
441
|
500
|
retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
|
442
|
|
-#endif
|
|
501
|
+#endif//EXTRUDERS > 1
|
443
|
502
|
retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
|
444
|
|
-#endif
|
|
503
|
+#endif//FWRETRACT
|
445
|
504
|
|
446
|
505
|
volumetric_enabled = false;
|
447
|
506
|
filament_size[0] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
|
@@ -449,11 +508,11 @@ void Config_ResetDefault()
|
449
|
508
|
filament_size[1] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
450
|
509
|
#if EXTRUDERS > 2
|
451
|
510
|
filament_size[2] = DEFAULT_NOMINAL_FILAMENT_DIA;
|
452
|
|
-#endif
|
453
|
|
-#endif
|
|
511
|
+#endif//EXTRUDERS > 2
|
|
512
|
+#endif//EXTRUDERS > 1
|
454
|
513
|
calculate_volumetric_multipliers();
|
455
|
514
|
|
456
|
515
|
SERIAL_ECHO_START;
|
457
|
516
|
SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
|
458
|
517
|
|
459
|
|
-}
|
|
518
|
+}
|