Browse Source

🎨 Standard material presets behavior

Scott Lahteine 3 years ago
parent
commit
b09038fcc7

+ 113
- 98
Marlin/src/lcd/e3v2/creality/dwin.cpp View File

166
 
166
 
167
 select_t select_page{0}, select_file{0}, select_print{0}, select_prepare{0}
167
 select_t select_page{0}, select_file{0}, select_print{0}, select_prepare{0}
168
        , select_control{0}, select_axis{0}, select_temp{0}, select_motion{0}, select_tune{0}
168
        , select_control{0}, select_axis{0}, select_temp{0}, select_motion{0}, select_tune{0}
169
-       , select_advset{0}, select_PLA{0}, select_ABS{0}
170
-       , select_speed{0}, select_acc{0}, select_jerk{0}, select_step{0}, select_item{0};
169
+       , select_advset{0}, select_speed{0}, select_acc{0}, select_jerk{0}, select_step{0}, select_item{0};
170
+
171
+#if HAS_PREHEAT
172
+  select_t select_PLA{0};
173
+  #if PREHEAT_COUNT > 1
174
+    select_t select_ABS{0};
175
+  #endif
176
+#endif
171
 
177
 
172
 uint8_t index_file     = MROWS,
178
 uint8_t index_file     = MROWS,
173
         index_prepare  = MROWS,
179
         index_prepare  = MROWS,
492
 #define PREPARE_CASE_DISA  2
498
 #define PREPARE_CASE_DISA  2
493
 #define PREPARE_CASE_HOME  3
499
 #define PREPARE_CASE_HOME  3
494
 #define PREPARE_CASE_ZOFF (PREPARE_CASE_HOME + ENABLED(HAS_ZOFFSET_ITEM))
500
 #define PREPARE_CASE_ZOFF (PREPARE_CASE_HOME + ENABLED(HAS_ZOFFSET_ITEM))
495
-#define PREPARE_CASE_PLA  (PREPARE_CASE_ZOFF + ENABLED(HAS_HOTEND))
496
-#define PREPARE_CASE_ABS  (PREPARE_CASE_PLA + ENABLED(HAS_HOTEND))
501
+#define PREPARE_CASE_PLA  (PREPARE_CASE_ZOFF + ENABLED(HAS_PREHEAT))
502
+#define PREPARE_CASE_ABS  (PREPARE_CASE_PLA + (TERN0(HAS_PREHEAT, PREHEAT_COUNT > 1)))
497
 #define PREPARE_CASE_COOL (PREPARE_CASE_ABS + EITHER(HAS_HOTEND, HAS_HEATED_BED))
503
 #define PREPARE_CASE_COOL (PREPARE_CASE_ABS + EITHER(HAS_HOTEND, HAS_HEATED_BED))
498
 #define PREPARE_CASE_LANG (PREPARE_CASE_COOL + 1)
504
 #define PREPARE_CASE_LANG (PREPARE_CASE_COOL + 1)
499
 #define PREPARE_CASE_TOTAL PREPARE_CASE_LANG
505
 #define PREPARE_CASE_TOTAL PREPARE_CASE_LANG
517
 #define TEMP_CASE_TEMP (0 + ENABLED(HAS_HOTEND))
523
 #define TEMP_CASE_TEMP (0 + ENABLED(HAS_HOTEND))
518
 #define TEMP_CASE_BED  (TEMP_CASE_TEMP + ENABLED(HAS_HEATED_BED))
524
 #define TEMP_CASE_BED  (TEMP_CASE_TEMP + ENABLED(HAS_HEATED_BED))
519
 #define TEMP_CASE_FAN  (TEMP_CASE_BED + ENABLED(HAS_FAN))
525
 #define TEMP_CASE_FAN  (TEMP_CASE_BED + ENABLED(HAS_FAN))
520
-#define TEMP_CASE_PLA  (TEMP_CASE_FAN + ENABLED(HAS_HOTEND))
521
-#define TEMP_CASE_ABS  (TEMP_CASE_PLA + ENABLED(HAS_HOTEND))
526
+#define TEMP_CASE_PLA  (TEMP_CASE_FAN + ENABLED(HAS_PREHEAT))
527
+#define TEMP_CASE_ABS  (TEMP_CASE_PLA + (TERN0(HAS_PREHEAT, PREHEAT_COUNT > 1)))
522
 #define TEMP_CASE_TOTAL TEMP_CASE_ABS
528
 #define TEMP_CASE_TOTAL TEMP_CASE_ABS
523
 
529
 
524
 #define PREHEAT_CASE_TEMP (0 + ENABLED(HAS_HOTEND))
530
 #define PREHEAT_CASE_TEMP (0 + ENABLED(HAS_HOTEND))
785
     #if PREHEAT_COUNT > 1
791
     #if PREHEAT_COUNT > 1
786
       if (PVISI(PREPARE_CASE_ABS)) Item_Prepare_ABS(PSCROL(PREPARE_CASE_ABS));    // Preheat ABS
792
       if (PVISI(PREPARE_CASE_ABS)) Item_Prepare_ABS(PSCROL(PREPARE_CASE_ABS));    // Preheat ABS
787
     #endif
793
     #endif
794
+  #endif
795
+  #if HAS_HOTEND || HAS_HEATED_BED
788
     if (PVISI(PREPARE_CASE_COOL)) Item_Prepare_Cool(PSCROL(PREPARE_CASE_COOL));   // Cooldown
796
     if (PVISI(PREPARE_CASE_COOL)) Item_Prepare_Cool(PSCROL(PREPARE_CASE_COOL));   // Cooldown
