Improve max temp / target

This commit is contained in:
Scott Lahteine 2021-03-19 16:34:10 -05:00 committed by Scott Lahteine
parent df1ef496d1
commit cfa6c7d45b
15 changed files with 47 additions and 52 deletions

View file

@ -484,6 +484,7 @@
*/ */
#define HOTEND_OVERSHOOT 15 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT #define HOTEND_OVERSHOOT 15 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT
#define BED_OVERSHOOT 10 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT #define BED_OVERSHOOT 10 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT
#define COOLER_OVERSHOOT 2 // (°C) Forbid temperatures closer than OVERSHOOT
//=========================================================================== //===========================================================================
//============================= PID Settings ================================ //============================= PID Settings ================================

View file

@ -177,7 +177,7 @@ void GcodeSuite::M360() {
config_line_e(e, PSTR("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]); config_line_e(e, PSTR("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);
config_line_e(e, PSTR("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]); config_line_e(e, PSTR("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]);
config_line_e(e, PSTR("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e])); config_line_e(e, PSTR("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e]));
config_line_e(e, PSTR("MaxTemp"), thermalManager.heater_maxtemp[e]); config_line_e(e, PSTR("MaxTemp"), thermalManager.hotend_maxtemp[e]);
} }
#endif #endif
} }

View file

@ -390,15 +390,13 @@ public:
} }
} }
#define TEMP_UNIT(N) parser.to_temp_units(N)
#else // !TEMPERATURE_UNITS_SUPPORT #else // !TEMPERATURE_UNITS_SUPPORT
static inline float to_temp_units(int16_t c) { return (float)c; }
static inline float value_celsius() { return value_float(); } static inline float value_celsius() { return value_float(); }
static inline float value_celsius_diff() { return value_float(); } static inline float value_celsius_diff() { return value_float(); }
#define TEMP_UNIT(N) (N)
#endif // !TEMPERATURE_UNITS_SUPPORT #endif // !TEMPERATURE_UNITS_SUPPORT
static inline feedRate_t value_feedrate() { return MMM_TO_MMS(value_linear_units()); } static inline feedRate_t value_feedrate() { return MMM_TO_MMS(value_linear_units()); }

View file

@ -2025,11 +2025,17 @@
#undef PIDTEMPBED #undef PIDTEMPBED
#endif #endif
#if HAS_HEATED_BED || HAS_TEMP_CHAMBER
#define BED_OR_CHAMBER 1
#endif
#if HAS_TEMP_COOLER && PIN_EXISTS(COOLER) #if HAS_TEMP_COOLER && PIN_EXISTS(COOLER)
#define HAS_COOLER 1 #define HAS_COOLER 1
#ifndef COOLER_OVERSHOOT
#define COOLER_OVERSHOOT 2
#endif
#define COOLER_MIN_TARGET (COOLER_MINTEMP + (COOLER_OVERSHOOT))
#define COOLER_MAX_TARGET (COOLER_MAXTEMP - (COOLER_OVERSHOOT))
#endif
#if HAS_HEATED_BED || HAS_TEMP_CHAMBER
#define BED_OR_CHAMBER 1
#endif #endif
#if HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER #if HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER
#define HAS_TEMP_SENSOR 1 #define HAS_TEMP_SENSOR 1

View file

@ -112,12 +112,6 @@
#define MAX_PRINT_SPEED 999 #define MAX_PRINT_SPEED 999
#define MIN_PRINT_SPEED 10 #define MIN_PRINT_SPEED 10
// Temp limits
#if HAS_HOTEND
#define MAX_E_TEMP (HEATER_0_MAXTEMP - (HOTEND_OVERSHOOT))
#define MIN_E_TEMP HEATER_0_MINTEMP
#endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
#define MIN_BED_TEMP BED_MINTEMP #define MIN_BED_TEMP BED_MINTEMP
#endif #endif
@ -1357,7 +1351,7 @@ void HMI_Move_Z() {
return; return;
} }
// E_Temp limit // E_Temp limit
LIMIT(HMI_ValueStruct.E_Temp, MIN_E_TEMP, MAX_E_TEMP); LIMIT(HMI_ValueStruct.E_Temp, HEATER_0_MINTEMP, thermalManager.hotend_max_target(0));
// E_Temp value // E_Temp value
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
} }

View file

