Browse Source

Merge pull request #5315 from thinkyhead/rc_fixup_material_menus

Refine material heatup menu items
Scott Lahteine 8 years ago
parent
commit
32ee3acf86
2 changed files with 64 additions and 48 deletions
  1. 3
    1
      Marlin/macros.h
  2. 61
    47
      Marlin/ultralcd.cpp

+ 3
- 1
Marlin/macros.h View File

126
 
126
 
127
 #define CEILING(x,y) (((x) + (y) - 1) / (y))
127
 #define CEILING(x,y) (((x) + (y) - 1) / (y))
128
 
128
 
129
+#define MIN3(a, b, c)    min(min(a, b), c)
130
+#define MIN4(a, b, c, d) min(min(a, b), min(c, d))
129
 #define MAX3(a, b, c)    max(max(a, b), c)
131
 #define MAX3(a, b, c)    max(max(a, b), c)
130
-#define MAX4(a, b, c, d) max(max(max(a, b), c), d)
132
+#define MAX4(a, b, c, d) max(max(a, b), max(c, d))
131
 
133
 
132
 #define UNEAR_ZERO(x) ((x) < 0.000001)
134
 #define UNEAR_ZERO(x) ((x) < 0.000001)
133
 #define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001)
135
 #define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001)

+ 61
- 47
Marlin/ultralcd.cpp View File

118
   void lcd_move_menu();
118
   void lcd_move_menu();
119
   void lcd_control_menu();
119
   void lcd_control_menu();
120
   void lcd_control_temperature_menu();
120
   void lcd_control_temperature_menu();
121
-  void lcd_control_temperature_preheat_pla_settings_menu();
122
-  void lcd_control_temperature_preheat_abs_settings_menu();
121
+  void lcd_control_temperature_preheat_material1_settings_menu();
122
+  void lcd_control_temperature_preheat_material2_settings_menu();
123
   void lcd_control_motion_menu();
123
   void lcd_control_motion_menu();
124
   void lcd_control_volumetric_menu();
124
   void lcd_control_volumetric_menu();
125
 
125
 
898
     }
898
     }
899
   #endif
899
   #endif
900
 
900
 
901
+  constexpr int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
902
+
901
   /**
903
   /**
902
    *
904
    *
903
    * "Prepare" submenu items
905
    * "Prepare" submenu items
904
    *
906
    *
905
    */
907
    */
906
   void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
908
   void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
907
-    if (temph > 0) thermalManager.setTargetHotend(temph, endnum);
909
+    if (temph > 0) thermalManager.setTargetHotend(min(heater_maxtemp[endnum], temph), endnum);
908
     #if TEMP_SENSOR_BED != 0
910
     #if TEMP_SENSOR_BED != 0
909
       thermalManager.setTargetBed(tempb);
911
       thermalManager.setTargetBed(tempb);
910
     #else
912
     #else
923
   }
925
   }
924
 
926
 
925
   #if TEMP_SENSOR_0 != 0
927
   #if TEMP_SENSOR_0 != 0
926
-    void lcd_preheat_pla0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
927
-    void lcd_preheat_abs0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
928
+    void lcd_preheat_material1_hotend0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
929
+    void lcd_preheat_material2_hotend0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
928
   #endif
930
   #endif
929
 
931
 
930
   #if HOTENDS > 1
932
   #if HOTENDS > 1
931
-    void lcd_preheat_pla1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
932
-    void lcd_preheat_abs1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
933
+    void lcd_preheat_material1_hotend1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
934
+    void lcd_preheat_material2_hotend1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
933
     #if HOTENDS > 2
935
     #if HOTENDS > 2
934
-      void lcd_preheat_pla2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
935
-      void lcd_preheat_abs2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
936
+      void lcd_preheat_material1_hotend2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
937
+      void lcd_preheat_material2_hotend2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
936
       #if HOTENDS > 3
938
       #if HOTENDS > 3
937
-        void lcd_preheat_pla3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
938
-        void lcd_preheat_abs3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
939
+        void lcd_preheat_material1_hotend3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
940
+        void lcd_preheat_material2_hotend3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
939
       #endif
941
       #endif
940
     #endif
942
     #endif
941
 
943
 
942
-    void lcd_preheat_pla0123() {
944
+    void lcd_preheat_material1_hotend0123() {
943
       #if HOTENDS > 1
945
       #if HOTENDS > 1
944
         thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 1);
946
         thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 1);
945
         #if HOTENDS > 2
947
         #if HOTENDS > 2
949
           #endif
951
           #endif
950
         #endif
952
         #endif
951
       #endif
953
       #endif