789
   #endif
797
   #endif
790
   if (PVISI(PREPARE_CASE_LANG)) Item_Prepare_Lang(PSCROL(PREPARE_CASE_LANG));     // Language CN/EN
798
   if (PVISI(PREPARE_CASE_LANG)) Item_Prepare_Lang(PSCROL(PREPARE_CASE_LANG));     // Language CN/EN
2664
         // Draw "More" icon for sub-menus
2672
         // Draw "More" icon for sub-menus
2665
         if (index_prepare < 7) Draw_More_Icon(MROWS - index_prepare + 1);
2673
         if (index_prepare < 7) Draw_More_Icon(MROWS - index_prepare + 1);
2666
 
2674
 
2667
-        #if HAS_HOTEND
2675
+        #if PREHEAT_COUNT > 1
2668
           if (index_prepare == PREPARE_CASE_ABS) Item_Prepare_ABS(MROWS);
2676
           if (index_prepare == PREPARE_CASE_ABS) Item_Prepare_ABS(MROWS);
2669
         #endif
2677
         #endif
2670
-        #if HAS_PREHEAT
2678
+        #if HAS_HOTEND || HAS_HEATED_BED
2671
           if (index_prepare == PREPARE_CASE_COOL) Item_Prepare_Cool(MROWS);
2679
           if (index_prepare == PREPARE_CASE_COOL) Item_Prepare_Cool(MROWS);
2672
         #endif
2680
         #endif
2673
         if (index_prepare == PREPARE_CASE_LANG) Item_Prepare_Lang(MROWS);
2681
         if (index_prepare == PREPARE_CASE_LANG) Item_Prepare_Lang(MROWS);
2743
           break;
2751
           break;
2744
       #endif
2752
       #endif
2745
       #if HAS_PREHEAT
2753
       #if HAS_PREHEAT
2746
-        case PREPARE_CASE_PLA:
2747
-          TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0));
2748
-          TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(ui.material_preset[0].bed_temp));
2749
-          TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed));
2750
-          break;
2751
-        case PREPARE_CASE_ABS:
2752
-          TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0));
2753
-          TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(ui.material_preset[1].bed_temp));
2754
-          TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed));
2755
-          break;
2754
+        case PREPARE_CASE_PLA: ui.preheat_all(0); break;
2755
+        #if PREHEAT_COUNT > 1
2756
+          case PREPARE_CASE_ABS: ui.preheat_all(1); break;
2757
+        #endif
2758
+      #endif
2759
+
2760
+      #if HAS_HOTEND || HAS_HEATED_BED
2756
         case PREPARE_CASE_COOL:
2761
         case PREPARE_CASE_COOL:
2757
           TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
2762
           TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
2758
           #if HAS_HOTEND || HAS_HEATED_BED
2763
           #if HAS_HOTEND || HAS_HEATED_BED
2760
           #endif
2765
           #endif
2761
           break;
2766
           break;
2762
       #endif
2767
       #endif
2768
+
2763
       case PREPARE_CASE_LANG:
2769
       case PREPARE_CASE_LANG:
2764
         HMI_ToggleLanguage();
2770
         HMI_ToggleLanguage();
2765
         Draw_Prepare_Menu();
2771
         Draw_Prepare_Menu();
2784
     #if HAS_FAN
2790
     #if HAS_FAN
2785
       Item_AreaCopy(115, 134, 170, 146, TEMP_CASE_FAN);
2791
       Item_AreaCopy(115, 134, 170, 146, TEMP_CASE_FAN);
2786
     #endif
2792
     #endif
2787
-    #if HAS_HOTEND
2793
+    #if HAS_PREHEAT
2788
       Item_AreaCopy(100, 89, 178, 101, TEMP_CASE_PLA);
2794
       Item_AreaCopy(100, 89, 178, 101, TEMP_CASE_PLA);
2789
-      Item_AreaCopy(180, 89, 260, 100, TEMP_CASE_ABS);
2795
+      #if PREHEAT_COUNT > 1
2796
+        Item_AreaCopy(180, 89, 260, 100, TEMP_CASE_ABS);
2797
+      #endif
2790
     #endif
2798
     #endif
2791
   }
2799
   }
2792
   else {
2800
   else {
2805
       #if HAS_FAN
2813
       #if HAS_FAN
2806
         DWIN_Draw_Label(TEMP_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED));
2814
         DWIN_Draw_Label(TEMP_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED));
2807
       #endif
2815
       #endif
2808
-      #if HAS_HOTEND
2816
+      #if HAS_PREHEAT
2809
         DWIN_Draw_Label(TEMP_CASE_PLA, F(PREHEAT_1_LABEL " Preheat Settings"));
2817
         DWIN_Draw_Label(TEMP_CASE_PLA, F(PREHEAT_1_LABEL " Preheat Settings"));
2810
-        DWIN_Draw_Label(TEMP_CASE_ABS, F(PREHEAT_2_LABEL " Preheat Settings"));
2818
+        #if PREHEAT_COUNT > 1
2819
+          DWIN_Draw_Label(TEMP_CASE_ABS, F(PREHEAT_2_LABEL " Preheat Settings"));
2820
+        #endif
2811
       #endif
2821
       #endif
2812
     #else
2822
     #else
2813
       #if HAS_HOTEND
2823
       #if HAS_HOTEND
2814
-        Item_AreaCopy(197, 104, 238, 114, TEMP_CASE_TEMP);    // "Nozzle"
2815
-        Item_AreaCopy(1,  89,  83, 101, TEMP_CASE_TEMP, 44);  // "Temperature"
2824
+        Item_AreaCopy(197, 104, 238, 114, TEMP_CASE_TEMP);      // "Nozzle"
2825
+        Item_AreaCopy(1,  89,  83, 101, TEMP_CASE_TEMP, 44);    // "Temperature"
2816
       #endif
