|
@@ -76,13 +76,13 @@ class Temperature {
|
76
|
76
|
|
77
|
77
|
#if ENABLED(PIDTEMP)
|
78
|
78
|
|
79
|
|
- #if ENABLED(PID_PARAMS_PER_HOTEND)
|
|
79
|
+ #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
|
80
|
80
|
|
81
|
81
|
static float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
|
82
|
82
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
83
|
83
|
static float Kc[HOTENDS];
|
84
|
84
|
#endif
|
85
|
|
- #define PID_PARAM(param, e) Temperature::param[e]
|
|
85
|
+ #define PID_PARAM(param, h) Temperature::param[h]
|
86
|
86
|
|
87
|
87
|
#else
|
88
|
88
|
|
|
@@ -90,7 +90,7 @@ class Temperature {
|
90
|
90
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
91
|
91
|
static float Kc;
|
92
|
92
|
#endif
|
93
|
|
- #define PID_PARAM(param, e) Temperature::param
|
|
93
|
+ #define PID_PARAM(param, h) Temperature::param
|
94
|
94
|
|
95
|
95
|
#endif // PID_PARAMS_PER_HOTEND
|
96
|
96
|
|
|
@@ -150,7 +150,7 @@ class Temperature {
|
150
|
150
|
|
151
|
151
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
152
|
152
|
static float cTerm[HOTENDS];
|
153
|
|
- static long last_position[HOTENDS];
|
|
153
|
+ static long last_e_position;
|
154
|
154
|
static long lpq[LPQ_MAX_LEN];
|
155
|
155
|
static int lpq_ptr;
|
156
|
156
|
#endif
|
|
@@ -247,11 +247,24 @@ class Temperature {
|
247
|
247
|
* Preheating hotends
|
248
|
248
|
*/
|
249
|
249
|
#ifdef MILLISECONDS_PREHEAT_TIME
|
250
|
|
- static bool is_preheating(uint8_t hotend) {
|
251
|
|
- return preheat_end_time[hotend] && PENDING(millis(), preheat_end_time[hotend]);
|
|
250
|
+ static bool is_preheating(uint8_t e) {
|
|
251
|
+ #if HOTENDS == 1
|
|
252
|
+ UNUSED(e);
|
|
253
|
+ #endif
|
|
254
|
+ return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]);
|
|
255
|
+ }
|
|
256
|
+ static void start_preheat_time(uint8_t e) {
|
|
257
|
+ #if HOTENDS == 1
|
|
258
|
+ UNUSED(e);
|
|
259
|
+ #endif
|
|
260
|
+ preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME;
|
|
261
|
+ }
|
|
262
|
+ static void reset_preheat_time(uint8_t e) {
|
|
263
|
+ #if HOTENDS == 1
|
|
264
|
+ UNUSED(e);
|
|
265
|
+ #endif
|
|
266
|
+ preheat_end_time[HOTEND_INDEX] = 0;
|
252
|
267
|
}
|
253
|
|
- static void start_preheat_time(uint8_t hotend) { preheat_end_time[hotend] = millis() + MILLISECONDS_PREHEAT_TIME; }
|
254
|
|
- static void reset_preheat_time(uint8_t hotend) { preheat_end_time[hotend] = 0; }
|
255
|
268
|
#else
|
256
|
269
|
#define is_preheating(n) (false)
|
257
|
270
|
#endif
|
|
@@ -306,9 +319,9 @@ class Temperature {
|
306
|
319
|
#endif
|
307
|
320
|
#ifdef MILLISECONDS_PREHEAT_TIME
|
308
|
321
|
if (celsius == 0.0f)
|
309
|
|
- reset_preheat_time(hotend);
|
310
|
|
- else if (target_temperature[hotend] == 0.0f)
|
311
|
|
- start_preheat_time(hotend);
|
|
322
|
+ reset_preheat_time(HOTEND_INDEX);
|
|
323
|
+ else if (target_temperature[HOTEND_INDEX] == 0.0f)
|
|
324
|
+ start_preheat_time(HOTEND_INDEX);
|
312
|
325
|
#endif
|
313
|
326
|
target_temperature[HOTEND_INDEX] = celsius;
|
314
|
327
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|