Browse Source

Color UI Move Screen for 320x240 TFT (#21708)

David 3 years ago
parent
commit
2e0a1f1aff
No account linked to committer's email address

+ 1
- 1
Marlin/src/feature/dac/stepper_dac.h View File

@@ -34,7 +34,7 @@ public:
34 34
   static void set_current_value(const uint8_t channel, uint16_t val);
35 35
   static void print_values();
36 36
   static void commit_eeprom();
37
-  static uint8_t get_current_percent(AxisEnum axis);
37
+  static uint8_t get_current_percent(const AxisEnum axis);
38 38
   static void set_current_percents(xyze_uint8_t &pct);
39 39
 };
40 40
 

+ 1
- 1
Marlin/src/lcd/marlinui.cpp View File

@@ -757,7 +757,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
757 757
   //
758 758
   // Tell ui.update() to start a move to current_position after a short delay.
759 759
   //
760
-  void ManualMove::soon(AxisEnum move_axis
760
+  void ManualMove::soon(const AxisEnum move_axis
761 761
     #if MULTI_MANUAL
762 762
       , const int8_t eindex/*=-1*/
763 763
     #endif

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

@@ -155,13 +155,34 @@
155 155
         current_position.set(dest);
156 156
       #endif
157 157
     }
158
+    float axis_value(const AxisEnum axis) {
159
+      return NATIVE_TO_LOGICAL(processing ? destination[axis] : SUM_TERN(IS_KINEMATIC, current_position[axis], offset), axis);
160
+    }
161
+    bool apply_diff(const AxisEnum axis, const_float_t diff, const_float_t min, const_float_t max) {
162
+      #if IS_KINEMATIC
163
+        float &valref = offset;
164
+        const float rmin = min - current_position[axis], rmax = max - current_position[axis];
165
+      #else
166
+        float &valref = current_position[axis];
167
+        const float rmin = min, rmax = max;
168
+      #endif
169
+      valref += diff;
170
+      const float pre = valref;
171
+      if (min != max) {
172
+        if (diff < 0)
173
+          NOLESS(valref, rmin);
174
+        else
175
+          NOMORE(valref, rmax);
176
+      }
177
+      return pre != valref;
178
+    }
158 179
     #if IS_KINEMATIC
159 180
       static bool processing;
160 181
     #else
161 182
       static bool constexpr processing = false;
162 183
     #endif
163 184
     static void task();
164
-    static void soon(AxisEnum axis
185
+    static void soon(const AxisEnum axis
165 186
       #if MULTI_MANUAL
166 187
         , const int8_t eindex=-1
167 188
       #endif

+ 2
- 18
Marlin/src/lcd/menu/menu_motion.cpp View File

@@ -73,29 +73,13 @@ static void _lcd_move_xyz(PGM_P const name, const AxisEnum axis) {
73 73
 
74 74
     // Get the new position
75 75
     const float diff = float(int32_t(ui.encoderPosition)) * ui.manual_move.menu_scale;
76
-    #if IS_KINEMATIC
77
-      ui.manual_move.offset += diff;
78
-      if (int32_t(ui.encoderPosition) < 0)
79
-        NOLESS(ui.manual_move.offset, min - current_position[axis]);
80
-      else
81
-        NOMORE(ui.manual_move.offset, max - current_position[axis]);
82
-    #else
83
-      current_position[axis] += diff;
84
-      if (int32_t(ui.encoderPosition) < 0)
85
-        NOLESS(current_position[axis], min);
86
-      else
87
-        NOMORE(current_position[axis], max);
88
-    #endif
89
-
76
+    (void)ui.manual_move.apply_diff(axis, diff, min, max);
90 77
     ui.manual_move.soon(axis);
91 78
     ui.refresh(LCDVIEW_REDRAW_NOW);
92 79
   }
93 80
   ui.encoderPosition = 0;
94 81
   if (ui.should_draw()) {
95
-    const float pos = NATIVE_TO_LOGICAL(
96
-      ui.manual_move.processing ? destination[axis] : SUM_TERN(IS_KINEMATIC, current_position[axis], ui.manual_move.offset),
97
-      axis
98
-    );
82
+    const float pos = ui.manual_move.axis_value(axis);
99 83
     if (parser.using_inch_units()) {
100 84
       const float imp_pos = LINEAR_UNIT(pos);
101 85
       MenuEditItemBase::draw_edit_screen(name, ftostr63(imp_pos));

BIN
Marlin/src/lcd/tft/bitmaps/btn_42x39_rounded.bmp View File


+ 69
- 0
Marlin/src/lcd/tft/images/btn_rounded_42x39x4.cpp View File

@@ -0,0 +1,69 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2021 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 <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../../../inc/MarlinConfigPre.h"
24
+
25
+#if HAS_GRAPHICAL_TFT
26
+
27
+extern const uint8_t btn_rounded_42x39x4[819] = {
28
+  0x87, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x78, 
29
+  0x87, 0x77, 0xab, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xb9, 0x77, 0x78, 
30
+  0x87, 0x8e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd7, 0x68, 
31
+  0x87, 0xff, 0x84, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x37, 0xff, 0x57, 
32
+  0x7b, 0xf6, 0x34, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x43, 0x6f, 0x95, 
33
+  0x7d, 0xc3, 0x45, 0x56, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x4d, 0xc4, 
34
+  0x7e, 0xc3, 0x56, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x6d, 0xd3, 
35
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
36
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
37
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
38
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
39
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
40
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
41
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
42
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
43
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
44
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
45
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
46
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
47
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
48
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
49
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
50
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
51
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
52
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
53
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
54
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
55
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
56
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
57
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
58
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
59
+  0x7e, 0xc3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x7d, 0xd3, 
60
+  0x7d, 0xd3, 0x57, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x77, 0x7e, 0xc3, 
61
+  0x88, 0xfa, 0x56, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0xcf, 0x64, 
62
+  0x86, 0xbf, 0xdb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xce, 0xfb, 0x34, 
63
+  0x87, 0x57, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x74, 0x45, 
64
+  0x87, 0x75, 0x33, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x33, 0x34, 0x56, 
65
+  0x87, 0x77, 0x65, 0x54, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x55, 0x67, 
66
+  0x87, 0x87, 0x77, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x78
67
+};
68
+
69
+#endif // HAS_GRAPHICAL_TFT

+ 2
- 0
Marlin/src/lcd/tft/tft_image.cpp View File

@@ -53,6 +53,7 @@ const tImage Fan_Fast1_64x64x4      = { (void *)fan_fast1_64x64x4, 64, 64, GREYS
53 53
 const tImage SD_64x64x4             = { (void *)sd_64x64x4, 64, 64, GREYSCALE4 };
54 54
 const tImage Home_64x64x4           = { (void *)home_64x64x4, 64, 64, GREYSCALE4 };
55 55
 const tImage BtnRounded_64x52x4     = { (void *)btn_rounded_64x52x4, 64, 52, GREYSCALE4 };
56
+const tImage BtnRounded_42x39x4     = { (void *)btn_rounded_42x39x4, 42, 39, GREYSCALE4 };
56 57
 const tImage Menu_64x64x4           = { (void *)menu_64x64x4, 64, 64, GREYSCALE4 };
57 58
 const tImage Settings_64x64x4       = { (void *)settings_64x64x4, 64, 64, GREYSCALE4 };
58 59
 const tImage Confirm_64x64x4        = { (void *)confirm_64x64x4, 64, 64, GREYSCALE4 };
@@ -106,6 +107,7 @@ const tImage Images[imgCount] = {
106 107
   Slider8x16x4,
107 108
   Home_64x64x4,
108 109
   BtnRounded_64x52x4,
110
+  BtnRounded_42x39x4,
109 111
 };
110 112
 
111 113
 #endif // HAS_GRAPHICAL_TFT

+ 3
- 0
Marlin/src/lcd/tft/tft_image.h View File

@@ -42,6 +42,7 @@ extern const uint8_t fan_fast0_64x64x4[], fan_fast1_64x64x4[];
42 42
 extern const uint8_t sd_64x64x4[];
43 43
 extern const uint8_t home_64x64x4[];
44 44
 extern const uint8_t btn_rounded_64x52x4[];
45
+extern const uint8_t btn_rounded_42x39x4[];
45 46
 extern const uint8_t menu_64x64x4[];
46 47
 extern const uint8_t settings_64x64x4[];
47 48
 extern const uint8_t confirm_64x64x4[];
@@ -95,6 +96,7 @@ enum MarlinImage : uint8_t {
95 96
   imgSlider,
96 97
   imgHome,
97 98
   imgBtn52Rounded,
99
+  imgBtn39Rounded,
98 100
   imgCount,
99 101
   noImage = imgCount,
100 102
   imgPageUp = imgLeft,
@@ -145,6 +147,7 @@ extern const tImage Fan_Fast1_64x64x4;
145 147
 extern const tImage SD_64x64x4;
146 148
 extern const tImage Home_64x64x4;
147 149
 extern const tImage BtnRounded_64x52x4;
150
+extern const tImage BtnRounded_42x39x4;
148 151
 extern const tImage Menu_64x64x4;
149 152
 extern const tImage Settings_64x64x4;
150 153
 extern const tImage Confirm_64x64x4;

+ 19
- 30
Marlin/src/lcd/tft/ui_1024x600.cpp View File

@@ -165,6 +165,13 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
165 165
       image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
166 166
     }
167 167
   #endif
168
+  #if HAS_TEMP_COOLER
169
+    else if (Heater == H_COOLER) {
170
+      if (currentTemperature <= 26) Color = COLOR_COLD;
171
+      if (currentTemperature > 26) Color = COLOR_RED;
172
+      image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
173
+    }
174
+  #endif
168 175
 
169 176
   tft.add_image(8, 28, image, Color);
170 177
 
@@ -229,6 +236,9 @@ void MarlinUI::draw_status_screen() {
229 236
       #ifdef ITEM_CHAMBER
230 237
         case ITEM_CHAMBER: draw_heater_status(x, y, H_CHAMBER); break;
231 238
       #endif
239
+      #ifdef ITEM_COOLER
240
+        case ITEM_COOLER: draw_heater_status(x, y, H_COOLER); break;
241
+      #endif
232 242
       #ifdef ITEM_FAN
233 243
         case ITEM_FAN: draw_fan_status(x, y, blink); break;
234 244
       #endif
@@ -551,7 +561,6 @@ struct MotionAxisState {
551 561
   float currentStepSize = 10.0;
552 562
   int z_selection = Z_SELECTION_Z;
553 563
   uint8_t e_selection = 0;
554
-  bool homming = false;
555 564
   bool blocked = false;
556 565
   char message[32];
557 566
 };
@@ -616,16 +625,11 @@ static void drawMessage(const char *msg) {
616 625
   tft.add_text(0, 0, COLOR_YELLOW, msg);
617 626
 }
618 627
 
619
-static void drawAxisValue(AxisEnum axis) {
620
-  const float value =
621
-    #if HAS_BED_PROBE
622
-      axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ?
623
-      probe.offset.z :
624
-    #endif
625
-    NATIVE_TO_LOGICAL(
626
-      ui.manual_move.processing ? destination[axis] : current_position[axis] + TERN0(IS_KINEMATIC, ui.manual_move.offset),
627
-      axis
628
-    );
628
+static void drawAxisValue(const AxisEnum axis) {
629
+  const float value = (
630
+    TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :)
631
+    ui.manual_move.axis_value(axis)
632
+  );
629 633
   xy_int_t pos;
630 634
   uint16_t color;
631 635
   switch (axis) {
@@ -641,7 +645,7 @@ static void drawAxisValue(AxisEnum axis) {
641 645
   tft.add_text(0, 0, color, tft_string);
642 646
 }
643 647
 
644
-static void moveAxis(AxisEnum axis, const int8_t direction) {
648
+static void moveAxis(const AxisEnum axis, const int8_t direction) {
645 649
   quick_feedback();
646 650
 
647 651
   if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
@@ -707,23 +711,11 @@ static void moveAxis(AxisEnum axis, const int8_t direction) {
707 711
     #endif
708 712
 
709 713
     // Get the new position
714
+    const bool limited = ui.manual_move.apply_diff(axis, diff, min, max);
710 715
     #if IS_KINEMATIC
711
-      ui.manual_move.offset += diff;
712
-      if (direction < 0)
713
-        NOLESS(ui.manual_move.offset, min - current_position[axis]);
714
-      else
715
-        NOMORE(ui.manual_move.offset, max - current_position[axis]);
716
+      UNUSED(limited);
716 717
     #else
717
-      current_position[axis] += diff;
718
-      const char *msg = NUL_STR; // clear the error
719
-      if (direction < 0 && current_position[axis] < min) {
720
-        current_position[axis] = min;
721
-        msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
722
-      }
723
-      else if (direction > 0 && current_position[axis] > max) {
724
-        current_position[axis] = max;
725
-        msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
726
-      }
718
+      PGM_P const msg = limited ? GET_TEXT(MSG_LCD_SOFT_ENDSTOPS) : NUL_STR;
727 719
       drawMessage(msg);
728 720
     #endif
729 721
 
@@ -921,7 +913,4 @@ void MarlinUI::move_axis_screen() {
921 913
   TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
922 914
 }
923 915
 
924
-#undef BTN_WIDTH
925
-#undef BTN_HEIGHT
926
-
927 916
 #endif // HAS_UI_480x320

+ 388
- 15
Marlin/src/lcd/tft/ui_320x240.cpp View File

@@ -241,6 +241,9 @@ void MarlinUI::draw_status_screen() {
241 241
       #ifdef ITEM_CHAMBER
242 242
         case ITEM_CHAMBER: draw_heater_status(x, y, H_CHAMBER); break;
243 243
       #endif
244
+      #ifdef ITEM_COOLER
245
+        case ITEM_COOLER: draw_heater_status(x, y, H_COOLER); break;
246
+      #endif
244 247
       #ifdef ITEM_FAN
245 248
         case ITEM_FAN: draw_fan_status(x, y, blink); break;
246 249
       #endif
@@ -278,6 +281,7 @@ void MarlinUI::draw_status_screen() {
278 281
     offset -= tft_string.width();
279 282
   }
280 283
   tft.add_text(301 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
284
+  TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, 312, 24));
281 285
 
282 286
   // feed rate
283 287
   tft.canvas(70, 136, 80, 32);
@@ -354,16 +358,16 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const val
354 358
       menu_line(line - 1);
355 359
 
356 360
       tft_string.set(X_LBL);
357
-      tft.add_text(52, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
361
+      tft.add_text(TFT_WIDTH / 2 - 120, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
358 362
       tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.x)));
359 363
       tft_string.trim();
360
-      tft.add_text(144 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
364
+      tft.add_text(TFT_WIDTH / 2 - 16 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
361 365
 
362 366
       tft_string.set(Y_LBL);
363
-      tft.add_text(176, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
367
+      tft.add_text(TFT_WIDTH / 2 + 16, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
364 368
       tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.y)));
365 369
       tft_string.trim();
366
-      tft.add_text(268 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
370
+      tft.add_text(TFT_WIDTH / 2 + 120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
367 371
     }
368 372
   #endif
369 373
 
@@ -393,9 +397,9 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const val
393 397
 
394 398
 void TFT::draw_edit_screen_buttons() {
395 399
   #if ENABLED(TOUCH_SCREEN)
396
-    add_control(32, 176, DECREASE, imgDecrease);
397
-    add_control(224, 176, INCREASE, imgIncrease);
398
-    add_control(128, 176, CLICK, imgConfirm);
400
+    add_control(32, TFT_HEIGHT - 64, DECREASE, imgDecrease);
401
+    add_control(224, TFT_HEIGHT - 64, INCREASE, imgIncrease);
402
+    add_control(128, TFT_HEIGHT - 64, CLICK, imgConfirm);
399 403
   #endif
400 404
 }
401 405
 
@@ -424,8 +428,8 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
424 428
     tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
425 429
   }
426 430
   #if ENABLED(TOUCH_SCREEN)
427
-    add_control(48, 176, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
428
-    add_control(208, 176, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
431
+    add_control(48, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
432
+    add_control(208, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
429 433
   #endif
430 434
 }
431 435
 
@@ -435,7 +439,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
435 439
     #if ENABLED(TOUCH_SCREEN)
436 440
       touch.clear();
437 441
       draw_menu_navigation = false;
438
-      touch.add_control(RESUME_CONTINUE , 0, 0, 320, 240);
442
+      touch.add_control(RESUME_CONTINUE , 0, 0, TFT_WIDTH, TFT_HEIGHT);
439 443
     #endif
440 444
 
441 445
     menu_line(row);
@@ -477,7 +481,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
477 481
     const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
478 482
                    lpos = pos.asLogical();
479 483
 
480
-    tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - 32) / 2 - 32, 96, 32);
484
+    tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 - MENU_ITEM_HEIGHT, 96, MENU_ITEM_HEIGHT);
481 485
     tft.set_background(COLOR_BACKGROUND);
482 486
     tft_string.set(X_LBL);
483 487
     tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
@@ -485,7 +489,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
485 489
     tft_string.trim();
486 490
     tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
487 491
 
488
-    tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - 32) / 2, 96, 32);
492
+    tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2, 96, MENU_ITEM_HEIGHT);
489 493
     tft.set_background(COLOR_BACKGROUND);
490 494
     tft_string.set(Y_LBL);
491 495
     tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
@@ -493,7 +497,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
493 497
     tft_string.trim();
494 498
     tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
495 499
 
496
-    tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - 32) / 2 + 32, 96, 32);
500
+    tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 + MENU_ITEM_HEIGHT, 96, MENU_ITEM_HEIGHT);
497 501
     tft.set_background(COLOR_BACKGROUND);
498 502
     tft_string.set(Z_LBL);
499 503
     tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
@@ -502,13 +506,13 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
502 506
     tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
503 507
 
504 508
     constexpr uint8_t w = (TFT_WIDTH) / 10;
505
-    tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - w) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 1, w, 32);
509
+    tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - w) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 1, w, MENU_ITEM_HEIGHT);
506 510
     tft.set_background(COLOR_BACKGROUND);
507 511
     tft_string.set(ui8tostr3rj(x_plot));
508 512
     tft_string.trim();
509 513
     tft.add_text(tft_string.center(w), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
510 514
 
511
-    tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET, GRID_OFFSET_Y + (GRID_HEIGHT - 27) / 2, w, 32);
515
+    tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET, GRID_OFFSET_Y + (GRID_HEIGHT - 27) / 2, w, MENU_ITEM_HEIGHT);
512 516
     tft.set_background(COLOR_BACKGROUND);
513 517
     tft_string.set(ui8tostr3rj(y_plot));
514 518
     tft_string.trim();
@@ -527,7 +531,376 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
527 531
   }