2826
       #endif
2817
       #if HAS_HEATED_BED
2827
       #if HAS_HEATED_BED
2818
-        Item_AreaCopy(240, 104, 264, 114, TEMP_CASE_BED);     // "Bed"
2819
-        Item_AreaCopy(1,  89,  83, 101, TEMP_CASE_BED, 27);   // "Temperature"
2828
+        Item_AreaCopy(240, 104, 264, 114, TEMP_CASE_BED);       // "Bed"
2829
+        Item_AreaCopy(1,  89,  83, 101, TEMP_CASE_BED, 27);     // "Temperature"
2820
       #endif
2830
       #endif
2821
       #if HAS_FAN
2831
       #if HAS_FAN
2822
-        Item_AreaCopy(  1, 119,  61, 132, TEMP_CASE_FAN);     // "Fan speed"
2832
+        Item_AreaCopy(  1, 119,  61, 132, TEMP_CASE_FAN);       // "Fan speed"
2823
       #endif
2833
       #endif
2824
-      #if HAS_HOTEND
2825
-        Item_AreaCopy(107,  76, 156,  86, TEMP_CASE_PLA);     // "Preheat"
2826
-        say_pla_en(52, TEMP_CASE_PLA);                        // "PLA"
2827
-        Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_PLA, 79); // "Settings"
2828
-
2829
-        Item_AreaCopy(107,  76, 156,  86, TEMP_CASE_ABS);     // "Preheat"
2830
-        say_abs_en(52, TEMP_CASE_ABS);                        // "ABS"
2831
-        Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_ABS, 81); // "Settings"
2834
+      #if HAS_PREHEAT
2835
+        Item_AreaCopy(107,  76, 156,  86, TEMP_CASE_PLA);       // "Preheat"
2836
+        say_pla_en(52, TEMP_CASE_PLA);                          // "PLA"
2837
+        Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_PLA, 79);   // "Settings"
2838
+        #if PREHEAT_COUNT > 1
2839
+          Item_AreaCopy(107,  76, 156,  86, TEMP_CASE_ABS);     // "Preheat"
2840
+          say_abs_en(52, TEMP_CASE_ABS);                        // "ABS"
2841
+          Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_ABS, 81); // "Settings"
2842
+        #endif
2832
       #endif
2843
       #endif
2833
     #endif
2844
     #endif
2834
   }
2845
   }
2851
     _TMENU_ICON(TEMP_CASE_FAN);
2862
     _TMENU_ICON(TEMP_CASE_FAN);
2852
     Draw_Edit_Integer3(i, thermalManager.fan_speed[0]);
2863
     Draw_Edit_Integer3(i, thermalManager.fan_speed[0]);
2853
   #endif
2864
   #endif
2854
-  #if HAS_HOTEND
2865
+  #if HAS_PREHEAT
2855
     // PLA/ABS items have submenus
2866
     // PLA/ABS items have submenus
2856
-    _TMENU_ICON(TEMP_CASE_PLA);
2857
-    Draw_More_Icon(i);
2858
-    _TMENU_ICON(TEMP_CASE_ABS);
2859
-    Draw_More_Icon(i);
2867
+    _TMENU_ICON(TEMP_CASE_PLA); Draw_More_Icon(i);
2868
+    #if PREHEAT_COUNT > 1
2869
+      _TMENU_ICON(TEMP_CASE_ABS); Draw_More_Icon(i);
2870
+    #endif
2860
   #endif
2871
   #endif
2861
 }
2872
 }
2862
 
2873
 
3076
           EncoderRate.enabled = true;
3087
           EncoderRate.enabled = true;
3077
           break;
3088
           break;
3078
       #endif
3089
       #endif
3090
+
3079
       #if HAS_PREHEAT
3091
       #if HAS_PREHEAT
3080
         case TEMP_CASE_PLA: {
3092
         case TEMP_CASE_PLA: {
3081
           checkkey = PLAPreheat;
3093
           checkkey = PLAPreheat;
3153
             Draw_Menu_Line(++i, ICON_WriteEEPROM);
3165
             Draw_Menu_Line(++i, ICON_WriteEEPROM);
3154
           #endif
3166
           #endif
3155
         } break;
3167
         } break;
3156
-      #endif
3168
+      #endif // HAS_PREHEAT
3169
+
3157
       #if PREHEAT_COUNT > 1
3170
       #if PREHEAT_COUNT > 1
3158
         case TEMP_CASE_ABS: { // ABS preheat setting
3171
         case TEMP_CASE_ABS: { // ABS preheat setting
3159
           checkkey = ABSPreheat;
3172
           checkkey = ABSPreheat;
3236
 
3249
 
3237
         } break;
3250
         } break;
3238
 
3251
 
3239
-      #endif // HAS_HOTEND
3252
+      #endif // PREHEAT_COUNT > 1
3240
     }
3253
     }
3241
   }
3254
   }
3242
   DWIN_UpdateLCD();
3255
   DWIN_UpdateLCD();
3579
 
3592
 
3580
       #if HAS_HOTEND
3593
       #if HAS_HOTEND
3581
         case ADVSET_CASE_HEPID:
3594
         case ADVSET_CASE_HEPID:
3582
-          thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0);
3583
           thermalManager.PID_autotune(ui.material_preset[0].hotend_temp, H_E0, 10, true);
