Browse Source

🎨 Fix and improve FTDI Eve Touch UI (#22093)

Marcio T 3 years ago
parent
commit
6d2c7aa227

+ 1
- 3
Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/media_file_reader.cpp View File

@@ -27,9 +27,7 @@
27 27
 
28 28
   #if ENABLED(SDSUPPORT)
29 29
     bool MediaFileReader::open(const char *filename) {
30
-      card.init(SD_SPI_SPEED, SDSS);
31
-      volume.init(&card);
32
-      root.openRoot(&volume);
30
+      root = CardReader::getroot();
33 31
       return file.open(&root, filename, O_READ);
34 32
     }
35 33
 

+ 1
- 1
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp View File

@@ -82,8 +82,8 @@ namespace FTDI {
82 82
       box_width = w;
83 83
       measure_text_box(fm, str, box_width, box_height);
84 84
       if (box_width <= (uint16_t)w && box_height <= (uint16_t)h) break;
85
-      fm.load(--font);
86 85
       if (font == 26) break;
86
+      fm.load(--font);
87 87
     }
88 88
 
89 89
     const uint16_t dx = (options & OPT_RIGHTX) ? w :

+ 4
- 4
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp View File

@@ -26,7 +26,7 @@
26 26
 #ifdef FTDI_ABOUT_SCREEN
27 27
 
28 28
 #define GRID_COLS 4
29
-#define GRID_ROWS 7
29
+#define GRID_ROWS 8
30 30
 
31 31
 using namespace FTDI;
32 32
 using namespace Theme;
@@ -47,9 +47,9 @@ void AboutScreen::onRedraw(draw_mode_t) {
47 47
   #define HEADING_POS BTN_POS(1,2), BTN_SIZE(4,1)
48 48
   #define FW_VERS_POS BTN_POS(1,3), BTN_SIZE(4,1)
49 49
   #define FW_INFO_POS BTN_POS(1,4), BTN_SIZE(4,1)
50
-  #define LICENSE_POS BTN_POS(1,5), BTN_SIZE(4,2)
51
-  #define STATS_POS   BTN_POS(1,7), BTN_SIZE(2,1)
52
-  #define BACK_POS    BTN_POS(3,7), BTN_SIZE(2,1)
50
+  #define LICENSE_POS BTN_POS(1,5), BTN_SIZE(4,3)
51
+  #define STATS_POS   BTN_POS(1,8), BTN_SIZE(2,1)
52
+  #define BACK_POS    BTN_POS(3,8), BTN_SIZE(2,1)
53 53
 
54 54
   #define _INSET_POS(x,y,w,h) x + w/10, y, w - w/5, h
55 55
   #define INSET_POS(pos) _INSET_POS(pos)

+ 2
- 2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_view_screen.cpp View File

@@ -69,7 +69,7 @@ void BedMeshViewScreen::onEntry() {
69 69
 void BedMeshViewScreen::drawHighlightedPointValue() {
70 70
   CommandProcessor cmd;
71 71
   cmd.font(Theme::font_medium)
72
-     .colors(normal_btn)
72
+     .cmd(COLOR_RGB(bg_text_enabled))
73 73
      .text(Z_LABEL_POS, GET_TEXT_F(MSG_MESH_EDIT_Z))
74 74
      .font(font_small);
75 75
 
@@ -161,7 +161,7 @@ void BedMeshViewScreen::doProbe() {
161 161
 void BedMeshViewScreen::doMeshValidation() {
162 162
   mydata.count = 0;
163 163
   GOTO_SCREEN(StatusScreen);
164
-  injectCommands_P(PSTR("G28 O\nM117 Heating...\nG26 R X0 Y0"));
164
+  injectCommands_P(PSTR("M75\nG28 O\nM117 Heating...\nG26 R X0 Y0\nG27\nM77"));
165 165
 }
166 166
 
167 167
 void BedMeshViewScreen::show() {

+ 12
- 6
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp View File

@@ -46,17 +46,22 @@ void ZOffsetScreen::onRedraw(draw_mode_t what) {
46 46
   w.heading(                  GET_TEXT_F(MSG_ZPROBE_ZOFFSET));
47 47
   w.color(z_axis).adjuster(4, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), getZOffset_mm());
48 48
   w.increments();
49
-  w.button(   2, GET_TEXT_F(MSG_PROBE_WIZARD));
49
+  w.button(2, GET_TEXT_F(MSG_PROBE_WIZARD), !isPrinting());
50 50
 }
51 51
 
52
-void ZOffsetScreen::move(float inc) {
52
+void ZOffsetScreen::move(float mm, int16_t steps) {
53 53
   // We can't store state after the call to the AlertBox, so
54 54
   // check whether the current position equal mydata.z in order
55 55
   // to know whether the user started the wizard.
56 56
   if (getAxisPosition_mm(Z) == mydata.z) {
57
-    mydata.z += inc;
57
+    // In the wizard
58
+    mydata.z += mm;
58 59
     setAxisPosition_mm(mydata.z, Z);
59 60
   }
61
+  else {
62
+    // Otherwise doing a manual adjustment, possibly during a print.
63
+    babystepAxis_steps(steps, Z);
64
+  }
60 65
 }
61 66
 
62 67
 void ZOffsetScreen::runWizard() {
@@ -80,11 +85,12 @@ void ZOffsetScreen::runWizard() {
80 85
 }
81 86
 
82 87
 bool ZOffsetScreen::onTouchHeld(uint8_t tag) {
83
-  const float increment = getIncrement();
88
+  const int16_t steps = mmToWholeSteps(getIncrement(), Z);
89
+  const float increment = mmFromWholeSteps(steps, Z);
84 90
   switch (tag) {
85 91
     case 2: runWizard(); break;
86
-    case 4: UI_DECREMENT(ZOffset_mm); move(-increment); break;
87
-    case 5: UI_INCREMENT(ZOffset_mm); move( increment); break;
92
+    case 4: UI_DECREMENT(ZOffset_mm); move(-increment, -steps); break;
93
+    case 5: UI_INCREMENT(ZOffset_mm); move( increment,  steps); break;
88 94
     default:
89 95
       return false;
90 96
   }

+ 1
- 1
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.h View File

@@ -31,7 +31,7 @@ struct ZOffsetScreenData : public BaseNumericAdjustmentScreenData {
31 31
 
32 32
 class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ZOFFSET_SCREEN_CACHE> {
33 33
   private:
34
-    static void move(float inc);
34
+    static void move(float mm, int16_t steps);
35 35
     static void runWizard();
36 36
   public:
37 37
     static void onEntry();

+ 2
- 2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h View File

@@ -70,7 +70,7 @@ namespace Language_en {
70 70
   PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_2      = WEBSITE_URL;
71 71
   PROGMEM Language_Str MSG_LICENSE                  = u8"This program is free software: you can redistribute it and/or modify it under the terms of "
72 72
                                                         "the GNU General Public License as published by the Free Software Foundation, either version 3 "
73
-                                                        "of the License, or (at your option) any later version.\n\nTo view a copy of the GNU General "
73
+                                                        "of the License, or (at your option) any later version. To view a copy of the GNU General "
74 74
                                                         "Public License, go to the following location: https://www.gnu.org/licenses.";
75 75
   PROGMEM Language_Str MSG_RUNOUT_1                 = u8"Runout 1";
76 76
   PROGMEM Language_Str MSG_RUNOUT_2                 = u8"Runout 2";
@@ -130,7 +130,7 @@ namespace Language_en {
130 130
   PROGMEM Language_Str MSG_EEPROM_RESTORED          = u8"Settings restored from backup";
131 131
   PROGMEM Language_Str MSG_EEPROM_RESET             = u8"Settings restored to default";
132 132
   PROGMEM Language_Str MSG_EEPROM_SAVED             = u8"Settings saved!";
133
-  PROGMEM Language_Str MSG_EEPROM_SAVE_PROMPT       = u8"Do you wish to save these settings as defaults?";
133
+  PROGMEM Language_Str MSG_EEPROM_SAVE_PROMPT       = u8"Do you wish to save these settings for next power-on?";
134 134
   PROGMEM Language_Str MSG_EEPROM_RESET_WARNING     = u8"Are you sure? Customizations will be lost.";
135 135
 
136 136
   PROGMEM Language_Str MSG_PASSCODE_REJECTED        = u8"Wrong passcode!";

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

@@ -767,6 +767,10 @@ namespace ExtUI {
767 767
       return steps > 0 ? CEIL(steps) : FLOOR(steps);
768 768
     }
769 769
 
770
+    float mmFromWholeSteps(int16_t steps, const axis_t axis) {
771
+      return steps * planner.steps_to_mm[axis];
772
+    }
773
+
770 774
   #endif // BABYSTEPPING
771 775
 
772 776
   float getZOffset_mm() {

+ 1
- 0
Marlin/src/lcd/extui/ui_api.h View File

@@ -239,6 +239,7 @@ namespace ExtUI {
239 239
 
240 240
   #if ENABLED(BABYSTEPPING)
241 241
     int16_t mmToWholeSteps(const_float_t mm, const axis_t axis);
242
+    float mmFromWholeSteps(int16_t steps, const axis_t axis);
242 243
 
243 244
     bool babystepAxis_steps(const int16_t steps, const axis_t axis);
244 245
     void smartAdjustAxis_steps(const int16_t steps, const axis_t axis, bool linked_nozzles);

Loading…
Cancel
Save