Browse Source

Move Temperature Menu to its own file

Scott Lahteine 6 years ago
parent
commit
423ab029b2
2 changed files with 384 additions and 346 deletions
  1. 0
    346
      Marlin/src/lcd/menu/menu.cpp
  2. 384
    0
      Marlin/src/lcd/menu/menu_temperature.cpp

+ 0
- 346
Marlin/src/lcd/menu/menu.cpp View File

@@ -654,261 +654,6 @@ void watch_temp_callback_bed() {
654 654
   #endif
655 655
 }
656 656
 
657
-/**
658
- *
659
- * "Temperature" submenu items
660
- *
661
- */
662
-void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const uint8_t fan) {
663
-  if (temph > 0) thermalManager.setTargetHotend(MIN(heater_maxtemp[endnum], temph), endnum);
664
-  #if HAS_HEATED_BED
665
-    if (tempb >= 0) thermalManager.setTargetBed(tempb);
666
-  #else
667
-    UNUSED(tempb);
668
-  #endif
669
-  #if FAN_COUNT > 0
670
-    #if FAN_COUNT > 1
671
-      fan_speed[active_extruder < FAN_COUNT ? active_extruder : 0] = fan;
672
-    #else
673
-      fan_speed[0] = fan;
674
-    #endif
675
-  #else
676
-    UNUSED(fan);
677
-  #endif
678
-  lcd_return_to_status();
679
-}
680
-
681
-#if HAS_TEMP_HOTEND
682
-  void lcd_preheat_m1_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
683
-  void lcd_preheat_m2_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
684
-  #if HAS_HEATED_BED
685
-    void lcd_preheat_m1_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
686
-    void lcd_preheat_m2_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
687
-  #endif
688
-#endif
689
-
690
-#if HOTENDS > 1
691
-  void lcd_preheat_m1_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
692
-  void lcd_preheat_m2_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
693
-  #if HAS_HEATED_BED
694
-    void lcd_preheat_m1_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
695
-    void lcd_preheat_m2_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
696
-  #endif
697
-  #if HOTENDS > 2
698
-    void lcd_preheat_m1_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
699
-    void lcd_preheat_m2_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
700
-    #if HAS_HEATED_BED
701
-      void lcd_preheat_m1_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
702
-      void lcd_preheat_m2_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
703
-    #endif
704
-    #if HOTENDS > 3
705
-      void lcd_preheat_m1_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
706
-      void lcd_preheat_m2_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
707
-      #if HAS_HEATED_BED
708
-        void lcd_preheat_m1_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
709
-        void lcd_preheat_m2_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
710
-      #endif
711
-      #if HOTENDS > 4
712
-        void lcd_preheat_m1_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
713
-        void lcd_preheat_m2_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
714
-        #if HAS_HEATED_BED
715
-          void lcd_preheat_m1_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
716
-          void lcd_preheat_m2_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
717
-        #endif
718
-        #if HOTENDS > 5
719
-          void lcd_preheat_m1_e5_only() { _lcd_preheat(5, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
720
-          void lcd_preheat_m2_e5_only() { _lcd_preheat(5, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
721
-          #if HAS_HEATED_BED
722
-            void lcd_preheat_m1_e5() { _lcd_preheat(5, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
723
-            void lcd_preheat_m2_e5() { _lcd_preheat(5, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
724
-          #endif
725
-        #endif // HOTENDS > 5
726
-      #endif // HOTENDS > 4
727
-    #endif // HOTENDS > 3
728
-  #endif // HOTENDS > 2
729
-
730
-  void lcd_preheat_m1_all() {
731
-    #if HOTENDS > 1
732
-      thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 1);
733
-      #if HOTENDS > 2
734
-        thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 2);
735
-        #if HOTENDS > 3
736
-          thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 3);
737
-          #if HOTENDS > 4
738
-            thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 4);
739
-            #if HOTENDS > 5
740
-              thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 5);
741
-            #endif // HOTENDS > 5
742
-          #endif // HOTENDS > 4
743
-        #endif // HOTENDS > 3
744
-      #endif // HOTENDS > 2
745
-    #endif // HOTENDS > 1
746
-    #if HAS_HEATED_BED
747
-      lcd_preheat_m1_e0();
748
-    #else
749
-      lcd_preheat_m1_e0_only();
750
-    #endif
751
-  }
752
-  void lcd_preheat_m2_all() {
753
-    #if HOTENDS > 1
754
-      thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 1);
755
-      #if HOTENDS > 2
756
-        thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 2);
757
-        #if HOTENDS > 3
758
-          thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 3);
759
-          #if HOTENDS > 4
760
-            thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 4);
761
-            #if HOTENDS > 5
762
-              thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 5);
763
-            #endif // HOTENDS > 5
764
-          #endif // HOTENDS > 4
765
-        #endif // HOTENDS > 3
766
-      #endif // HOTENDS > 2
767
-    #endif // HOTENDS > 1
768
-    #if HAS_HEATED_BED
769
-      lcd_preheat_m2_e0();
770
-    #else
771
-      lcd_preheat_m2_e0_only();
772
-    #endif
773
-  }
774
-
775
-#endif // HOTENDS > 1
776
-
777
-#if HAS_HEATED_BED
778
-  void lcd_preheat_m1_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
779
-  void lcd_preheat_m2_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
780
-#endif
781
-
782
-#if HAS_TEMP_HOTEND || HAS_HEATED_BED
783
-
784
-  void menu_preheat_m1() {
785
-    START_MENU();
786
-    MENU_BACK(MSG_TEMPERATURE);
787
-    #if HOTENDS == 1
788
-      #if HAS_HEATED_BED
789
-        MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0);
790
-        MENU_ITEM(function, MSG_PREHEAT_1_END, lcd_preheat_m1_e0_only);
791
-      #else
792
-        MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only);
793
-      #endif
794
-    #elif HOTENDS > 1
795
-      #if HAS_HEATED_BED
796
-        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0);
797
-        MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E1, lcd_preheat_m1_e0_only);
798
-        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1);
799
-        MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E2, lcd_preheat_m1_e1_only);
800
-      #else
801
-        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0_only);
802
-        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1_only);
803
-      #endif
804
-      #if HOTENDS > 2
805
-        #if HAS_HEATED_BED
806
-          MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2);
807
-          MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E3, lcd_preheat_m1_e2_only);
808
-        #else
809
-          MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2_only);
810
-        #endif
811
-        #if HOTENDS > 3
812
-          #if HAS_HEATED_BED
813
-            MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3);
814
-            MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E4, lcd_preheat_m1_e3_only);
815
-          #else
816
-            MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3_only);
817
-          #endif
818
-          #if HOTENDS > 4
819
-            #if HAS_HEATED_BED
820
-              MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4);
821
-              MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E5, lcd_preheat_m1_e4_only);
822
-            #else
823
-              MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4_only);
824
-            #endif
825
-            #if HOTENDS > 5
826
-              #if HAS_HEATED_BED
827
-                MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5);
828
-                MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E6, lcd_preheat_m1_e5_only);
829
-              #else
830
-                MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5_only);
831
-              #endif
832
-            #endif // HOTENDS > 5
833
-          #endif // HOTENDS > 4
834
-        #endif // HOTENDS > 3
835
-      #endif // HOTENDS > 2
836
-      MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_m1_all);
837
-    #endif // HOTENDS > 1
838
-    #if HAS_HEATED_BED
839
-      MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_m1_bedonly);
840
-    #endif
841
-    END_MENU();
842
-  }
843
-
844
-  void menu_preheat_m2() {
845
-    START_MENU();
846
-    MENU_BACK(MSG_TEMPERATURE);
847
-    #if HOTENDS == 1
848
-      #if HAS_HEATED_BED
849
-        MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0);
850
-        MENU_ITEM(function, MSG_PREHEAT_2_END, lcd_preheat_m2_e0_only);
851
-      #else
852
-        MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only);
853
-      #endif
854
-    #elif HOTENDS > 1
855
-      #if HAS_HEATED_BED
856
-        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0);
857
-        MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E1, lcd_preheat_m2_e0_only);
858
-        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1);
859
-        MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E2, lcd_preheat_m2_e1_only);
860
-      #else
861
-        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0_only);
862
-        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1_only);
863
-      #endif
864
-      #if HOTENDS > 2
865
-        #if HAS_HEATED_BED
866
-          MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2);
867
-          MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E3, lcd_preheat_m2_e2_only);
868
-        #else
869
-          MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2_only);
870
-        #endif
871
-        #if HOTENDS > 3
872
-          #if HAS_HEATED_BED
873
-            MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3);
874
-            MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E4, lcd_preheat_m2_e3_only);
875
-          #else
876
-            MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3_only);
877
-          #endif
878
-          #if HOTENDS > 4
879
-            #if HAS_HEATED_BED
880
-              MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4);
881
-              MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E5, lcd_preheat_m2_e4_only);
882
-            #else
883
-              MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4_only);
884
-            #endif
885
-            #if HOTENDS > 5
886
-              #if HAS_HEATED_BED
887
-                MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5);
888
-                MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E6, lcd_preheat_m2_e5_only);
889
-              #else
890
-                MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5_only);
891
-              #endif
892
-            #endif // HOTENDS > 5
893
-          #endif // HOTENDS > 4
894
-        #endif // HOTENDS > 3
895
-      #endif // HOTENDS > 2
896
-      MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_m2_all);
897
-    #endif // HOTENDS > 1
898
-    #if HAS_HEATED_BED
899
-      MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_m2_bedonly);
900
-    #endif
901
-    END_MENU();
902
-  }
903
-
904
-#endif // HAS_TEMP_HOTEND || HAS_HEATED_BED
905
-
906
-void lcd_cooldown() {
907
-  zero_fan_speeds();
908
-  thermalManager.disable_all_heaters();
909
-  lcd_return_to_status();
910
-}
911
-
912 657
 #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)
