|
|
@ -76,13 +76,13 @@ class Temperature {
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PIDTEMP)
|
|
|
|
#if ENABLED(PIDTEMP)
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PID_PARAMS_PER_HOTEND)
|
|
|
|
#if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
|
|
|
|
|
|
|
|
|
|
|
|
static float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
|
|
|
|
static float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
|
|
|
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
|
|
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
|
|
|
static float Kc[HOTENDS];
|
|
|
|
static float Kc[HOTENDS];
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#define PID_PARAM(param, e) Temperature::param[e]
|
|
|
|
#define PID_PARAM(param, h) Temperature::param[h]
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ class Temperature {
|
|
|
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
|
|
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
|
|
|
static float Kc;
|
|
|
|
static float Kc;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#define PID_PARAM(param, e) Temperature::param
|
|
|
|
#define PID_PARAM(param, h) Temperature::param
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PID_PARAMS_PER_HOTEND
|
|
|
|
#endif // PID_PARAMS_PER_HOTEND
|
|
|
|
|
|
|
|
|
|
|
@ -150,7 +150,7 @@ class Temperature {
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
|
|
|
#if ENABLED(PID_ADD_EXTRUSION_RATE)
|
|
|
|
static float cTerm[HOTENDS];
|
|
|
|
static float cTerm[HOTENDS];
|
|
|
|
static long last_position[HOTENDS];
|
|
|
|
static long last_e_position;
|
|
|
|
static long lpq[LPQ_MAX_LEN];
|
|
|
|
static long lpq[LPQ_MAX_LEN];
|
|
|
|
static int lpq_ptr;
|
|
|
|
static int lpq_ptr;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -247,11 +247,24 @@ class Temperature {
|
|
|
|
* Preheating hotends
|
|
|
|
* Preheating hotends
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
#ifdef MILLISECONDS_PREHEAT_TIME
|
|
|
|
#ifdef MILLISECONDS_PREHEAT_TIME
|
|
|
|
static bool is_preheating(uint8_t hotend) {
|
|
|
|
static bool is_preheating(uint8_t e) {
|
|
|
|
return preheat_end_time[hotend] && PENDING(millis(), preheat_end_time[hotend]);
|
|
|
|
#if HOTENDS == 1
|
|
|
|
|
|
|
|
UNUSED(e);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void start_preheat_time(uint8_t e) {
|
|
|
|
|
|
|
|
#if HOTENDS == 1
|
|
|
|
|
|
|
|
UNUSED(e);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void reset_preheat_time(uint8_t e) {
|
|
|
|
|
|
|
|
#if HOTENDS == 1
|
|
|
|
|
|
|
|
UNUSED(e);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
preheat_end_time[HOTEND_INDEX] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void start_preheat_time(uint8_t hotend) { preheat_end_time[hotend] = millis() + MILLISECONDS_PREHEAT_TIME; }
|
|
|
|
|
|
|
|
static void reset_preheat_time(uint8_t hotend) { preheat_end_time[hotend] = 0; }
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
#define is_preheating(n) (false)
|
|
|
|
#define is_preheating(n) (false)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -306,9 +319,9 @@ class Temperature {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef MILLISECONDS_PREHEAT_TIME
|
|
|
|
#ifdef MILLISECONDS_PREHEAT_TIME
|
|
|
|
if (celsius == 0.0f)
|
|
|
|
if (celsius == 0.0f)
|
|
|
|
reset_preheat_time(hotend);
|
|
|
|
reset_preheat_time(HOTEND_INDEX);
|
|
|
|
else if (target_temperature[hotend] == 0.0f)
|
|
|
|
else if (target_temperature[HOTEND_INDEX] == 0.0f)
|
|
|
|
start_preheat_time(hotend);
|
|
|
|
start_preheat_time(HOTEND_INDEX);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
target_temperature[HOTEND_INDEX] = celsius;
|
|
|
|
target_temperature[HOTEND_INDEX] = celsius;
|
|
|
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
|
|
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
|
|
|
|