Browse Source

🎨 Update MKS UI for no bed, extruder (#22938)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Dmytro 3 years ago
parent
commit
bf91bd5eee
No account linked to committer's email address
1 changed files with 44 additions and 33 deletions
  1. 44
    33
      Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp

+ 44
- 33
Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp View File

60
   switch (obj->mks_obj_id) {
60
   switch (obj->mks_obj_id) {
61
     case ID_P_ADD: {
61
     case ID_P_ADD: {
62
       if (uiCfg.curTempType == 0) {
62
       if (uiCfg.curTempType == 0) {
63
-        int16_t max_target;
64
-        thermalManager.temp_hotend[uiCfg.extruderIndex].target += uiCfg.stepHeat;
65
-        if (uiCfg.extruderIndex == 0)
66
-          max_target = HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
67
-        else {
68
-          #if HAS_MULTI_HOTEND
69
-            max_target = HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
70
-          #endif
71
-        }
72
-        if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > max_target)
73
-          thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex);
74
-        thermalManager.start_watching_hotend(uiCfg.extruderIndex);
63
+        #if HAS_HOTEND
64
+          int16_t max_target;
65
+          thermalManager.temp_hotend[uiCfg.extruderIndex].target += uiCfg.stepHeat;
66
+          if (uiCfg.extruderIndex == 0)
67
+            max_target = HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
68
+          else {
69
+            #if HAS_MULTI_HOTEND
70
+              max_target = HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
71
+            #endif
72
+          }
73
+          if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > max_target)
74
+            thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex);
75
+          thermalManager.start_watching_hotend(uiCfg.extruderIndex);
76
+        #endif
75
       }
77
       }
76
       else {
78
       else {
77
         #if HAS_HEATED_BED
79
         #if HAS_HEATED_BED
87
 
89
 
88
     case ID_P_DEC:
90
     case ID_P_DEC:
89
       if (uiCfg.curTempType == 0) {
91
       if (uiCfg.curTempType == 0) {
90
-        if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > uiCfg.stepHeat)
91
-          thermalManager.temp_hotend[uiCfg.extruderIndex].target -= uiCfg.stepHeat;
92
-        else
93
-          thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
94
-        thermalManager.start_watching_hotend(uiCfg.extruderIndex);
92
+        #if HAS_HOTEND
93
+          if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > uiCfg.stepHeat)
94
+            thermalManager.temp_hotend[uiCfg.extruderIndex].target -= uiCfg.stepHeat;
95
+          else
96
+            thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
97
+          thermalManager.start_watching_hotend(uiCfg.extruderIndex);
98
+        #endif
95
       }
99
       }
96
       else {
100
       else {
97
         #if HAS_HEATED_BED
101
         #if HAS_HEATED_BED
99
             thermalManager.temp_bed.target -= uiCfg.stepHeat;
103
             thermalManager.temp_bed.target -= uiCfg.stepHeat;
100
           else
104
           else
101
             thermalManager.setTargetBed(0);
105
             thermalManager.setTargetBed(0);
102
-
103
           thermalManager.start_watching_bed();
106
           thermalManager.start_watching_bed();
104
         #endif
107
         #endif
105
       }
108
       }
142
       break;
145
       break;
143
     case ID_P_OFF:
146
     case ID_P_OFF:
144
       if (uiCfg.curTempType == 0) {
147
       if (uiCfg.curTempType == 0) {
145
-        thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
146
-        thermalManager.start_watching_hotend(uiCfg.extruderIndex);
148
+        #if HAS_HOTEND
149
+          thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
150
+          thermalManager.start_watching_hotend(uiCfg.extruderIndex);
151
+        #endif
147
       }
152
       }
148
       else {
153
       else {
149
         #if HAS_HEATED_BED
154
         #if HAS_HEATED_BED
158
       draw_return_ui();
163
       draw_return_ui();
159
       break;
164
       break;
160
     case ID_P_ABS:
165
     case ID_P_ABS:
161
-      if (uiCfg.curTempType == 0)
162
-        thermalManager.setTargetHotend(PREHEAT_2_TEMP_HOTEND, 0);
163
-      else if (uiCfg.curTempType == 1)
164
-        thermalManager.setTargetBed(PREHEAT_2_TEMP_BED);
166
+      if (uiCfg.curTempType == 0) {
167
+        TERN_(HAS_HOTEND, thermalManager.setTargetHotend(PREHEAT_2_TEMP_HOTEND, 0));
168
+      }
169
+      else if (uiCfg.curTempType == 1) {
170
+        TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(PREHEAT_2_TEMP_BED));
171
+      }
165
       break;
172
       break;
166
     case ID_P_PLA:
173
     case ID_P_PLA:
167
-      if (uiCfg.curTempType == 0)
168
-        thermalManager.setTargetHotend(PREHEAT_1_TEMP_HOTEND, 0);
169
-      else if (uiCfg.curTempType == 1)
170
-        thermalManager.setTargetBed(PREHEAT_1_TEMP_BED);
174
+      if (uiCfg.curTempType == 0) {
175
+        TERN_(HAS_HOTEND, thermalManager.setTargetHotend(PREHEAT_1_TEMP_HOTEND, 0));
176
+      }
177
+      else if (uiCfg.curTempType == 1) {
178
+        TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(PREHEAT_1_TEMP_BED));
179
+      }
171
       break;
180
       break;
172
   }
181
   }
173
 }
182
 }
227
 
236
 
228
 void disp_temp_type() {
237
 void disp_temp_type() {
229
   if (uiCfg.curTempType == 0) {
238
   if (uiCfg.curTempType == 0) {
230
-    if (uiCfg.extruderIndex == 1) {
239
+    if (TERN0(HAS_MULTI_EXTRUDER, uiCfg.extruderIndex == 1)) {
231
       lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
240
       lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
232
       if (gCfgItems.multiple_language) {
241
       if (gCfgItems.multiple_language) {
233
         lv_label_set_text(labelType, preheat_menu.ext2);
242
         lv_label_set_text(labelType, preheat_menu.ext2);
234
         lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
243
         lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
235
       }
244
       }
236
     }
245
     }
237
-    else {
246
+    else if (ENABLED(HAS_HOTEND)) {
238
       lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
247
       lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
239
       if (gCfgItems.multiple_language) {
248
       if (gCfgItems.multiple_language) {
240
         lv_label_set_text(labelType, preheat_menu.ext1);
249
         lv_label_set_text(labelType, preheat_menu.ext1);
242
       }
251
       }
243
     }
252
     }
244
   }
253
   }
245
-  else {
254
+  else if (ENABLED(HAS_HEATED_BED)) {
246
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_bed.bin");
255
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_bed.bin");
247
     if (gCfgItems.multiple_language) {
256
     if (gCfgItems.multiple_language) {
248
       lv_label_set_text(labelType, preheat_menu.hotbed);
257
       lv_label_set_text(labelType, preheat_menu.hotbed);
256
   public_buf_l[0] = '\0';
265
   public_buf_l[0] = '\0';
257
 
266
 
258
   if (uiCfg.curTempType == 0) {
267
   if (uiCfg.curTempType == 0) {
259
-    strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
260
-    sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
268
+    #if HAS_HOTEND
269
+      strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
270
+      sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
271
+    #endif
261
   }
272
   }
262
   else {
273
   else {
263
     #if HAS_HEATED_BED
274
     #if HAS_HEATED_BED

Loading…
Cancel
Save