Browse Source

Don't set heater temperature above its maximum

Scott Lahteine 8 years ago
parent
commit
0951d385ce
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      Marlin/ultralcd.cpp

+ 3
- 2
Marlin/ultralcd.cpp View File

@@ -883,13 +883,15 @@ void kill_screen(const char* lcd_msg) {
883 883
     }
884 884
   #endif
885 885
 
886
+  constexpr int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
887
+
886 888
   /**
887 889
    *
888 890
    * "Prepare" submenu items
889 891
    *
890 892
    */
891 893
   void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
892
-    if (temph > 0) thermalManager.setTargetHotend(temph, endnum);
894
+    if (temph > 0) thermalManager.setTargetHotend(min(heater_maxtemp[endnum], temph), endnum);
893 895
     #if TEMP_SENSOR_BED != 0
894 896
       thermalManager.setTargetBed(tempb);
895 897
     #else
@@ -1583,7 +1585,6 @@ void kill_screen(const char* lcd_msg) {
1583 1585
 
1584 1586
     #if ENABLED(PIDTEMP)
1585 1587
       int autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150);
1586
-      const int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
1587 1588
     #endif
1588 1589
 
1589 1590
     #if ENABLED(PIDTEMPBED)

Loading…
Cancel
Save