913 658
 
914 659
   void lcd_enqueue_command(const char * const cmd) {
@@ -1442,97 +1187,6 @@ void _lcd_draw_homing() {
1442 1187
 
1443 1188
 /**
1444 1189
  *
1445
- * "Temperature" submenu
1446
- *
1447
- */
1448
-void menu_temperature() {
1449
-  START_MENU();
1450
-  MENU_BACK(MSG_MAIN);
1451
-
1452
-  //
1453
-  // Nozzle:
1454
-  // Nozzle [1-5]:
1455
-  //
1456
-  #if HOTENDS == 1
1457
-    MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
1458
-  #else // HOTENDS > 1
1459
-    MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
1460
-    MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1);
1461
-    #if HOTENDS > 2
1462
-      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2);
1463
-      #if HOTENDS > 3
1464
-        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3);
1465
-        #if HOTENDS > 4
1466
-          MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4);
1467
-          #if HOTENDS > 5
1468
-            MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N6, &thermalManager.target_temperature[5], 0, HEATER_5_MAXTEMP - 15, watch_temp_callback_E5);
1469
-          #endif // HOTENDS > 5
1470
-        #endif // HOTENDS > 4
1471
-      #endif // HOTENDS > 3
1472
-    #endif // HOTENDS > 2
1473
-  #endif // HOTENDS > 1
1474
-
1475
-  //
1476
-  // Bed:
1477
-  //
1478
-  #if HAS_HEATED_BED
1479
-    MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
1480
-  #endif
1481
-
1482
-  //
1483
-  // Fan Speed:
1484
-  //
1485
-  #if FAN_COUNT > 0
1486
-    #if HAS_FAN0
1487
-      MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255);
1488
-      #if ENABLED(EXTRA_FAN_SPEED)
1489
-        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fan_speed[0], 3, 255);
1490
-      #endif
1491
-    #endif
1492
-    #if HAS_FAN1
1493
-      MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255);
1494
-      #if ENABLED(EXTRA_FAN_SPEED)
1495
-        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &new_fan_speed[1], 3, 255);
1496
-      #endif
1497
-    #endif
1498
-    #if HAS_FAN2
1499
-      MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255);
1500
-      #if ENABLED(EXTRA_FAN_SPEED)
1501
-        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &new_fan_speed[2], 3, 255);
1502
-      #endif
1503
-    #endif
1504
-  #endif // FAN_COUNT > 0
1505
-
1506
-  #if HAS_TEMP_HOTEND
1507
-
1508
-    //
1509
-    // Cooldown
1510
-    //
1511
-    bool has_heat = false;
1512
-    HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; }
1513
-    #if HAS_TEMP_BED
1514
-      if (thermalManager.target_temperature_bed) has_heat = true;
1515
-    #endif
1516
-    if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
1517
-
1518
-    //
1519
-    // Preheat for Material 1 and 2
1520
-    //
1521
-    #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || HAS_HEATED_BED
1522
-      MENU_ITEM(submenu, MSG_PREHEAT_1, menu_preheat_m1);
1523
-      MENU_ITEM(submenu, MSG_PREHEAT_2, menu_preheat_m2);
1524
-    #else
1525
-      MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only);
1526
-      MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only);
1527
-    #endif
1528
-
1529
-  #endif // HAS_TEMP_HOTEND
1530
-
1531
-  END_MENU();
1532
-}
1533
-
1534
-/**
1535
- *
1536 1190
  * "Advanced Settings" -> "Temperature" submenu
1537 1191
  *
1538 1192
  */

