|
@@ -1444,7 +1444,7 @@ void Temperature::manage_heater() {
|
1444
|
1444
|
|
1445
|
1445
|
TERN_(HEATER_IDLE_HANDLER, heater_idle[IDLE_INDEX_BED].update(ms));
|
1446
|
1446
|
|
1447
|
|
- #if HAS_THERMALLY_PROTECTED_BED
|
|
1447
|
+ #if ENABLED(THERMAL_PROTECTION_BED)
|
1448
|
1448
|
tr_state_machine[RUNAWAY_IND_BED].run(temp_bed.celsius, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
|
1449
|
1449
|
#endif
|
1450
|
1450
|
|
|
@@ -2570,20 +2570,14 @@ void Temperature::init() {
|
2570
|
2570
|
);
|
2571
|
2571
|
*/
|
2572
|
2572
|
|
2573
|
|
- #if HEATER_IDLE_HANDLER
|
2574
|
|
- // If the heater idle timeout expires, restart
|
2575
|
|
- if (heater_idle[idle_index].timed_out) {
|
2576
|
|
- state = TRInactive;
|
2577
|
|
- running_temp = 0;
|
2578
|
|
- }
|
2579
|
|
- else
|
2580
|
|
- #endif
|
2581
|
|
- {
|
2582
|
|
- // If the target temperature changes, restart
|
2583
|
|
- if (running_temp != target) {
|
2584
|
|
- running_temp = target;
|
2585
|
|
- state = target > 0 ? TRFirstHeating : TRInactive;
|
2586
|
|
- }
|
|
2573
|
+ // If the heater idle timeout expires, restart
|
|
2574
|
+ if (TERN0(HEATER_IDLE_HANDLER, heater_idle[idle_index].timed_out)) {
|
|
2575
|
+ state = TRInactive;
|
|
2576
|
+ running_temp = 0;
|
|
2577
|
+ }
|
|
2578
|
+ else if (running_temp != target) { // If the target temperature changes, restart
|
|
2579
|
+ running_temp = target;
|
|
2580
|
+ state = target > 0 ? TRFirstHeating : TRInactive;
|
2587
|
2581
|
}
|
2588
|
2582
|
|
2589
|
2583
|
switch (state) {
|
|
@@ -2596,7 +2590,7 @@ void Temperature::init() {
|
2596
|
2590
|
state = TRStable;
|
2597
|
2591
|
|
2598
|
2592
|
// While the temperature is stable watch for a bad temperature
|
2599
|
|
- case TRStable:
|
|
2593
|
+ case TRStable: {
|
2600
|
2594
|
|
2601
|
2595
|
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
2602
|
2596
|
if (adaptive_fan_slowing && heater_id >= 0) {
|
|
@@ -2614,13 +2608,17 @@ void Temperature::init() {
|
2614
|
2608
|
}
|
2615
|
2609
|
#endif
|
2616
|
2610
|
|
|
2611
|
+ const millis_t now = millis();
|
|
2612
|
+
|
2617
|
2613
|
if (current >= running_temp - hysteresis_degc) {
|
2618
|
|
- timer = millis() + SEC_TO_MS(period_seconds);
|
|
2614
|
+ timer = now + SEC_TO_MS(period_seconds);
|
2619
|
2615
|
break;
|
2620
|
2616
|
}
|
2621
|
|
- else if (PENDING(millis(), timer)) break;
|
|
2617
|
+ else if (PENDING(now, timer)) break;
|
2622
|
2618
|
state = TRRunaway;
|
2623
|
2619
|
|
|
2620
|
+ } // fall through
|
|
2621
|
+
|
2624
|
2622
|
case TRRunaway:
|
2625
|
2623
|
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_Popup_Temperature(0));
|
2626
|
2624
|
_temp_error(heater_id, FPSTR(str_t_thermal_runaway), GET_TEXT_F(MSG_THERMAL_RUNAWAY));
|