@@ -561,8 +561,11 @@ volatile bool Temperature::raw_temps_ready = false;
561
561
uint8_t Temperature::consecutive_low_temperature_error[HOTENDS] = { 0 };
562
562
#endif
563
563
564
- #if MILLISECONDS_PREHEAT_TIME > 0
565
- millis_t Temperature::preheat_end_time[HOTENDS] = { 0 };
564
+ #if PREHEAT_TIME_HOTEND_MS > 0
565
+ millis_t Temperature::preheat_end_ms_hotend[HOTENDS] { 0 };
566
+ #endif
567
+ #if HAS_HEATED_BED && PREHEAT_TIME_BED_MS > 0
568
+ millis_t Temperature::preheat_end_ms_bed = 0 ;
566
569
#endif
567
570
568
571
#if HAS_FAN_LOGIC
@@ -1535,7 +1538,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id) {
1535
1538
tr_state_machine[e].run (temp_hotend[e].celsius , temp_hotend[e].target , (heater_id_t )e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
1536
1539
#endif
1537
1540
1538
- temp_hotend[e].soft_pwm_amount = (temp_hotend[e].celsius > temp_range[e].mintemp || is_preheating (e)) && temp_hotend[e].celsius < temp_range[e].maxtemp ? (int )get_pid_output_hotend (e) >> 1 : 0 ;
1541
+ temp_hotend[e].soft_pwm_amount = (temp_hotend[e].celsius > temp_range[e].mintemp || is_hotend_preheating (e)) && temp_hotend[e].celsius < temp_range[e].maxtemp ? (int )get_pid_output_hotend (e) >> 1 : 0 ;
1539
1542
1540
1543
#if WATCH_HOTENDS
1541
1544
// Make sure temperature is increasing
@@ -1609,25 +1612,30 @@ void Temperature::mintemp_error(const heater_id_t heater_id) {
1609
1612
#endif
1610
1613
1611
1614
if (!bed_timed_out) {
1612
- #if ENABLED(PIDTEMPBED)
1613
- temp_bed.soft_pwm_amount = WITHIN (temp_bed.celsius , BED_MINTEMP, BED_MAXTEMP) ? (int )get_pid_output_bed () >> 1 : 0 ;
1614
- #else
1615
- // Check if temperature is within the correct band
1616
- if (WITHIN (temp_bed.celsius , BED_MINTEMP, BED_MAXTEMP)) {
1617
- #if ENABLED(BED_LIMIT_SWITCHING)
1618
- if (temp_bed.is_above_target ((BED_HYSTERESIS) - 1 ))
1619
- temp_bed.soft_pwm_amount = 0 ;
1620
- else if (temp_bed.is_below_target ((BED_HYSTERESIS) - 1 ))
1621
- temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1 ;
1622
- #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
1623
- temp_bed.soft_pwm_amount = temp_bed.is_below_target () ? MAX_BED_POWER >> 1 : 0 ;
1624
- #endif
1625
- }
1626
- else {
1627
- temp_bed.soft_pwm_amount = 0 ;
1628
- WRITE_HEATER_BED (LOW);
1629
- }
1630
- #endif
1615
+ if (is_bed_preheating ()) {
1616
+ temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1 ;
1617
+ }
1618
+ else {
1619
+ #if ENABLED(PIDTEMPBED)
1620
+ temp_bed.soft_pwm_amount = WITHIN (temp_bed.celsius , BED_MINTEMP, BED_MAXTEMP) ? (int )get_pid_output_bed () >> 1 : 0 ;
1621
+ #else
1622
+ // Check if temperature is within the correct band
1623
+ if (WITHIN (temp_bed.celsius , BED_MINTEMP, BED_MAXTEMP)) {
1624
+ #if ENABLED(BED_LIMIT_SWITCHING)
1625
+ if (temp_bed.is_above_target ((BED_HYSTERESIS) - 1 ))
1626
+ temp_bed.soft_pwm_amount = 0 ;
1627
+ else if (temp_bed.is_below_target ((BED_HYSTERESIS) - 1 ))
1628
+ temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1 ;
1629
+ #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
1630
+ temp_bed.soft_pwm_amount = temp_bed.is_below_target () ? MAX_BED_POWER >> 1 : 0 ;
1631
+ #endif
1632
+ }
1633
+ else {
1634
+ temp_bed.soft_pwm_amount = 0 ;
1635
+ WRITE_HEATER_BED (LOW);
1636
+ }
1637
+ #endif
1638
+ }
1631
1639
}
1632
1640
1633
1641
} while (false );
@@ -2394,7 +2402,7 @@ void Temperature::updateTemperaturesFromRawValues() {
2394
2402
//*/
2395
2403
2396
2404
const bool heater_on = temp_hotend[e].target > 0 ;
2397
- if (heater_on && !is_preheating (e) && ((neg && r > temp_range[e].raw_min ) || (pos && r < temp_range[e].raw_min ))) {
2405
+ if (heater_on && !is_hotend_preheating (e) && ((neg && r > temp_range[e].raw_min ) || (pos && r < temp_range[e].raw_min ))) {
2398
2406
if (TERN1 (MULTI_MAX_CONSECUTIVE_LOW_TEMP_ERR, ++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED))
2399
2407
mintemp_error ((heater_id_t )e);
2400
2408
}
@@ -2408,7 +2416,7 @@ void Temperature::updateTemperaturesFromRawValues() {
2408
2416
#define TP_CMP (S,A,B ) (TEMPDIR(S) < 0 ? ((A)<(B)) : ((A)>(B)))
2409
2417
#if ENABLED(THERMAL_PROTECTION_BED)
2410
2418
if (TP_CMP (BED, temp_bed.getraw (), maxtemp_raw_BED)) maxtemp_error (H_BED);
2411
- if (temp_bed.target > 0 && TP_CMP (BED, mintemp_raw_BED, temp_bed.getraw ())) mintemp_error (H_BED);
2419
+ if (temp_bed.target > 0 && ! is_bed_preheating () && TP_CMP (BED, mintemp_raw_BED, temp_bed.getraw ())) mintemp_error (H_BED);
2412
2420
#endif
2413
2421
2414
2422
#if BOTH(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER)
0 commit comments