+ 384
- 0
Marlin/src/lcd/menu/menu_temperature.cpp View File

@@ -0,0 +1,384 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+//
24
+// Temperature Menu
25
+//
26
+
27
+#include "../../inc/MarlinConfigPre.h"
28
+
29
+#if HAS_LCD_MENU
30
+
31
+#include "menu.h"
32
+#include "../../module/temperature.h"
33
+
34
+#if FAN_COUNT > 1
35
+  #include "../../module/motion.h"
36
+#endif
37
+
38
+//
39
+// "Temperature" submenu items
40
+//
41
+
42
+void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const uint8_t fan) {
43
+  if (temph > 0) thermalManager.setTargetHotend(MIN(heater_maxtemp[endnum], temph), endnum);
44
+  #if HAS_HEATED_BED
45
+    if (tempb >= 0) thermalManager.setTargetBed(tempb);
46
+  #else
47
+    UNUSED(tempb);
48
+  #endif
49
+  #if FAN_COUNT > 0
50
+    #if FAN_COUNT > 1
51
+      fan_speed[active_extruder < FAN_COUNT ? active_extruder : 0] = fan;
52
+    #else
53
+      fan_speed[0] = fan;
54
+    #endif
55
+  #else
56
+    UNUSED(fan);
57
+  #endif
58
+  lcd_return_to_status();
59
+}
60
+
61
+#if HOTENDS > 1
62
+
63
+  void lcd_preheat_m1_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
64
+  void lcd_preheat_m2_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
65
+  #if HAS_HEATED_BED
66
+    void lcd_preheat_m1_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
67
+    void lcd_preheat_m2_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
68
+  #endif
69
+  #if HOTENDS > 2
70
+    void lcd_preheat_m1_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
71
+    void lcd_preheat_m2_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
72
+    #if HAS_HEATED_BED
73
+      void lcd_preheat_m1_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
74
+      void lcd_preheat_m2_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
75
+    #endif
76
+    #if HOTENDS > 3
77
+      void lcd_preheat_m1_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
78
+      void lcd_preheat_m2_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
79
+      #if HAS_HEATED_BED
80
+        void lcd_preheat_m1_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
81
+        void lcd_preheat_m2_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
82
+      #endif
83
+      #if HOTENDS > 4
84
+        void lcd_preheat_m1_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
85
+        void lcd_preheat_m2_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
86
+        #if HAS_HEATED_BED
87
+          void lcd_preheat_m1_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
88
+          void lcd_preheat_m2_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
89
+        #endif
90
+        #if HOTENDS > 5
91
+          void lcd_preheat_m1_e5_only() { _lcd_preheat(5, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
92
+          void lcd_preheat_m2_e5_only() { _lcd_preheat(5, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
93
+          #if HAS_HEATED_BED
94
+            void lcd_preheat_m1_e5() { _lcd_preheat(5, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
95
+            void lcd_preheat_m2_e5() { _lcd_preheat(5, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
96
+          #endif
97
+        #endif // HOTENDS > 5
98
+      #endif // HOTENDS > 4
99
+    #endif // HOTENDS > 3
100
+  #endif // HOTENDS > 2
101
+
102
+  #if HAS_HEATED_BED
103
+    void lcd_preheat_m1_e0();
104
+    void lcd_preheat_m2_e0();
105
+  #else
106
+    void lcd_preheat_m1_e0_only();
107
+    void lcd_preheat_m2_e0_only();
108
+  #endif
109
+
110
+  void lcd_preheat_m1_all() {
111
+    #if HOTENDS > 1
112
+      thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 1);
113
+      #if HOTENDS > 2
114
+        thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 2);
115
+        #if HOTENDS > 3
116
+          thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 3);
117
+          #if HOTENDS > 4
118
+            thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 4);
119
+            #if HOTENDS > 5
120
+              thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 5);
121
+            #endif // HOTENDS > 5
122
+          #endif // HOTENDS > 4
123
+        #endif // HOTENDS > 3
124
+      #endif // HOTENDS > 2
125
+    #endif // HOTENDS > 1
126
+    #if HAS_HEATED_BED
127
+      lcd_preheat_m1_e0();
128
+    #else
129
+      lcd_preheat_m1_e0_only();
130
+    #endif
131
+  }
132
+
133
+  void lcd_preheat_m2_all() {
134
+    #if HOTENDS > 1
135
+      thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 1);
136
+      #if HOTENDS > 2
137
+        thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 2);
138
+        #if HOTENDS > 3
139
+          thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 3);
140
+          #if HOTENDS > 4
141
+            thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 4);
142
+            #if HOTENDS > 5
143
+              thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 5);
144
+            #endif // HOTENDS > 5
145
+          #endif // HOTENDS > 4
146
+        #endif // HOTENDS > 3
147
+      #endif // HOTENDS > 2
148
+    #endif // HOTENDS > 1
149
+    #if HAS_HEATED_BED
150
+      lcd_preheat_m2_e0();
151
+    #else
152
+      lcd_preheat_m2_e0_only();
153
+    #endif
154
+  }
155
+
156
+#endif // HOTENDS > 1
157
+
158
+#if HAS_TEMP_HOTEND || HAS_HEATED_BED
159
+
160
+  void lcd_preheat_m1_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); }
161
+  void lcd_preheat_m2_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); }
162
+
163
+  #if HAS_HEATED_BED
164
+    void lcd_preheat_m1_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
165
+    void lcd_preheat_m2_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
166
+    void lcd_preheat_m1_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
167
+    void lcd_preheat_m2_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
168
+  #endif
169
+
170
+  void menu_preheat_m1() {
171
+    START_MENU();
172
+    MENU_BACK(MSG_TEMPERATURE);
173
+    #if HOTENDS == 1
174
+      #if HAS_HEATED_BED
175
+        MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0);
176
+        MENU_ITEM(function, MSG_PREHEAT_1_END, lcd_preheat_m1_e0_only);
177
+      #else
178
+        MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only);
179
+      #endif
180
+    #elif HOTENDS > 1
181
+      #if HAS_HEATED_BED
182
+        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0);
183
+        MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E1, lcd_preheat_m1_e0_only);
184
+        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1);
185
+        MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E2, lcd_preheat_m1_e1_only);
186
+      #else
187
+        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0_only);
188
+        MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1_only);
189
+      #endif
190
+      #if HOTENDS > 2
191
+        #if HAS_HEATED_BED
192
+          MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2);
193
+          MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E3, lcd_preheat_m1_e2_only);
194
+        #else
195
+          MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2_only);
196
+        #endif
197
+        #if HOTENDS > 3
198
+          #if HAS_HEATED_BED
199
+            MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3);
200
+            MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E4, lcd_preheat_m1_e3_only);
201
+          #else
202
+            MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3_only);
203
+          #endif
204
+          #if HOTENDS > 4
205
+            #if HAS_HEATED_BED
206
+              MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4);
207
+              MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E5, lcd_preheat_m1_e4_only);
208
+            #else
209
+              MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4_only);
210
+            #endif
211
+            #if HOTENDS > 5
212
+              #if HAS_HEATED_BED
213
+                MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5);
214
+                MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E6, lcd_preheat_m1_e5_only);
215
+              #else
216
+                MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5_only);
217
+              #endif
218
+            #endif // HOTENDS > 5
219
+          #endif // HOTENDS > 4
220
+        #endif // HOTENDS > 3
221
+      #endif // HOTENDS > 2
222
+      MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_m1_all);
223
+    #endif // HOTENDS > 1
224
+    #if HAS_HEATED_BED
225
+      MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_m1_bedonly);
226
+    #endif
227
+    END_MENU();
228
+  }
229
+
230
+  void menu_preheat_m2() {
231
+    START_MENU();
232
+    MENU_BACK(MSG_TEMPERATURE);
233
+    #if HOTENDS == 1
234
+      #if HAS_HEATED_BED
235
+        MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0);
236
+        MENU_ITEM(function, MSG_PREHEAT_2_END, lcd_preheat_m2_e0_only);
237
+      #else
238
+        MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only);
239
+      #endif
240
+    #elif HOTENDS > 1
241
+      #if HAS_HEATED_BED
242
+        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0);
243
+        MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E1, lcd_preheat_m2_e0_only);
244
+        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1);
245
+        MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E2, lcd_preheat_m2_e1_only);
246
+      #else
247
+        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0_only);
248
+        MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1_only);
249
+      #endif
250
+      #if HOTENDS > 2
251
+        #if HAS_HEATED_BED
252
+          MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2);
253
+          MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E3, lcd_preheat_m2_e2_only);
254
+        #else
255
+          MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2_only);
256
+        #endif
257
+        #if HOTENDS > 3
258
+          #if HAS_HEATED_BED
259
+            MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3);
260
+            MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E4, lcd_preheat_m2_e3_only);
261
+          #else
262
+            MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3_only);
263
+          #endif
264
+          #if HOTENDS > 4
265
+            #if HAS_HEATED_BED
266
+              MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4);
267
+              MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E5, lcd_preheat_m2_e4_only);
268
+            #else
269
+              MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4_only);
270
+            #endif
271
+            #if HOTENDS > 5
272
+              #if HAS_HEATED_BED
273
+                MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5);
274
+                MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E6, lcd_preheat_m2_e5_only);
275
+              #else
276
+                MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5_only);
277
+              #endif
278
+            #endif // HOTENDS > 5
279
+          #endif // HOTENDS > 4
280
+        #endif // HOTENDS > 3
281
+      #endif // HOTENDS > 2
282
+      MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_m2_all);
283
+    #endif // HOTENDS > 1
284
+    #if HAS_HEATED_BED
285
+      MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_m2_bedonly);
286
+    #endif
287
+    END_MENU();
288
+  }
289
+
290
+  void lcd_cooldown() {
291
+    zero_fan_speeds();
292
+    thermalManager.disable_all_heaters();
293
+    lcd_return_to_status();
294
+  }
295
+
296
+#endif // HAS_TEMP_HOTEND || HAS_HEATED_BED
297
+
298
+void menu_temperature() {
299
+  START_MENU();
300
+  MENU_BACK(MSG_MAIN);
301
+
302
+  //
303
+  // Nozzle:
304
+  // Nozzle [1-5]:
305
+  //
306
+  #if HOTENDS == 1
307
+    MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
308
+  #else // HOTENDS > 1
309
+    MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0);
310
+    MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1);
311
+    #if HOTENDS > 2
312
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2);
313
+      #if HOTENDS > 3
314
+        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3);
315
+        #if HOTENDS > 4
316
+          MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4);
317
+          #if HOTENDS > 5
318
+            MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N6, &thermalManager.target_temperature[5], 0, HEATER_5_MAXTEMP - 15, watch_temp_callback_E5);
319
+          #endif // HOTENDS > 5
320
+        #endif // HOTENDS > 4
321
+      #endif // HOTENDS > 3
322
+    #endif // HOTENDS > 2
323
+  #endif // HOTENDS > 1
324
+
325
+  //
326
+  // Bed:
327
+  //
328
+  #if HAS_HEATED_BED
329
+    MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
330
+  #endif
331
+
332
+  //
333
+  // Fan Speed:
334
+  //
335
+  #if FAN_COUNT > 0
336
+    #if HAS_FAN0
337
+      MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255);
338
+      #if ENABLED(EXTRA_FAN_SPEED)
339
+        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fan_speed[0], 3, 255);
340
+      #endif
341
+    #endif
342
+    #if HAS_FAN1
343
+      MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255);
344
+      #if ENABLED(EXTRA_FAN_SPEED)
345
+        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &new_fan_speed[1], 3, 255);
346
+      #endif
347
+    #endif
348
+    #if HAS_FAN2
349
+      MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255);
350
+      #if ENABLED(EXTRA_FAN_SPEED)
351
+        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &new_fan_speed[2], 3, 255);
352
+      #endif
353
+    #endif
354
+  #endif // FAN_COUNT > 0
355
+
356
+  #if HAS_TEMP_HOTEND
357
+
358
+    //
359
+    // Cooldown
360
+    //
361
+    bool has_heat = false;
362
+    HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; }
363
+    #if HAS_TEMP_BED
364
+      if (thermalManager.target_temperature_bed) has_heat = true;
365
+    #endif
366
+    if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
367
+
368
+    //
369
+    // Preheat for Material 1 and 2
370
+    //
371
+    #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || HAS_HEATED_BED
372
+      MENU_ITEM(submenu, MSG_PREHEAT_1, menu_preheat_m1);
373
+      MENU_ITEM(submenu, MSG_PREHEAT_2, menu_preheat_m2);
374
+    #else
375
+      MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only);
376
+      MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only);
377
+    #endif
378
+
379
+  #endif // HAS_TEMP_HOTEND
380
+
381
+  END_MENU();
382
+}
383
+
384
+#endif // HAS_LCD_MENU

Loading…
Cancel
Save