3595
           thermalManager.PID_autotune(ui.material_preset[0].hotend_temp, H_E0, 10, true);
3584
           break;
3596
           break;
3585
       #endif
3597
       #endif
3586
 
3598
 
3587
       #if HAS_HEATED_BED
3599
       #if HAS_HEATED_BED
3588
         case ADVSET_CASE_BEDPID:
3600
         case ADVSET_CASE_BEDPID:
3589
-          thermalManager.setTargetBed(ui.material_preset[0].bed_temp);
3590
           thermalManager.PID_autotune(ui.material_preset[0].bed_temp, H_BED, 10, true);
3601
           thermalManager.PID_autotune(ui.material_preset[0].bed_temp, H_BED, 10, true);
3591
           break;
3602
           break;
3592
       #endif
3603
       #endif
3881
     DWIN_UpdateLCD();
3892
     DWIN_UpdateLCD();
3882
   }
3893
   }
3883
 
3894
 
3884
-  // ABS Preheat
3885
-  void HMI_ABSPreheatSetting() {
3886
-    EncoderState encoder_diffState = get_encoder_state();
3887
-    if (encoder_diffState == ENCODER_DIFF_NO) return;
3888
-
3889
-    // Avoid flicker by updating only the previous menu
3890
-    if (encoder_diffState == ENCODER_DIFF_CW) {
3891
-      if (select_ABS.inc(1 + PREHEAT_CASE_TOTAL)) Move_Highlight(1, select_ABS.now);
3892
-    }
3893
-    else if (encoder_diffState == ENCODER_DIFF_CCW) {
3894
-      if (select_ABS.dec()) Move_Highlight(-1, select_ABS.now);
3895
-    }
3896
-    else if (encoder_diffState == ENCODER_DIFF_ENTER) {
3897
-      switch (select_ABS.now) {
3898
-        case CASE_BACK:
3899
-          checkkey = TemperatureID;
3900
-          select_temp.now = TEMP_CASE_ABS;
3901
-          HMI_ValueStruct.show_mode = -1;
3902
-          Draw_Temperature_Menu();
3903
-          break;
3904
-        #if HAS_HOTEND
3905
-          case PREHEAT_CASE_TEMP:
3906
-            checkkey = ETemp;
3907
-            HMI_ValueStruct.E_Temp = ui.material_preset[1].hotend_temp;
3908
-            Draw_Edit_Integer3(PREHEAT_CASE_TEMP, ui.material_preset[1].hotend_temp, true);
3909
-            EncoderRate.enabled = true;
3910
-            break;
3911
-        #endif
3912
-        #if HAS_HEATED_BED
3913
-          case PREHEAT_CASE_BED:
3914
-            checkkey = BedTemp;
3915
-            HMI_ValueStruct.Bed_Temp = ui.material_preset[1].bed_temp;
3916
-            Draw_Edit_Integer3(PREHEAT_CASE_BED, ui.material_preset[1].bed_temp, true);
3917
-            EncoderRate.enabled = true;
3918
-            break;
3919
-        #endif
3920
-        #if HAS_FAN
3921
-          case PREHEAT_CASE_FAN:
3922
-            checkkey = FanSpeed;
3923
-            HMI_ValueStruct.Fan_speed = ui.material_preset[1].fan_speed;
3924
-            Draw_Edit_Integer3(PREHEAT_CASE_FAN, ui.material_preset[1].fan_speed, true);
3925
-            EncoderRate.enabled = true;
3895
+  #if PREHEAT_COUNT > 1
3896
+    // ABS Preheat
3897
+    void HMI_ABSPreheatSetting() {
3898
+      EncoderState encoder_diffState = get_encoder_state();
3899
+      if (encoder_diffState == ENCODER_DIFF_NO) return;
3900
+
3901
+      // Avoid flicker by updating only the previous menu
3902
+      if (encoder_diffState == ENCODER_DIFF_CW) {
3903
+        if (select_ABS.inc(1 + PREHEAT_CASE_TOTAL)) Move_Highlight(1, select_ABS.now);
3904
+      }
3905
+      else if (encoder_diffState == ENCODER_DIFF_CCW) {
3906
+        if (select_ABS.dec()) Move_Highlight(-1, select_ABS.now);
3907
+      }
3908
+      else if (encoder_diffState == ENCODER_DIFF_ENTER) {
3909
+        switch (select_ABS.now) {
3910
+          case CASE_BACK:
3911
+            checkkey = TemperatureID;
3912
+            select_temp.now = TEMP_CASE_ABS;
3913
+            HMI_ValueStruct.show_mode = -1;
3914
+            Draw_Temperature_Menu();
3926
             break;
3915
             break;
3927
-        #endif
3928
-        #if ENABLED(EEPROM_SETTINGS)
3929
-          case PREHEAT_CASE_SAVE: {
3930
-            const bool success = settings.save();
3931
-            HMI_AudioFeedback(success);
3932
-          } break;
3933
-        #endif
3934
-        default: break;
3916
+          #if HAS_HOTEND
3917
+            case PREHEAT_CASE_TEMP:
3918
+              checkkey = ETemp;
3919
+              HMI_ValueStruct.E_Temp = ui.material_preset[1].hotend_temp;
3920
+              Draw_Edit_Integer3(PREHEAT_CASE_TEMP, ui.material_preset[1].hotend_temp, true);
3921
+              EncoderRate.enabled = true;
3922
+              break;
3923
+          #endif
3924
+          #if HAS_HEATED_BED
3925
+            case PREHEAT_CASE_BED:
3926
+              checkkey = BedTemp;
3927
+              HMI_ValueStruct.Bed_Temp = ui.material_preset[1].bed_temp;
3928
+              Draw_Edit_Integer3(PREHEAT_CASE_BED, ui.material_preset[1].bed_temp, true);
3929
+              EncoderRate.enabled = true;
3930
+              break;
3931
+          #endif
3932
+          #if HAS_FAN
3933
+            case PREHEAT_CASE_FAN:
3934
+              checkkey = FanSpeed;
3935
+              HMI_ValueStruct.Fan_speed = ui.material_preset[1].fan_speed;
3936
+              Draw_Edit_Integer3(PREHEAT_CASE_FAN, ui.material_preset[1].fan_speed, true);
3937
+              EncoderRate.enabled = true;
3938
+              break;
3939
+          #endif
3940
+          #if ENABLED(EEPROM_SETTINGS)
3941
+            case PREHEAT_CASE_SAVE: {
3942
+              const bool success = settings.save();
3943
+              HMI_AudioFeedback(success);
3944
+            } break;
3945
+          #endif
3946
+          default: break;
3947
+        }
3935
       }
3948
       }
3949
+      DWIN_UpdateLCD();
3936
     }
3950
     }
3937
-    DWIN_UpdateLCD();
3938
-  }
3951
+  #endif // PREHEAT_COUNT > 1
3939
 