528 532
 #endif // AUTO_BED_LEVELING_UBL
529 533
 
534
+#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
535
+  #include "../../feature/babystep.h"
536
+#endif
537
+
538
+#if HAS_BED_PROBE
539
+  #include "../../module/probe.h"
540
+#endif
541
+
542
+#define Z_SELECTION_Z 1
543
+#define Z_SELECTION_Z_PROBE -1
544
+
545
+struct MotionAxisState {
546
+  xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos;
547
+  float currentStepSize = 10.0;
548
+  int z_selection = Z_SELECTION_Z;
549
+  uint8_t e_selection = 0;
550
+  bool blocked = false;
551
+  char message[32];
552
+};
553
+
554
+MotionAxisState motionAxisState;
555
+
556
+#define E_BTN_COLOR COLOR_YELLOW
557
+#define X_BTN_COLOR COLOR_CORAL_RED
558
+#define Y_BTN_COLOR COLOR_VIVID_GREEN
559
+#define Z_BTN_COLOR COLOR_LIGHT_BLUE
560
+
561
+#define BTN_WIDTH 48
562
+#define BTN_HEIGHT 39
563
+#define X_MARGIN 15
564
+#define Y_MARGIN 11
565
+
566
+static void quick_feedback() {
567
+  #if HAS_CHIRP
568
+    ui.chirp(); // Buzz and wait. Is the delay needed for buttons to settle?
569
+    #if BOTH(HAS_LCD_MENU, USE_BEEPER)
570
+      for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); }
571
+    #elif HAS_LCD_MENU
572
+      delay(10);
573
+    #endif
574
+  #endif
575
+}
576
+
577
+#define CUR_STEP_VALUE_WIDTH 38
578
+static void drawCurStepValue() {
579
+  tft_string.set((uint8_t *)ftostr52sp(motionAxisState.currentStepSize));
580
+  tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, 20);
581
+  tft.set_background(COLOR_BACKGROUND);
582
+  tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string);
583
+  tft.queue.sync();
584
+  tft_string.set("mm");
585
+  tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y + 20, CUR_STEP_VALUE_WIDTH, 20);
586
+  tft.set_background(COLOR_BACKGROUND);
587
+  tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string);
588
+}
589
+
590
+static void drawCurZSelection() {
591
+  tft_string.set("Z");
592
+  tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 20);
593
+  tft.set_background(COLOR_BACKGROUND);
594
+  tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
595
+  tft.queue.sync();
596
+  tft_string.set("Offset");
597
+  tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 20);
598
+  tft.set_background(COLOR_BACKGROUND);
599
+  if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
600
+    tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
601
+  }
602
+}
603
+
604
+static void drawCurESelection() {
605
+  tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
606
+  tft.set_background(COLOR_BACKGROUND);
607
+  tft_string.set("E");
608
+  tft.add_text(0, 0, E_BTN_COLOR , tft_string);
609
+  tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
610
+}
611
+
612
+static void drawMessage(const char *msg) {
613
+  tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 29, (TFT_WIDTH / 2) - (BTN_WIDTH / 2) - X_MARGIN, 20);
614
+  tft.set_background(COLOR_BACKGROUND);
615
+  tft.add_text(0, 0, COLOR_YELLOW, msg);
616
+}
617
+
618
+static void drawAxisValue(const AxisEnum axis) {
619
+  const float value = (
620
+    TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :)
621
+    ui.manual_move.axis_value(axis)
622
+  );
623
+  xy_int_t pos;
624
+  uint16_t color;
625
+  switch (axis) {
626
+    case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break;
627
+    case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break;
628
+    case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break;
629
+    case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
630
+    default: return;
631
+  }
632
+  tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, 20);
633
+  tft.set_background(COLOR_BACKGROUND);
634
+  tft_string.set(ftostr52sp(value));
635
+  tft.add_text(0, 0, color, tft_string);
636
+}
637
+
638
+static void moveAxis(const AxisEnum axis, const int8_t direction) {
639
+  quick_feedback();
640
+
641
+  if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
642
+    drawMessage("Too cold");
643
+    return;
644
+  }
645
+
646
+  const float diff = motionAxisState.currentStepSize * direction;
647
+
648
+  if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
649
+    #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
650
+      const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
651
+      const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
652
+      const float bsDiff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
653
+                  new_probe_offset = probe.offset.z + bsDiff,
654
+                  new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
655
+                    , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff
656
+                    , new_probe_offset
657
+                  );
658
+      if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
659
+        babystep.add_steps(Z_AXIS, babystep_increment);
660
+        if (do_probe)
661
+          probe.offset.z = new_offs;
662
+        else
663
+          TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
664
+        drawMessage(""); // clear the error
665
+        drawAxisValue(axis);
666
+      }
667
+      else {
668
+        drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
669
+      }
670
+    #elif HAS_BED_PROBE
671
+      // only change probe.offset.z
672
+      probe.offset.z += diff;
673
+      if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) {
674
+        current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN;
675
+        drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
676
+      }
677
+      else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) {
678
+        current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX;
679
+        drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
680
+      }
681
+      else {
682
+        drawMessage(""); // clear the error
683
+      }
684
+      drawAxisValue(axis);
685
+    #endif
686
+    return;
687
+  }
688
+
689
+  if (!ui.manual_move.processing) {
690
+    // Get motion limit from software endstops, if any
691
+    float min, max;
692
+    soft_endstop.get_manual_axis_limits(axis, min, max);
693
+
694
+    // Delta limits XY based on the current offset from center
695
+    // This assumes the center is 0,0
696
+    #if ENABLED(DELTA)
697
+      if (axis != Z_AXIS && axis != E_AXIS) {
698
+        max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
699
+        min = -max;
700
+      }
701
+    #endif
702
+
703
+    // Get the new position
704
+    const bool limited = ui.manual_move.apply_diff(axis, diff, min, max);
705
+    #if IS_KINEMATIC
706
+      UNUSED(limited);
707
+    #else
708
+      PGM_P const msg = limited ? GET_TEXT(MSG_LCD_SOFT_ENDSTOPS) : NUL_STR;
709
+      drawMessage(msg);
710
+    #endif
711
+
712
+    ui.manual_move.soon(axis
713
+      #if MULTI_MANUAL
714
+        , motionAxisState.e_selection
715
+      #endif
716
+    );
717
+  }
718
+
719
+  drawAxisValue(axis);
720
+}
721
+
722
+static void e_plus()  { moveAxis(E_AXIS, 1);  }
723
+static void e_minus() { moveAxis(E_AXIS, -1); }
724
+static void x_minus() { moveAxis(X_AXIS, -1); }
725
+static void x_plus()  { moveAxis(X_AXIS, 1);  }
726
+static void y_plus()  { moveAxis(Y_AXIS, 1);  }
727
+static void y_minus() { moveAxis(Y_AXIS, -1); }
728
+static void z_plus()  { moveAxis(Z_AXIS, 1);  }
729
+static void z_minus() { moveAxis(Z_AXIS, -1); }
730
+
731
+#if ENABLED(TOUCH_SCREEN)
732
+  static void e_select() {
733
+    motionAxisState.e_selection++;
734
+    if (motionAxisState.e_selection >= EXTRUDERS) {
735
+      motionAxisState.e_selection = 0;
736
+    }
737
+
738
+    quick_feedback();
739
+    drawCurESelection();
740
+    drawAxisValue(E_AXIS);
741
+  }
742
+
743
+  static void do_home() {
744
+    quick_feedback();
745
+    drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING));
746
+    queue.inject_P(G28_STR);
747
+    // Disable touch until home is done
748
+    TERN_(HAS_TFT_XPT2046, touch.disable());
749
+    drawAxisValue(E_AXIS);
750
+    drawAxisValue(X_AXIS);
751
+    drawAxisValue(Y_AXIS);
752
+    drawAxisValue(Z_AXIS);
753
+  }
754
+
755
+  static void step_size() {
756
+    motionAxisState.currentStepSize = motionAxisState.currentStepSize / 10.0;
757
+    if (motionAxisState.currentStepSize < 0.0015) motionAxisState.currentStepSize = 10.0;
758
+    quick_feedback();
759
+    drawCurStepValue();
760
+  }
761
+#endif
762
+
763
+#if HAS_BED_PROBE
764
+  static void z_select() {
765
+    motionAxisState.z_selection *= -1;
766
+    quick_feedback();
767
+    drawCurZSelection();
768
+    drawAxisValue(Z_AXIS);
769
+  }
770
+#endif
771
+
772
+static void disable_steppers() {
773
+  quick_feedback();
774
+  queue.inject_P(PSTR("M84"));
775
+}
776
+
777
+static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
778
+  uint16_t width = Images[imgBtn39Rounded].width;
779
+  uint16_t height = Images[imgBtn39Rounded].height;
780
+
781
+  if (!enabled) bgColor = COLOR_CONTROL_DISABLED;
782
+
783
+  tft.canvas(x, y, width, height);
784
+  tft.set_background(COLOR_BACKGROUND);
785
+  tft.add_image(0, 0, imgBtn39Rounded, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
786
+
787
+  // TODO: Make an add_text() taking a font arg
788
+  if (label) {
789
+    tft_string.set(label);
790
+    tft_string.trim();
791
+    tft.add_text(tft_string.center(width), height / 2 - tft_string.font_height() / 2, bgColor, tft_string);
792
+  }
793
+  else {
794
+    tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
795
+  }
796
+
797
+  TERN_(HAS_TFT_XPT2046, if (enabled) touch.add_control(BUTTON, x, y, width, height, data));
798
+}
530 799
 void MarlinUI::move_axis_screen() {
800
+  // Reset
801
+  defer_status_screen(true);
802
+  motionAxisState.blocked = false;
803
+  TERN_(HAS_TFT_XPT2046, touch.enable());
804
+
805
+  ui.clear_lcd();
806
+
807
+  TERN_(TOUCH_SCREEN, touch.clear());
808
+
809
+  const bool busy = printingIsActive();
810
+
811
+  // Babysteps during printing? Select babystep for Z probe offset
812
+  if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET))
813
+    motionAxisState.z_selection = Z_SELECTION_Z_PROBE;
814
+
815
+  // ROW 1 -> E- Y- CurY Z+
816
+  int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
817
+
818
+  drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
819
+
820
+  spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
821
+  x += BTN_WIDTH + spacing;
822
+  uint16_t yplus_x = x;
823
+  drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy);
824
+
825
+  // Cur Y
826
+  x += BTN_WIDTH;
827
+  motionAxisState.yValuePos.x = x + 2;
828
+  motionAxisState.yValuePos.y = y;
829
+  drawAxisValue(Y_AXIS);
830
+
831
+  x += spacing;
832
+  drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
833
+
834
+  // ROW 2 -> "Ex"  X-  HOME X+  "Z"
835
+  y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
836
+  x = X_MARGIN;
837
+  spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4;
838
+
839
+  motionAxisState.eNamePos.x = x;
840
+  motionAxisState.eNamePos.y = y;
841
+  drawCurESelection();
842
+  TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
843
+
844
+  x += BTN_WIDTH + spacing;
845
+  drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
846
+
847
+  x += BTN_WIDTH + spacing; //imgHome is 64x64
848
+  TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
849
+
850
+  x += BTN_WIDTH + spacing;
851
+  uint16_t xplus_x = x;
852
+  drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
853
+
854
+  x += BTN_WIDTH + spacing;
855
+  motionAxisState.zTypePos.x = x;
856
+  motionAxisState.zTypePos.y = y;
857
+  drawCurZSelection();
858
+  #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
859
+    if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
860
+  #endif
861
+
862
+  // ROW 3 -> E- CurX Y-  Z-
863
+  y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
864
+  x = X_MARGIN;
865
+  spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
866
+
867
+  drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
868
+
869
+  // Cur E
870
+  motionAxisState.eValuePos.x = x;
871
+  motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
872
+  drawAxisValue(E_AXIS);
873
+
874
+  // Cur X
875
+  motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
876
+  motionAxisState.xValuePos.y = y - 10;
877
+  drawAxisValue(X_AXIS);
878
+
879
+  x += BTN_WIDTH + spacing;
880
+  drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
881
+
882
+  x += BTN_WIDTH + spacing;
883
+  drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
884
+
885
+  // Cur Z
886
+  motionAxisState.zValuePos.x = x;
887
+  motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
888
+  drawAxisValue(Z_AXIS);
889
+
890
+  // ROW 4 -> step_size  disable steppers back
891
+  y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
892
+  x = xplus_x - CUR_STEP_VALUE_WIDTH - 10;
893
+  motionAxisState.stepValuePos.x = yplus_x + BTN_WIDTH - CUR_STEP_VALUE_WIDTH;
894
+  motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT;
895
+  if (!busy) {
896
+    drawCurStepValue();
897
+    TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
898
+  }
899
+
900
+  // aligned with x+
901
+  drawBtn(xplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
902
+
903
+  TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
531 904
 }