952
-      lcd_preheat_pla0();
954
+      lcd_preheat_material1_hotend0();
953
     }
955
     }
954
-    void lcd_preheat_abs0123() {
956
+    void lcd_preheat_material2_hotend0123() {
955
       #if HOTENDS > 1
957
       #if HOTENDS > 1
956
         thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 1);
958
         thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 1);
957
         #if HOTENDS > 2
959
         #if HOTENDS > 2
961
           #endif
963
           #endif
962
         #endif
964
         #endif
963
       #endif
965
       #endif
964
-      lcd_preheat_abs0();
966
+      lcd_preheat_material2_hotend0();
965
     }
967
     }
966
 
968
 
967
   #endif // HOTENDS > 1
969
   #endif // HOTENDS > 1
968
 
970
 
969
   #if TEMP_SENSOR_BED != 0
971
   #if TEMP_SENSOR_BED != 0
970
-    void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
971
-    void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
972
+    void lcd_preheat_material1_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
973
+    void lcd_preheat_material2_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
972
   #endif
974
   #endif
973
 
975
 
974
   #if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0)
976
   #if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0)
975
 
977
 
976
-    void lcd_preheat_pla_menu() {
978
+    void lcd_preheat_material1_menu() {
977
       START_MENU();
979
       START_MENU();
978
       MENU_BACK(MSG_PREPARE);
980
       MENU_BACK(MSG_PREPARE);
979
       #if HOTENDS == 1
981
       #if HOTENDS == 1
980
-        MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_pla0);
982
+        MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_material1_hotend0);
981
       #else
983
       #else
982
-        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_pla0);
983
-        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_pla1);
984
+        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_material1_hotend0);
985
+        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_material1_hotend1);
984
         #if HOTENDS > 2
986
         #if HOTENDS > 2
985
-          MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_pla2);
987
+          MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_material1_hotend2);
986
           #if HOTENDS > 3
988
           #if HOTENDS > 3
987
-            MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_pla3);
989
+            MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_material1_hotend3);
988
           #endif
990
           #endif
989
         #endif
991
         #endif
990
-        MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_pla0123);
992
+        MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_material1_hotend0123);
991
       #endif
993
       #endif
992
       #if TEMP_SENSOR_BED != 0
994
       #if TEMP_SENSOR_BED != 0
993
-        MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_pla_bedonly);
995
+        MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_material1_bedonly);
994
       #endif
996
       #endif
995
       END_MENU();
997
       END_MENU();
996
     }
998
     }
997
 
999
 
998
-    void lcd_preheat_abs_menu() {
1000
+    void lcd_preheat_material2_menu() {
999
       START_MENU();
1001
       START_MENU();
1000
       MENU_BACK(MSG_PREPARE);
1002
       MENU_BACK(MSG_PREPARE);
1001
       #if HOTENDS == 1
1003
       #if HOTENDS == 1
1002
-        MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_abs0);
1004
+        MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_material2_hotend0);
1003
       #else
1005
       #else
1004
-        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_abs0);
1005
-        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_abs1);
1006
+        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_material2_hotend0);
1007
+        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_material2_hotend1);
1006
         #if HOTENDS > 2
1008
         #if HOTENDS > 2
1007
-          MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_abs2);
1009
+          MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_material2_hotend2);
1008
           #if HOTENDS > 3
1010
           #if HOTENDS > 3
1009
-            MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_abs3);
1011
+            MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_material2_hotend3);
1010
           #endif
1012
           #endif
1011
         #endif
1013
         #endif
1012
-        MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_abs0123);
1014
+        MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_material2_hotend0123);
1013
       #endif
1015
       #endif
1014
       #if TEMP_SENSOR_BED != 0
1016
       #if TEMP_SENSOR_BED != 0
1015
-        MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_abs_bedonly);
1017
+        MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_material2_bedonly);
1016
       #endif
1018
       #endif
1017
       END_MENU();
1019
       END_MENU();
1018
     }
1020
     }
1288
     //
1290
     //
1289
     #if TEMP_SENSOR_0 != 0
1291
     #if TEMP_SENSOR_0 != 0
1290
       #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0
1292
       #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0
1291
-        MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_pla_menu);
1292
-        MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_abs_menu);
1293
+        MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_material1_menu);
1294
+        MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_material2_menu);
1293
       #else
1295
       #else
1294
-        MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_pla0);
1295
-        MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_abs0);
1296
+        MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_material1_hotend0);
1297
+        MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_material2_hotend0);
1296
       #endif
1298
       #endif
1297
     #endif
1299
     #endif
1298
 
1300
 
1598
 
1600
 
1599
     #if ENABLED(PIDTEMP)