@ -924,7 +924,7 @@ namespace ExtUI {
enableHeater(heater); enableHeater(heater);
switch (heater) { switch (heater) {
#if HAS_HEATED_CHAMBER #if HAS_HEATED_CHAMBER
case CHAMBER: thermalManager.setTargetChamber(LROUND(constrain(value, 0, CHAMBER_MAXTEMP - 10))); break; case CHAMBER: thermalManager.setTargetChamber(LROUND(constrain(value, 0, CHAMBER_MAX_TARGET))); break;
#endif #endif
#if HAS_COOLER #if HAS_COOLER
case COOLER: thermalManager.setTargetCooler(LROUND(constrain(value, 0, COOLER_MAXTEMP))); break; case COOLER: thermalManager.setTargetCooler(LROUND(constrain(value, 0, COOLER_MAXTEMP))); break;
@ -935,7 +935,7 @@ namespace ExtUI {
default: { default: {
#if HAS_HOTEND #if HAS_HOTEND
const int16_t e = heater - H0; const int16_t e = heater - H0;
thermalManager.setTargetHotend(LROUND(constrain(value, 0, thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT)), e); thermalManager.setTargetHotend(LROUND(constrain(value, 0, thermalManager.hotend_max_target(e))), e);
#endif #endif
} break; } break;
} }
@ -949,7 +949,7 @@ namespace ExtUI {
#if HAS_HOTEND #if HAS_HOTEND
const int16_t e = extruder - E0; const int16_t e = extruder - E0;
enableHeater(extruder); enableHeater(extruder);
thermalManager.setTargetHotend(LROUND(constrain(value, 0, thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT)), e); thermalManager.setTargetHotend(LROUND(constrain(value, 0, thermalManager.hotend_max_target(e))), e);
#endif #endif
} }

View file

@ -315,7 +315,7 @@ void menu_backlash();
#if ENABLED(PID_AUTOTUNE_MENU) #if ENABLED(PID_AUTOTUNE_MENU)
#define HOTEND_PID_EDIT_MENU_ITEMS(N) \ #define HOTEND_PID_EDIT_MENU_ITEMS(N) \
_HOTEND_PID_EDIT_MENU_ITEMS(N); \ _HOTEND_PID_EDIT_MENU_ITEMS(N); \
EDIT_ITEM_FAST_N(int3, N, MSG_PID_AUTOTUNE_E, &autotune_temp[N], 150, thermalManager.heater_maxtemp[N] - HOTEND_OVERSHOOT, []{ _lcd_autotune(heater_id_t(MenuItemBase::itemIndex)); }); EDIT_ITEM_FAST_N(int3, N, MSG_PID_AUTOTUNE_E, &autotune_temp[N], 150, thermalManager.hotend_max_target(N), []{ _lcd_autotune(heater_id_t(MenuItemBase::itemIndex)); });
#else #else
#define HOTEND_PID_EDIT_MENU_ITEMS(N) _HOTEND_PID_EDIT_MENU_ITEMS(N); #define HOTEND_PID_EDIT_MENU_ITEMS(N) _HOTEND_PID_EDIT_MENU_ITEMS(N);
#endif #endif

View file

@ -95,7 +95,7 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
ACTION_ITEM_N_S(m, ui.get_preheat_label(m), MSG_PREHEAT_M, _change_filament_with_preset); ACTION_ITEM_N_S(m, ui.get_preheat_label(m), MSG_PREHEAT_M, _change_filament_with_preset);
#endif #endif
EDIT_ITEM_FAST_N(int3, extruder, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[extruder].target, EDIT_ITEM_FAST_N(int3, extruder, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[extruder].target,
EXTRUDE_MINTEMP, thermalManager.heater_maxtemp[extruder] - HOTEND_OVERSHOOT, EXTRUDE_MINTEMP, thermalManager.hotend_max_target(extruder),
_change_filament_with_custom _change_filament_with_custom
); );
END_MENU(); END_MENU();

View file

@ -47,11 +47,11 @@
// "Temperature" submenu items // "Temperature" submenu items
// //
void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) { void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t indb) {
UNUSED(e); UNUSED(indh); UNUSED(indb); UNUSED(e); UNUSED(indh); UNUSED(indb);
#if HAS_HOTEND #if HAS_HOTEND
if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0) if (indh >= 0 && ui.material_preset[indh].hotend_temp > 0)
setTargetHotend(_MIN(thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, ui.material_preset[indh].hotend_temp), e); setTargetHotend(_MIN(thermalManager.hotend_max_target(e), ui.material_preset[indh].hotend_temp), e);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp); if (indb >= 0 && ui.material_preset[indb].bed_temp > 0) setTargetBed(ui.material_preset[indb].bed_temp);
@ -70,7 +70,7 @@ void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t i
void do_preheat_end_m() { _preheat_end(editable.int8, 0); } void do_preheat_end_m() { _preheat_end(editable.int8, 0); }
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
inline void _preheat_bed(const uint8_t m) { thermalManager.lcd_preheat(-1, -1, m); } inline void _preheat_bed(const uint8_t m) { thermalManager.lcd_preheat(0, -1, m); }
#endif #endif
#if HAS_COOLER #if HAS_COOLER
inline void _precool_laser(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, -1); } inline void _precool_laser(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, -1); }
@ -163,15 +163,15 @@ void menu_temperature() {
// Nozzle [1-5]: // Nozzle [1-5]:
// //
#if HOTENDS == 1 #if HOTENDS == 1
EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - (HOTEND_OVERSHOOT), []{ thermalManager.start_watching_hotend(0); }); EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, thermalManager.hotend_max_target(0), []{ thermalManager.start_watching_hotend(0); });
#elif HAS_MULTI_HOTEND #elif HAS_MULTI_HOTEND
HOTEND_LOOP() HOTEND_LOOP()
EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.heater_maxtemp[e] - (HOTEND_OVERSHOOT), []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); }); EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.hotend_max_target(e), []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
#endif #endif
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP) #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
LOOP_S_L_N(e, 1, EXTRUDERS) LOOP_S_L_N(e, 1, EXTRUDERS)
EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - (HOTEND_OVERSHOOT)); EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0));
#endif #endif
// //
@ -185,7 +185,7 @@ void menu_temperature() {
// Chamber: // Chamber:
// //
#if HAS_HEATED_CHAMBER #if HAS_HEATED_CHAMBER
EDIT_ITEM_FAST(int3, MSG_CHAMBER, &thermalManager.temp_chamber.target, 0, CHAMBER_MAXTEMP - 10, thermalManager.start_watching_chamber); EDIT_ITEM_FAST(int3, MSG_CHAMBER, &thermalManager.temp_chamber.target, 0, CHAMBER_MAX_TARGET, thermalManager.start_watching_chamber);
#endif #endif
// //
@ -194,7 +194,7 @@ void menu_temperature() {
#if HAS_COOLER #if HAS_COOLER
editable.state = cooler.is_enabled(); editable.state = cooler.is_enabled();
EDIT_ITEM(bool, MSG_COOLER(TOGGLE), &cooler.state, []{ if (editable.state) cooler.disable(); else cooler.enable(); }); EDIT_ITEM(bool, MSG_COOLER(TOGGLE), &cooler.state, []{ if (editable.state) cooler.disable(); else cooler.enable(); });
EDIT_ITEM_FAST(int3, MSG_COOLER, &thermalManager.temp_cooler.target, COOLER_MINTEMP + 2, COOLER_MAXTEMP - 2, thermalManager.start_watching_cooler); EDIT_ITEM_FAST(int3, MSG_COOLER, &thermalManager.temp_cooler.target, COOLER_MIN_TARGET, COOLER_MAX_TARGET, thermalManager.start_watching_cooler);
#endif #endif
// //

View file

@ -126,15 +126,15 @@ void menu_tune() {
// Nozzle [1-4]: // Nozzle [1-4]:
// //
#if HOTENDS == 1 #if HOTENDS == 1
EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(0); }); EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, thermalManager.hotend_max_target(0), []{ thermalManager.start_watching_hotend(0); });
#elif HAS_MULTI_HOTEND #elif HAS_MULTI_HOTEND
HOTEND_LOOP() HOTEND_LOOP()
EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); }); EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.hotend_max_target(e), []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
#endif #endif
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP) #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
LOOP_S_L_N(e, 1, EXTRUDERS) LOOP_S_L_N(e, 1, EXTRUDERS)
EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - HOTEND_OVERSHOOT); EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0));
#endif #endif
// //