3952
 
3940
-#endif
3953
+#endif // HAS_PREHEAT
3941
 
3954
 
3942
 // Max Speed
3955
 // Max Speed
3943
 void HMI_MaxSpeed() {
3956
 void HMI_MaxSpeed() {
4241
     case Tune:            HMI_Tune(); break;
4254
     case Tune:            HMI_Tune(); break;
4242
     #if HAS_PREHEAT
4255
     #if HAS_PREHEAT
4243
       case PLAPreheat:    HMI_PLAPreheatSetting(); break;
4256
       case PLAPreheat:    HMI_PLAPreheatSetting(); break;
4244
-      case ABSPreheat:    HMI_ABSPreheatSetting(); break;
4257
+      #if PREHEAT_COUNT > 1
4258
+        case ABSPreheat:  HMI_ABSPreheatSetting(); break;
4259
+      #endif
4245
     #endif
4260
     #endif
4246
     case MaxSpeed:        HMI_MaxSpeed(); break;
4261
     case MaxSpeed:        HMI_MaxSpeed(); break;
4247
     case MaxAcceleration: HMI_MaxAcceleration(); break;
4262
     case MaxAcceleration: HMI_MaxAcceleration(); break;

+ 6
- 12
Marlin/src/lcd/e3v2/enhanced/dwin.cpp View File

2116
 #endif
2116
 #endif
2117
 
2117
 
2118
 #if HAS_PREHEAT
2118
 #if HAS_PREHEAT
2119
-  void SetPreheat(const uint8_t i) {
2120
-    TERN_(HAS_HOTEND,     thermalManager.setTargetHotend(ui.material_preset[i].hotend_temp, 0));
2121
-    TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(ui.material_preset[i].bed_temp));
2122
-    TERN_(HAS_FAN,        thermalManager.set_fan_speed(0, ui.material_preset[i].fan_speed));
2123
-  }
2124
-  void SetPreheat0() { SetPreheat(0); }
2125
-  void SetPreheat1() { SetPreheat(1); }
2126
-  void SetPreheat2() { SetPreheat(2); }
2127
-
2128
   void SetCoolDown() {
2119
   void SetCoolDown() {
2129
     TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
2120
     TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
2130
     #if HAS_HOTEND || HAS_HEATED_BED
2121
     #if HAS_HOTEND || HAS_HEATED_BED
2131
       thermalManager.disable_all_heaters();
2122
       thermalManager.disable_all_heaters();
2132
     #endif
2123
     #endif
2133
   }
2124
   }
2125
+  void DoPreheat0() { ui.preheat_all(0); }
2126
+  void DoPreheat1() { ui.preheat_all(1); }
2127
+  void DoPreheat2() { ui.preheat_all(2); }
2134
 #endif
2128
 #endif
2135
 
2129
 
2136
 void SetLanguage() {
2130
 void SetLanguage() {
3125
       #endif
3119
       #endif
3126
     #endif
3120
     #endif
3127
     #if HAS_PREHEAT
3121
     #if HAS_PREHEAT
3128
-      ADDMENUITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, SetPreheat0);
3122
+      ADDMENUITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, DoPreheat0);
3129
       #if PREHEAT_COUNT > 1
3123
       #if PREHEAT_COUNT > 1
3130
-        ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, SetPreheat1);
3124
+        ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, DoPreheat1);
3131
       #endif
3125
       #endif
3132
       #if PREHEAT_COUNT > 2
3126
       #if PREHEAT_COUNT > 2
3133
-        ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2);
3127
+        ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, DoPreheat2);
3134
       #endif
3128
       #endif
3135
       ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown);
3129
       ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown);
3136
     #endif
3130
     #endif

+ 31
- 79
Marlin/src/lcd/e3v2/jyersui/dwin.cpp View File

1584
         }
1584
         }
1585
         break;
1585
         break;
1586
     #endif
1586
     #endif
1587
-    #if HAS_PREHEAT
1588
-      case Preheat:
1589
 
1587
 