1601
     #if ENABLED(PIDTEMP)
1600
       int autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150);
1602
       int autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150);
1601
-      const int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
1602
     #endif
1603
     #endif
1603
 
1604
 
1604
     #if ENABLED(PIDTEMPBED)
1605
     #if ENABLED(PIDTEMPBED)
1791
     #endif //PIDTEMP
1792
     #endif //PIDTEMP
1792
 
1793
 
1793
     //
1794
     //
1794
-    // Preheat PLA conf
1795
+    // Preheat Material 1 conf
1795
     //
1796
     //
1796
-    MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
1797
+    MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_control_temperature_preheat_material1_settings_menu);
1797
 
1798
 
1798
     //
1799
     //
1799
-    // Preheat ABS conf
1800
+    // Preheat Material 2 conf
1800
     //
1801
     //
1801
-    MENU_ITEM(submenu, MSG_PREHEAT_2_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
1802
+    MENU_ITEM(submenu, MSG_PREHEAT_2_SETTINGS, lcd_control_temperature_preheat_material2_settings_menu);
1802
     END_MENU();
1803
     END_MENU();
1803
   }
1804
   }
1804
 
1805
 
1805
   void _lcd_control_temperature_preheat_settings_menu(uint8_t material) {
1806
   void _lcd_control_temperature_preheat_settings_menu(uint8_t material) {
1807
+    #if HOTENDS > 3
1808
+      #define MINTEMP_ALL MIN4(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP)
1809
+      #define MAXTEMP_ALL MAX4(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP)
1810
+    #elif HOTENDS > 2
1811
+      #define MINTEMP_ALL MIN3(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP)
1812
+      #define MAXTEMP_ALL MAX3(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP)
1813
+    #elif HOTENDS > 1
1814
+      #define MINTEMP_ALL min(HEATER_0_MINTEMP, HEATER_1_MINTEMP)
1815
+      #define MAXTEMP_ALL max(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP)
1816
+    #else
1817
+      #define MINTEMP_ALL HEATER_0_MINTEMP
1818
+      #define MAXTEMP_ALL HEATER_0_MAXTEMP
1819
+    #endif
1806
     START_MENU();
1820
     START_MENU();
1807
     MENU_BACK(MSG_TEMPERATURE);
1821
     MENU_BACK(MSG_TEMPERATURE);
1808
     MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &lcd_preheat_fan_speed[material], 0, 255);
1822
     MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &lcd_preheat_fan_speed[material], 0, 255);
1809
     #if TEMP_SENSOR_0 != 0
1823
     #if TEMP_SENSOR_0 != 0
1810
-      MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], HEATER_0_MINTEMP, HEATER_0_MAXTEMP - 15);
1824
+      MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15);
1811
     #endif
1825
     #endif
1812
     #if TEMP_SENSOR_BED != 0
1826
     #if TEMP_SENSOR_BED != 0
1813
       MENU_ITEM_EDIT(int3, MSG_BED, &lcd_preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15);
1827
       MENU_ITEM_EDIT(int3, MSG_BED, &lcd_preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15);
1820
 
1834
 
1821
   /**
1835
   /**
1822
    *
1836
    *
1823
-   * "Temperature" > "Preheat PLA conf" submenu
1837
+   * "Temperature" > "Preheat Material 1 conf" submenu
1824
    *
1838
    *
1825
    */
1839
    */
1826
-  void lcd_control_temperature_preheat_pla_settings_menu() { _lcd_control_temperature_preheat_settings_menu(0); }
1840
+  void lcd_control_temperature_preheat_material1_settings_menu() { _lcd_control_temperature_preheat_settings_menu(0); }
1827
 
1841
 
1828
   /**
1842
   /**
1829
    *
1843
    *
1830
-   * "Temperature" > "Preheat ABS conf" submenu
1844
+   * "Temperature" > "Preheat Material 2 conf" submenu
1831
    *
1845
    *
1832
    */
1846
    */
1833
-  void lcd_control_temperature_preheat_abs_settings_menu() { _lcd_control_temperature_preheat_settings_menu(1); }
1847
+  void lcd_control_temperature_preheat_material2_settings_menu() { _lcd_control_temperature_preheat_settings_menu(1); }
1834
 
1848
 
1835
   void _reset_acceleration_rates() { planner.reset_acceleration_rates(); }
1849
   void _reset_acceleration_rates() { planner.reset_acceleration_rates(); }
1836
   void _planner_refresh_positioning() { planner.refresh_positioning(); }
1850
   void _planner_refresh_positioning() { planner.refresh_positioning(); }

Loading…
Cancel
Save