View file

@ -126,7 +126,7 @@ void _lcd_ubl_custom_mesh() {
START_MENU(); START_MENU();
BACK_ITEM(MSG_UBL_BUILD_MESH_MENU); BACK_ITEM(MSG_UBL_BUILD_MESH_MENU);
#if HAS_HOTEND #if HAS_HOTEND
EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT); EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, thermalManager.hotend_max_target(0));
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, BED_MAX_TARGET); EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, BED_MAX_TARGET);

View file

@ -186,25 +186,25 @@ void Touch::touch(touch_control_t *control) {
ui.clear_lcd(); ui.clear_lcd();
if (heater >= 0) { // HotEnd if (heater >= 0) { // HotEnd
#if HOTENDS == 1 #if HOTENDS == 1
MenuItem_int3::action((const char *)GET_TEXT_F(MSG_NOZZLE), &thermalManager.temp_hotend[0].target, 0, thermalManager.heater_maxtemp[0] - 15, []{ thermalManager.start_watching_hotend(0); }); MenuItem_int3::action((const char *)GET_TEXT_F(MSG_NOZZLE), &thermalManager.temp_hotend[0].target, 0, thermalManager.hotend_max_target(0), []{ thermalManager.start_watching_hotend(0); });
#else #else
MenuItemBase::itemIndex = heater; MenuItemBase::itemIndex = heater;
MenuItem_int3::action((const char *)GET_TEXT_F(MSG_NOZZLE_N), &thermalManager.temp_hotend[heater].target, 0, thermalManager.heater_maxtemp[heater] - 15, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); }); MenuItem_int3::action((const char *)GET_TEXT_F(MSG_NOZZLE_N), &thermalManager.temp_hotend[heater].target, 0, thermalManager.hotend_max_target(heater), []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
#endif #endif
} }
#if HAS_HEATED_BED #if HAS_HEATED_BED
else if (heater == H_BED) { else if (heater == H_BED) {
MenuItem_int3::action((const char *)GET_TEXT_F(MSG_BED), &thermalManager.temp_bed.target, 0, BED_MAXTEMP - 10, thermalManager.start_watching_bed); MenuItem_int3::action((const char *)GET_TEXT_F(MSG_BED), &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed);
} }
#endif #endif
#if HAS_HEATED_CHAMBER #if HAS_HEATED_CHAMBER
else if (heater == H_CHAMBER) { else if (heater == H_CHAMBER) {
MenuItem_int3::action((const char *)GET_TEXT_F(MSG_CHAMBER), &thermalManager.temp_chamber.target, 0, CHAMBER_MAXTEMP - 10, thermalManager.start_watching_chamber); MenuItem_int3::action((const char *)GET_TEXT_F(MSG_CHAMBER), &thermalManager.temp_chamber.target, 0, CHAMBER_MAX_TARGET, thermalManager.start_watching_chamber);
} }
#endif #endif
#if HAS_COOLER #if HAS_COOLER
else if (heater == H_COOLER) { else if (heater == H_COOLER) {
MenuItem_int3::action((const char *)GET_TEXT_F(MSG_COOLER), &thermalManager.temp_cooler.target, 0, COOLER_MAXTEMP - 8, thermalManager.start_watching_cooler); MenuItem_int3::action((const char *)GET_TEXT_F(MSG_COOLER), &thermalManager.temp_cooler.target, 0, COOLER_MAX_TARGET, thermalManager.start_watching_cooler);
} }
#endif #endif