532 905
 
533 906
 #endif // HAS_UI_320x240

+ 19
- 30
Marlin/src/lcd/tft/ui_480x320.cpp View File

@@ -170,6 +170,13 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
170 170
       image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
171 171
     }
172 172
   #endif
173
+  #if HAS_TEMP_COOLER
174
+    else if (Heater == H_COOLER) {
175
+      if (currentTemperature <= 26) Color = COLOR_COLD;
176
+      if (currentTemperature > 26) Color = COLOR_RED;
177
+      image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
178
+    }
179
+  #endif
173 180
 
174 181
   tft.add_image(8, 28, image, Color);
175 182
 
@@ -234,6 +241,9 @@ void MarlinUI::draw_status_screen() {
234 241
       #ifdef ITEM_CHAMBER
235 242
         case ITEM_CHAMBER: draw_heater_status(x, y, H_CHAMBER); break;
236 243
       #endif
244
+      #ifdef ITEM_COOLER
245
+        case ITEM_COOLER: draw_heater_status(x, y, H_COOLER); break;
246
+      #endif
237 247
       #ifdef ITEM_FAN
238 248
         case ITEM_FAN: draw_fan_status(x, y, blink); break;
239 249
       #endif
@@ -543,7 +553,6 @@ struct MotionAxisState {
543 553
   float currentStepSize = 10.0;
544 554
   int z_selection = Z_SELECTION_Z;
545 555
   uint8_t e_selection = 0;
546
-  bool homming = false;
547 556
   bool blocked = false;
548 557
   char message[32];
549 558
 };
@@ -608,16 +617,11 @@ static void drawMessage(const char *msg) {
608 617
   tft.add_text(0, 0, COLOR_YELLOW, msg);
609 618
 }
610 619
 
611
-static void drawAxisValue(AxisEnum axis) {
612
-  const float value =
613
-    #if HAS_BED_PROBE
614
-      axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ?
615
-      probe.offset.z :
616
-    #endif
617
-    NATIVE_TO_LOGICAL(
618
-      ui.manual_move.processing ? destination[axis] : SUM_TERN(IS_KINEMATIC, current_position[axis], ui.manual_move.offset),
619
-      axis
620
-    );
620
+static void drawAxisValue(const AxisEnum axis) {
621
+  const float value = (
622
+    TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :)
623
+    ui.manual_move.axis_value(axis)
624
+  );
621 625
   xy_int_t pos;
622 626
   uint16_t color;
623 627
   switch (axis) {
@@ -633,7 +637,7 @@ static void drawAxisValue(AxisEnum axis) {
633 637
   tft.add_text(0, 0, color, tft_string);
634 638
 }
635 639
 
636
-static void moveAxis(AxisEnum axis, const int8_t direction) {
640
+static void moveAxis(const AxisEnum axis, const int8_t direction) {
637 641
   quick_feedback();
638 642
 
639 643
   if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
@@ -699,23 +703,11 @@ static void moveAxis(AxisEnum axis, const int8_t direction) {
699 703
     #endif
700 704
 
701 705
     // Get the new position
706
+    const bool limited = ui.manual_move.apply_diff(axis, diff, min, max);
702 707
     #if IS_KINEMATIC
703
-      ui.manual_move.offset += diff;
704
-      if (direction < 0)
705
-        NOLESS(ui.manual_move.offset, min - current_position[axis]);
706
-      else
707
-        NOMORE(ui.manual_move.offset, max - current_position[axis]);
708
+      UNUSED(limited);
708 709
     #else
709
-      current_position[axis] += diff;
710
-      const char *msg = NUL_STR; // clear the error
711
-      if (direction < 0 && current_position[axis] < min) {
712
-        current_position[axis] = min;
713
-        msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
714
-      }
715
-      else if (direction > 0 && current_position[axis] > max) {
716
-        current_position[axis] = max;
717
-        msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
718
-      }
710
+      PGM_P const msg = limited ? GET_TEXT(MSG_LCD_SOFT_ENDSTOPS) : NUL_STR;
719 711
       drawMessage(msg);
720 712
     #endif
721 713
 
@@ -913,7 +905,4 @@ void MarlinUI::move_axis_screen() {
913 905
   TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
914 906
 }
915 907
 
916
-#undef BTN_WIDTH
917
-#undef BTN_HEIGHT
918
-
919 908
 #endif // HAS_UI_480x320

Loading…
Cancel
Save