Don't set heater temperature above its maximum

This commit is contained in:
Scott Lahteine 2016-11-28 00:57:36 -06:00
parent c9193e856d
commit 0951d385ce

View file

@ -883,13 +883,15 @@ void kill_screen(const char* lcd_msg) {
} }
#endif #endif
constexpr int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
/** /**
* *
* "Prepare" submenu items * "Prepare" submenu items
* *
*/ */
void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) { void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
if (temph > 0) thermalManager.setTargetHotend(temph, endnum); if (temph > 0) thermalManager.setTargetHotend(min(heater_maxtemp[endnum], temph), endnum);
#if TEMP_SENSOR_BED != 0 #if TEMP_SENSOR_BED != 0
thermalManager.setTargetBed(tempb); thermalManager.setTargetBed(tempb);
#else #else
@ -1583,7 +1585,6 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
int autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150); int autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150);
const int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
#endif #endif
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)