View file

@ -3386,10 +3386,10 @@ void MarlinSettings::reset() {
SERIAL_ECHOLNPAIR_P( SERIAL_ECHOLNPAIR_P(
PSTR(" M145 S"), i PSTR(" M145 S"), i
#if HAS_HOTEND #if HAS_HOTEND
, PSTR(" H"), TEMP_UNIT(ui.material_preset[i].hotend_temp) , PSTR(" H"), parser.to_temp_units(ui.material_preset[i].hotend_temp)
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
, SP_B_STR, TEMP_UNIT(ui.material_preset[i].bed_temp) , SP_B_STR, parser.to_temp_units(ui.material_preset[i].bed_temp)
#endif #endif
#if HAS_FAN #if HAS_FAN
, PSTR(" F"), ui.material_preset[i].fan_speed , PSTR(" F"), ui.material_preset[i].fan_speed

View file

@ -253,7 +253,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
#if HAS_HOTEND #if HAS_HOTEND
hotend_info_t Temperature::temp_hotend[HOTEND_TEMPS]; // = { 0 } hotend_info_t Temperature::temp_hotend[HOTEND_TEMPS]; // = { 0 }
const uint16_t Temperature::heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP); const uint16_t Temperature::hotend_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP);
#endif #endif
#if ENABLED(AUTO_POWER_E_FANS) #if ENABLED(AUTO_POWER_E_FANS)
@ -267,6 +267,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
#if ENABLED(AUTO_POWER_COOLER_FAN) #if ENABLED(AUTO_POWER_COOLER_FAN)
uint8_t Temperature::coolerfan_speed; // = 0 uint8_t Temperature::coolerfan_speed; // = 0
#endif #endif
#if HAS_FAN #if HAS_FAN
uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 } uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
@ -552,7 +553,7 @@ volatile bool Temperature::raw_temps_ready = false;
TERN_(HAS_AUTO_FAN, next_auto_fan_check_ms = next_temp_ms + 2500UL); TERN_(HAS_AUTO_FAN, next_auto_fan_check_ms = next_temp_ms + 2500UL);
if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - HOTEND_OVERSHOOT)) { if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - (HOTEND_OVERSHOOT))) {
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
return; return;
@ -1512,7 +1513,7 @@ void Temperature::manage_heater() {
if (cooler.is_enabled()) { if (cooler.is_enabled()) {
flag_cooler_state = true; // used to allow M106 fan control when cooler is disabled flag_cooler_state = true; // used to allow M106 fan control when cooler is disabled
if (temp_cooler.target == 0) temp_cooler.target = COOLER_MINTEMP; if (temp_cooler.target == 0) temp_cooler.target = COOLER_MIN_TARGET;
if (ELAPSED(ms, next_cooler_check_ms)) { if (ELAPSED(ms, next_cooler_check_ms)) {
next_cooler_check_ms = ms + COOLER_CHECK_INTERVAL; next_cooler_check_ms = ms + COOLER_CHECK_INTERVAL;
if (temp_cooler.celsius > temp_cooler.target) { if (temp_cooler.celsius > temp_cooler.target) {

View file

@ -323,7 +323,8 @@ class Temperature {
#if HAS_HOTEND #if HAS_HOTEND
#define HOTEND_TEMPS (HOTENDS + ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)) #define HOTEND_TEMPS (HOTENDS + ENABLED(TEMP_SENSOR_1_AS_REDUNDANT))
static hotend_info_t temp_hotend[HOTEND_TEMPS]; static hotend_info_t temp_hotend[HOTEND_TEMPS];
static const uint16_t heater_maxtemp[HOTENDS]; static const uint16_t hotend_maxtemp[HOTENDS];
FORCE_INLINE static uint16_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
#endif #endif
TERN_(HAS_HEATED_BED, static bed_info_t temp_bed); TERN_(HAS_HEATED_BED, static bed_info_t temp_bed);
TERN_(HAS_TEMP_PROBE, static probe_info_t temp_probe); TERN_(HAS_TEMP_PROBE, static probe_info_t temp_probe);
@ -639,7 +640,7 @@ class Temperature {
start_preheat_time(ee); start_preheat_time(ee);
#endif #endif
TERN_(AUTO_POWER_CONTROL, if (celsius) powerManager.power_on()); TERN_(AUTO_POWER_CONTROL, if (celsius) powerManager.power_on());
temp_hotend[ee].target = _MIN(celsius, temp_range[ee].maxtemp - HOTEND_OVERSHOOT); temp_hotend[ee].target = _MIN(celsius, hotend_max_target(ee));
start_watching_hotend(ee); start_watching_hotend(ee);
} }
@ -785,13 +786,7 @@ class Temperature {
#if HAS_COOLER #if HAS_COOLER
static void setTargetCooler(const int16_t celsius) { static void setTargetCooler(const int16_t celsius) {
temp_cooler.target = temp_cooler.target = constrain(celsius, COOLER_MIN_TARGET, COOLER_MAX_TARGET);
#ifdef COOLER_MAXTEMP
_MIN(celsius, COOLER_MAXTEMP - 10)
#else
celsius
#endif
;
start_watching_cooler(); start_watching_cooler();
} }
#endif #endif
@ -878,7 +873,7 @@ class Temperature {
TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e)); TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e));
#if HAS_LCD_MENU && HAS_TEMPERATURE #if HAS_LCD_MENU && HAS_TEMPERATURE
static void lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb); static void lcd_preheat(const uint8_t e, const int8_t indh, const int8_t indb);
#endif #endif
private: private: