|
@@ -3,7 +3,21 @@
|
3
|
3
|
*
|
4
|
4
|
* Configuration and EEPROM storage
|
5
|
5
|
*
|
6
|
|
- * V16 EEPROM Layout:
|
|
6
|
+ * IMPORTANT: Whenever there are changes made to the variables stored in EEPROM
|
|
7
|
+ * in the functions below, also increment the version number. This makes sure that
|
|
8
|
+ * the default values are used whenever there is a change to the data, to prevent
|
|
9
|
+ * wrong data being written to the variables.
|
|
10
|
+ *
|
|
11
|
+ * ALSO: Variables in the Store and Retrieve sections must be in the same order.
|
|
12
|
+ * If a feature is disabled, some data must still be written that, when read,
|
|
13
|
+ * either sets a Sane Default, or results in No Change to the existing value.
|
|
14
|
+ *
|
|
15
|
+ */
|
|
16
|
+
|
|
17
|
+#define EEPROM_VERSION "V19"
|
|
18
|
+
|
|
19
|
+/**
|
|
20
|
+ * V19 EEPROM Layout:
|
7
|
21
|
*
|
8
|
22
|
* ver
|
9
|
23
|
* axis_steps_per_unit (x4)
|
|
@@ -47,6 +61,9 @@
|
47
|
61
|
* Kp[2], Ki[2], Kd[2], Kc[2]
|
48
|
62
|
* Kp[3], Ki[3], Kd[3], Kc[3]
|
49
|
63
|
*
|
|
64
|
+ * PIDTEMPBED:
|
|
65
|
+ * bedKp, bedKi, bedKd
|
|
66
|
+ *
|
50
|
67
|
* DOGLCD:
|
51
|
68
|
* lcd_contrast
|
52
|
69
|
*
|
|
@@ -111,15 +128,6 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
|
111
|
128
|
|
112
|
129
|
#define EEPROM_OFFSET 100
|
113
|
130
|
|
114
|
|
-
|
115
|
|
-// IMPORTANT: Whenever there are changes made to the variables stored in EEPROM
|
116
|
|
-// in the functions below, also increment the version number. This makes sure that
|
117
|
|
-// the default values are used whenever there is a change to the data, to prevent
|
118
|
|
-// wrong data being written to the variables.
|
119
|
|
-// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
|
120
|
|
-
|
121
|
|
-#define EEPROM_VERSION "V18"
|
122
|
|
-
|
123
|
131
|
#ifdef EEPROM_SETTINGS
|
124
|
132
|
|
125
|
133
|
void Config_StoreSettings() {
|
|
@@ -194,7 +202,6 @@ void Config_StoreSettings() {
|
194
|
202
|
EEPROM_WRITE_VAR(i, absPreheatHPBTemp);
|
195
|
203
|
EEPROM_WRITE_VAR(i, absPreheatFanSpeed);
|
196
|
204
|
|
197
|
|
-
|
198
|
205
|
for (int e = 0; e < 4; e++) {
|
199
|
206
|
|
200
|
207
|
#ifdef PIDTEMP
|
|
@@ -209,12 +216,10 @@ void Config_StoreSettings() {
|
209
|
216
|
EEPROM_WRITE_VAR(i, dummy);
|
210
|
217
|
#endif
|
211
|
218
|
}
|
212
|
|
- else {
|
213
|
|
- #else // !PIDTEMP
|
214
|
|
- {
|
|
219
|
+ else
|
215
|
220
|
#endif // !PIDTEMP
|
216
|
|
-
|
217
|
|
- dummy = DUMMY_PID_VALUE;
|
|
221
|
+ {
|
|
222
|
+ dummy = DUMMY_PID_VALUE; // When read, will not change the existing value
|
218
|
223
|
EEPROM_WRITE_VAR(i, dummy);
|
219
|
224
|
dummy = 0.0f;
|
220
|
225
|
for (int q = 3; q--;) EEPROM_WRITE_VAR(i, dummy);
|
|
@@ -222,6 +227,14 @@ void Config_StoreSettings() {
|
222
|
227
|
|
223
|
228
|
} // Extruders Loop
|
224
|
229
|
|
|
230
|
+ #ifndef PIDTEMPBED
|
|
231
|
+ float bedKp = DUMMY_PID_VALUE, bedKi = DUMMY_PID_VALUE, bedKd = DUMMY_PID_VALUE;
|
|
232
|
+ #endif
|
|
233
|
+
|
|
234
|
+ EEPROM_WRITE_VAR(i, bedKp);
|
|
235
|
+ EEPROM_WRITE_VAR(i, bedKi);
|
|
236
|
+ EEPROM_WRITE_VAR(i, bedKd);
|
|
237
|
+
|
225
|
238
|
#ifndef DOGLCD
|
226
|
239
|
int lcd_contrast = 32;
|
227
|
240
|
#endif
|
|
@@ -364,7 +377,7 @@ void Config_RetrieveSettings() {
|
364
|
377
|
|
365
|
378
|
#ifdef PIDTEMP
|
366
|
379
|
for (int e = 0; e < 4; e++) { // 4 = max extruders currently supported by Marlin
|
367
|
|
- EEPROM_READ_VAR(i, dummy);
|
|
380
|
+ EEPROM_READ_VAR(i, dummy); // Kp
|
368
|
381
|
if (e < EXTRUDERS && dummy != DUMMY_PID_VALUE) {
|
369
|
382
|
// do not need to scale PID values as the values in EEPROM are already scaled
|
370
|
383
|
PID_PARAM(Kp, e) = dummy;
|
|
@@ -385,6 +398,20 @@ void Config_RetrieveSettings() {
|
385
|
398
|
for (int q=16; q--;) EEPROM_READ_VAR(i, dummy); // 4x Kp, Ki, Kd, Kc
|
386
|
399
|
#endif // !PIDTEMP
|
387
|
400
|
|
|
401
|
+ #ifndef PIDTEMPBED
|
|
402
|
+ float bedKp, bedKi, bedKd;
|
|
403
|
+ #endif
|
|
404
|
+
|
|
405
|
+ EEPROM_READ_VAR(i, dummy); // bedKp
|
|
406
|
+ if (dummy != DUMMY_PID_VALUE) {
|
|
407
|
+ bedKp = dummy;
|
|
408
|
+ EEPROM_READ_VAR(i, bedKi);
|
|
409
|
+ EEPROM_READ_VAR(i, bedKd);
|
|
410
|
+ }
|
|
411
|
+ else {
|
|
412
|
+ for (int q=2; q--;) EEPROM_READ_VAR(i, dummy); // bedKi, bedKd
|
|
413
|
+ }
|
|
414
|
+
|
388
|
415
|
#ifndef DOGLCD
|
389
|
416
|
int lcd_contrast;
|
390
|
417
|
#endif
|
|
@@ -517,6 +544,12 @@ void Config_ResetDefault() {
|
517
|
544
|
updatePID();
|
518
|
545
|
#endif // PIDTEMP
|
519
|
546
|
|
|
547
|
+ #ifdef PIDTEMPBED
|
|
548
|
+ bedKp = DEFAULT_bedKp;
|
|
549
|
+ bedKi = scalePID_i(DEFAULT_bedKi);
|
|
550
|
+ bedKd = scalePID_d(DEFAULT_bedKd);
|
|
551
|
+ #endif
|
|
552
|
+
|
520
|
553
|
#ifdef FWRETRACT
|
521
|
554
|
autoretract_enabled = false;
|
522
|
555
|
retract_length = RETRACT_LENGTH;
|
|
@@ -660,17 +693,25 @@ void Config_PrintSettings(bool forReplay) {
|
660
|
693
|
SERIAL_EOL;
|
661
|
694
|
#endif // DELTA
|
662
|
695
|
|
663
|
|
- #ifdef PIDTEMP
|
|
696
|
+ #if defined(PIDTEMP) || defined(PIDTEMPBED)
|
664
|
697
|
SERIAL_ECHO_START;
|
665
|
698
|
if (!forReplay) {
|
666
|
699
|
SERIAL_ECHOLNPGM("PID settings:");
|
667
|
700
|
SERIAL_ECHO_START;
|
668
|
701
|
}
|
669
|
|
- SERIAL_ECHOPAIR(" M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echos values for E0
|
670
|
|
- SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0)));
|
671
|
|
- SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0)));
|
672
|
|
- SERIAL_EOL;
|
673
|
|
- #endif // PIDTEMP
|
|
702
|
+ #ifdef PIDTEMP
|
|
703
|
+ SERIAL_ECHOPAIR(" M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echos values for E0
|
|
704
|
+ SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0)));
|
|
705
|
+ SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0)));
|
|
706
|
+ SERIAL_EOL;
|
|
707
|
+ #endif
|
|
708
|
+ #ifdef PIDTEMPBED
|
|
709
|
+ SERIAL_ECHOPAIR(" M304 P", bedKp); // for compatibility with hosts, only echos values for E0
|
|
710
|
+ SERIAL_ECHOPAIR(" I", unscalePID_i(bedKi));
|
|
711
|
+ SERIAL_ECHOPAIR(" D", unscalePID_d(bedKd));
|
|
712
|
+ SERIAL_EOL;
|
|
713
|
+ #endif
|
|
714
|
+ #endif
|
674
|
715
|
|
675
|
716
|
#ifdef FWRETRACT
|
676
|
717
|
|