1588
+    #if HAS_PREHEAT
1589
+      case Preheat: {
1590
         #define PREHEAT_BACK 0
1590
         #define PREHEAT_BACK 0
1591
         #define PREHEAT_MODE (PREHEAT_BACK + 1)
1591
         #define PREHEAT_MODE (PREHEAT_BACK + 1)
1592
         #define PREHEAT_1 (PREHEAT_MODE + 1)
1592
         #define PREHEAT_1 (PREHEAT_MODE + 1)
1596
         #define PREHEAT_5 (PREHEAT_4 + (PREHEAT_COUNT >= 5))
1596
         #define PREHEAT_5 (PREHEAT_4 + (PREHEAT_COUNT >= 5))
1597
         #define PREHEAT_TOTAL PREHEAT_5
1597
         #define PREHEAT_TOTAL PREHEAT_5
1598
 
1598
 
1599
+        auto do_preheat = [](const uint8_t m) {
1600
+          thermalManager.disable_all_heaters();
1601
+          TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
1602
+          if (preheatmode == 0 || preheatmode == 1) { ui.preheat_hotend_and_fan(m); }
1603
+          if (preheatmode == 0 || preheatmode == 2) ui.preheat_bed(m);
1604
+        };
1605
+
1599
         switch (item) {
1606
         switch (item) {
1600
           case PREHEAT_BACK:
1607
           case PREHEAT_BACK:
1601
             if (draw)
1608
             if (draw)
1616
             case PREHEAT_1:
1623
             case PREHEAT_1:
1617
               if (draw)
1624
               if (draw)
1618
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_1_LABEL));
1625
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_1_LABEL));
1619
-              else {
1620
-                thermalManager.disable_all_heaters();
1621
-                TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
1622
-                if (preheatmode == 0 || preheatmode == 1) {
1623
-                  TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0));
1624
-                  TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed));
1625
-                }
1626
-                #if HAS_HEATED_BED
1627
-                  if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[0].bed_temp);
1628
-                #endif
1629
-              }
1626
+              else
1627
+                do_preheat(0);
1630
               break;
1628
               break;
1631
           #endif
1629
           #endif
1632
 
1630
 
1634
             case PREHEAT_2:
1632
             case PREHEAT_2:
1635
               if (draw)
1633
               if (draw)
1636
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_2_LABEL));
1634
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_2_LABEL));
1637
-              else {
1638
-                thermalManager.disable_all_heaters();
1639
-                TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
1640
-                if (preheatmode == 0 || preheatmode == 1) {
1641
-                  TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0));
1642
-                  TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed));
1643
-                }
1644
-                #if HAS_HEATED_BED
1645
-                  if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[1].bed_temp);
1646
-                #endif
1647
-              }
1635
+              else
1636
+                do_preheat(1);
1648
               break;
1637
               break;
1649
           #endif
1638
           #endif
1650
 
1639
 
1652
             case PREHEAT_3:
1641
             case PREHEAT_3:
1653
               if (draw)
1642
               if (draw)
1654
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_3_LABEL));
1643
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_3_LABEL));
1655
-              else {
1656
-                thermalManager.disable_all_heaters();
1657
-                TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
1658
-                if (preheatmode == 0 || preheatmode == 1) {
1659
-                  TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[2].hotend_temp, 0));
1660
-                  TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[2].fan_speed));
1661
-                }
1662
-                #if HAS_HEATED_BED
1663
-                  if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[2].bed_temp);
1664
-                #endif
1665
-              }
1644
+              else
1645
+                do_preheat(2);
1666
               break;
1646
               break;
1667
           #endif
1647
           #endif
1668
 
1648
 
1670
             case PREHEAT_4:
1650
             case PREHEAT_4:
1671
               if (draw)
1651
               if (draw)
1672
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_4_LABEL));
1652
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_4_LABEL));
1673
-              else {
1674
-                thermalManager.disable_all_heaters();
1675
-                TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
1676
-                if (preheatmode == 0 || preheatmode == 1) {
1677
-                  TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[3].hotend_temp, 0));
1678
-                  TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[3].fan_speed));
1679
-                }
1680
-                #if HAS_HEATED_BED
1681
-                  if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[3].bed_temp);
1682
-                #endif
1683
-              }
1653
+              else
1654
+                do_preheat(3);
1684
               break;
1655
               break;
1685
           #endif
1656
           #endif
1686
 
1657
 
1688
             case PREHEAT_5:
1659
             case PREHEAT_5:
1689
               if (draw)
1660
               if (draw)
1690
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_5_LABEL));
1661
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_5_LABEL));
1691
-              else {
1692
-                thermalManager.disable_all_heaters();
1693
-                TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
1694
-                if (preheatmode == 0 || preheatmode == 1) {
1695
-                  TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[4].hotend_temp, 0));
1696
-                  TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[4].fan_speed));
1697
-                }
1698
-                #if HAS_HEATED_BED
1699
-                  if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[4].bed_temp);
1700
-                #endif
1701
-              }
1662
+              else
1663
+                do_preheat(4);
1702
               break;
1664
               break;
1703
           #endif
1665
           #endif
1704
         }
1666
         }
1705
-        break;
1706
-    #endif
1667
+      } break;
1668
+    #endif // HAS_PREHEAT
1707
 
1669
 
1708
     #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
1670
     #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
1709
       case ChangeFilament:
1671
       case ChangeFilament:
3964
             case PREHEATHOTEND_1:
3926
             case PREHEATHOTEND_1:
3965
               if (draw)
3927
               if (draw)
3966
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_1_LABEL));
3928
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_1_LABEL));
3967
-              else {
3968
-                thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0);
3969
-                thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed);
3970
-              }
3929
+              else
3930
+                ui.preheat_hotend_and_fan(0);
3971
               break;
3931
               break;
3972
           #endif
3932
           #endif
3973
           #if PREHEAT_COUNT >= 2
3933
           #if PREHEAT_COUNT >= 2
