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,18 +60,20 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
60 60
   switch (obj->mks_obj_id) {
61 61
     case ID_P_ADD: {
62 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 78
       else {
77 79
         #if HAS_HEATED_BED
@@ -87,11 +89,13 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
87 89
 
88 90
     case ID_P_DEC:
89 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 100
       else {
97 101
         #if HAS_HEATED_BED
@@ -99,7 +103,6 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
99 103
             thermalManager.temp_bed.target -= uiCfg.stepHeat;
100 104
           else
101 105
             thermalManager.setTargetBed(0);
102
-
103 106
           thermalManager.start_watching_bed();
104 107
         #endif
105 108
       }
@@ -142,8 +145,10 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
142 145
       break;
143 146
     case ID_P_OFF:
144 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 153
       else {
149 154
         #if HAS_HEATED_BED
@@ -158,16 +163,20 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
158 163
       draw_return_ui();
159 164
       break;
160 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 172
       break;
166 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 180
       break;
172 181
   }
173 182
 }
@@ -227,14 +236,14 @@ void disp_ext_heart() {
227 236
 
228 237
 void disp_temp_type() {
229 238
   if (uiCfg.curTempType == 0) {
230
-    if (uiCfg.extruderIndex == 1) {
239
+    if (TERN0(HAS_MULTI_EXTRUDER, uiCfg.extruderIndex == 1)) {
231 240
       lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
232 241
       if (gCfgItems.multiple_language) {
233 242
         lv_label_set_text(labelType, preheat_menu.ext2);
234 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 247
       lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
239 248
       if (gCfgItems.multiple_language) {
240 249
         lv_label_set_text(labelType, preheat_menu.ext1);
@@ -242,7 +251,7 @@ void disp_temp_type() {
242 251
       }
243 252
     }
244 253
   }
245
-  else {
254
+  else if (ENABLED(HAS_HEATED_BED)) {
246 255
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_bed.bin");
247 256
     if (gCfgItems.multiple_language) {
248 257
       lv_label_set_text(labelType, preheat_menu.hotbed);
@@ -256,8 +265,10 @@ void disp_desire_temp() {
256 265
   public_buf_l[0] = '\0';
257 266
 
258 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 273
   else {
263 274
     #if HAS_HEATED_BED

Loading…
Cancel
Save