3974
             case PREHEATHOTEND_2:
3934
             case PREHEATHOTEND_2:
3975
               if (draw)
3935
               if (draw)
3976
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_2_LABEL));
3936
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_2_LABEL));
3977
-              else {
3978
-                thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0);
3979
-                thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed);
3980
-              }
3937
+              else
3938
+                ui.preheat_hotend_and_fan(1);
3981
               break;
3939
               break;
3982
           #endif
3940
           #endif
3983
           #if PREHEAT_COUNT >= 3
3941
           #if PREHEAT_COUNT >= 3
3984
             case PREHEATHOTEND_3:
3942
             case PREHEATHOTEND_3:
3985
               if (draw)
3943
               if (draw)
3986
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_3_LABEL));
3944
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_3_LABEL));
3987
-              else {
3988
-                thermalManager.setTargetHotend(ui.material_preset[2].hotend_temp, 0);
3989
-                thermalManager.set_fan_speed(0, ui.material_preset[2].fan_speed);
3990
-              }
3945
+              else
3946
+                ui.preheat_hotend_and_fan(2);
3991
               break;
3947
               break;
3992
           #endif
3948
           #endif
3993
           #if PREHEAT_COUNT >= 4
3949
           #if PREHEAT_COUNT >= 4
3994
             case PREHEATHOTEND_4:
3950
             case PREHEATHOTEND_4:
3995
               if (draw)
3951
               if (draw)
3996
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_4_LABEL));
3952
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_4_LABEL));
3997
-              else {
3998
-                thermalManager.setTargetHotend(ui.material_preset[3].hotend_temp, 0);
3999
-                thermalManager.set_fan_speed(0, ui.material_preset[3].fan_speed);
4000
-              }
3953
+              else
3954
+                ui.preheat_hotend_and_fan(3);
4001
               break;
3955
               break;
4002
           #endif
3956
           #endif
4003
           #if PREHEAT_COUNT >= 5
3957
           #if PREHEAT_COUNT >= 5
4004
             case PREHEATHOTEND_5:
3958
             case PREHEATHOTEND_5:
4005
               if (draw)
3959
               if (draw)
4006
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_5_LABEL));
3960
                 Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_5_LABEL));
4007
-              else {
4008
-                thermalManager.setTargetHotend(ui.material_preset[4].hotend_temp, 0);
4009
-                thermalManager.set_fan_speed(0, ui.material_preset[4].fan_speed);
4010
-              }
3961
+              else
3962
+                ui.preheat_hotend_and_fan(4);
4011
               break;
3963
               break;
4012
           #endif
3964
           #endif
4013
           case PREHEATHOTEND_CUSTOM:
3965
           case PREHEATHOTEND_CUSTOM:

+ 9
- 45
Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp View File

621
   void DGUSScreenHandler::HandlePreheat(DGUS_VP_Variable &var, void *val_ptr) {
621
   void DGUSScreenHandler::HandlePreheat(DGUS_VP_Variable &var, void *val_ptr) {
622
     DEBUG_ECHOLNPGM("HandlePreheat");
622
     DEBUG_ECHOLNPGM("HandlePreheat");
623
 
623
 
624
-    uint8_t e_temp = 0;
625
-    #if HAS_HEATED_BED
626
-      uint8_t bed_temp = 0;
627
-    #endif
628
     const uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
624
     const uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
629
     switch (preheat_option) {
625
     switch (preheat_option) {
630
       default:
626
       default:
631
-      case 0: // Preheat PLA
632
-        #if defined(PREHEAT_1_TEMP_HOTEND) && defined(PREHEAT_1_TEMP_BED)
633
-          e_temp = PREHEAT_1_TEMP_HOTEND;
634
-          TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_1_TEMP_BED);
635
-        #endif
636
-        break;
637
-      case 1: // Preheat ABS
638
-        #if defined(PREHEAT_2_TEMP_HOTEND) && defined(PREHEAT_2_TEMP_BED)
639
-          e_temp = PREHEAT_2_TEMP_HOTEND;
640
-          TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_2_TEMP_BED);
641
-        #endif
642
-        break;
643
-      case 2: // Preheat PET
644
-        #if defined(PREHEAT_3_TEMP_HOTEND) && defined(PREHEAT_3_TEMP_BED)
645
-          e_temp = PREHEAT_3_TEMP_HOTEND;
646
-          TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_3_TEMP_BED);
647
-        #endif
648
-        break;
649
-      case 3: // Preheat FLEX
650
-        #if defined(PREHEAT_4_TEMP_HOTEND) && defined(PREHEAT_4_TEMP_BED)
651
-          e_temp = PREHEAT_4_TEMP_HOTEND;
652
-          TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_4_TEMP_BED);
653
-        #endif
654
-        break;
627
+      switch (var.VP) {
628
+        default: return;
629
+        case VP_E0_BED_PREHEAT: TERN_(HAS_HOTEND, ui.preheat_all(0)); break;
630
+        case VP_E1_BED_PREHEAT: TERN_(HAS_MULTI_HOTEND, ui.preheat_all(1)); break;
631
+      }
655
       case 7: break; // Custom preheat
632
       case 7: break; // Custom preheat
656
-      case 9: break; // Cool down
657
-    }
658
-
659
-    switch (var.VP) {
660
-      default: return;
661
-        #if HAS_HOTEND
662
-          case VP_E0_BED_PREHEAT:
663
-            thermalManager.setTargetHotend(e_temp, 0);
664
-            TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
665
-            break;
666
-        #endif
667
-        #if HOTENDS >= 2
668
-          case VP_E1_BED_PREHEAT:
669
-            thermalManager.setTargetHotend(e_temp, 1);
670
-            TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp));
671
-            break;
672
-        #endif
633
+      case 9: // Cool down
634
+        thermalManager.zero_fan_speeds();
635
+        thermalManager.disable_all_heaters();
636
+        break;
673
     }
637
     }
674
 
638
 
675
     // Go to the preheat screen to show the heating progress
639
     // Go to the preheat screen to show the heating progress

+ 1
- 4
Marlin/src/lcd/extui/ui_api.cpp View File

1035
   void setFeedrate_percent(const_float_t value) { feedrate_percentage = constrain(value, 10, 500); }
1035
   void setFeedrate_percent(const_float_t value) { feedrate_percentage = constrain(value, 10, 500); }
1036
 
1036
 
1037
   void coolDown() {
1037
   void coolDown() {
1038
-    #if HAS_HOTEND
1039
-      HOTEND_LOOP() thermalManager.setTargetHotend(0, e);
1040
-    #endif
1041
-    TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(0));
1038
+    thermalManager.disable_all_heaters();
1042
     TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
1039
     TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
1043
   }
1040
   }
1044
 
1041
 

+ 11
- 0
Marlin/src/lcd/marlinui.cpp View File

135
 #endif
135
 #endif
136
 
136
 
137
 #if HAS_PREHEAT
137
 #if HAS_PREHEAT
138
+  #include "../module/temperature.h"
139
+
138
   preheat_t MarlinUI::material_preset[PREHEAT_COUNT];  // Initialized by settings.load()
140
   preheat_t MarlinUI::material_preset[PREHEAT_COUNT];  // Initialized by settings.load()
141
+
139
   PGM_P MarlinUI::get_preheat_label(const uint8_t m) {
142
   PGM_P MarlinUI::get_preheat_label(const uint8_t m) {
140
     #define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL);
143
     #define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL);
141
     #define _PLBL(N) preheat_##N##_label,
144
     #define _PLBL(N) preheat_##N##_label,
143
     static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT_1(PREHEAT_COUNT, _PLBL) };
146
     static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT_1(PREHEAT_COUNT, _PLBL) };
144
     return (PGM_P)pgm_read_ptr(&preheat_labels[m]);
147
     return (PGM_P)pgm_read_ptr(&preheat_labels[m]);
145
   }
148
   }
149
+
150
+  void MarlinUI::apply_preheat(const uint8_t m, const uint8_t pmask, const uint8_t e/*=active_extruder*/) {
151
+    const preheat_t &pre = material_preset[m];
152
+    TERN_(HAS_HOTEND,           if (TEST(pmask, PM_HOTEND))  thermalManager.setTargetHotend(pre.hotend_temp, e));
153
+    TERN_(HAS_HEATED_BED,       if (TEST(pmask, PM_BED))     thermalManager.setTargetBed(pre.bed_temp));
154
+    //TERN_(HAS_HEATED_CHAMBER, if (TEST(pmask, PM_CHAMBER)) thermalManager.setTargetBed(pre.chamber_temp));
155
+    TERN_(HAS_FAN,              if (TEST(pmask, PM_FAN))     thermalManager.set_fan_speed(0, pre.fan_speed));
156
+  }
146
 #endif
157
 #endif
147
 
158
 
148
 #if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)
159
 #if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)

+ 7
- 1
Marlin/src/lcd/marlinui.h View File

56
 
56
 
57
 #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_LCD_MENU, EXTENSIBLE_UI, HAS_DWIN_E3V2)
57
 #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_LCD_MENU, EXTENSIBLE_UI, HAS_DWIN_E3V2)
58
   #include "../feature/pause.h"
58
   #include "../feature/pause.h"
59
-  #include "../module/motion.h" // for active_extruder
60
 #endif
59
 #endif
61
 
60
 
62
 #if ENABLED(DWIN_CREALITY_LCD)
61
 #if ENABLED(DWIN_CREALITY_LCD)
498
   #endif
497
   #endif
499
 
498
 
500
   #if HAS_PREHEAT
499
   #if HAS_PREHEAT
500
+    enum PreheatMask : uint8_t { PM_HOTEND = _BV(0), PM_BED = _BV(1), PM_FAN = _BV(2), PM_CHAMBER = _BV(3) };
501
     static preheat_t material_preset[PREHEAT_COUNT];
501
     static preheat_t material_preset[PREHEAT_COUNT];
502
     static PGM_P get_preheat_label(const uint8_t m);
502
     static PGM_P get_preheat_label(const uint8_t m);
503
+    static void apply_preheat(const uint8_t m, const uint8_t pmask, const uint8_t e=active_extruder);
504
+    static inline void preheat_set_fan(const uint8_t m) { TERN_(HAS_FAN, apply_preheat(m, PM_FAN)); }
505
+    static inline void preheat_hotend(const uint8_t m, const uint8_t e=active_extruder) { TERN_(HAS_HOTEND, apply_preheat(m, PM_HOTEND)); }
506
+    static inline void preheat_hotend_and_fan(const uint8_t m, const uint8_t e=active_extruder) { preheat_hotend(m, e); preheat_set_fan(m); }
507
+    static inline void preheat_bed(const uint8_t m) { TERN_(HAS_HEATED_BED, apply_preheat(m, PM_BED)); }
508
+    static inline void preheat_all(const uint8_t m) { apply_preheat(m, 0xFF); }
503
   #endif
509
   #endif
504
 
510
 
505
   #if SCREENS_CAN_TIME_OUT
511
   #if SCREENS_CAN_TIME_OUT

Loading…
Cancel
Save