Browse Source

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

Marcio T 4 years ago
parent
commit
6d2c7aa227

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

27
 
27
 
28
   #if ENABLED(SDSUPPORT)
28
   #if ENABLED(SDSUPPORT)
29
     bool MediaFileReader::open(const char *filename) {
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
       return file.open(&root, filename, O_READ);
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
       box_width = w;
82
       box_width = w;
83
       measure_text_box(fm, str, box_width, box_height);
83
       measure_text_box(fm, str, box_width, box_height);
84
       if (box_width <= (uint16_t)w && box_height <= (uint16_t)h) break;
84
       if (box_width <= (uint16_t)w && box_height <= (uint16_t)h) break;
85
-      fm.load(--font);
86
       if (font == 26) break;
85
       if (font == 26) break;
86
+      fm.load(--font);
87
     }
87
     }
88
 
88
 
89
     const uint16_t dx = (options & OPT_RIGHTX) ? w :
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
 #ifdef FTDI_ABOUT_SCREEN
26
 #ifdef FTDI_ABOUT_SCREEN
27
 
27
 
28
 #define GRID_COLS 4
28
 #define GRID_COLS 4
29
-#define GRID_ROWS 7
29
+#define GRID_ROWS 8
30
 
30
 
31
 using namespace FTDI;
31
 using namespace FTDI;
32
 using namespace Theme;
32
 using namespace Theme;
47
   #define HEADING_POS BTN_POS(1,2), BTN_SIZE(4,1)
47
   #define HEADING_POS BTN_POS(1,2), BTN_SIZE(4,1)
48
   #define FW_VERS_POS BTN_POS(1,3), BTN_SIZE(4,1)
48
   #define FW_VERS_POS BTN_POS(1,3), BTN_SIZE(4,1)
49
   #define FW_INFO_POS BTN_POS(1,4), BTN_SIZE(4,1)
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
   #define _INSET_POS(x,y,w,h) x + w/10, y, w - w/5, h
54
   #define _INSET_POS(x,y,w,h) x + w/10, y, w - w/5, h
55
   #define INSET_POS(pos) _INSET_POS(pos)
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
 void BedMeshViewScreen::drawHighlightedPointValue() {
69
 void BedMeshViewScreen::drawHighlightedPointValue() {
70
   CommandProcessor cmd;
70
   CommandProcessor cmd;
71
   cmd.font(Theme::font_medium)
71
   cmd.font(Theme::font_medium)
72
-     .colors(normal_btn)
72
+     .cmd(COLOR_RGB(bg_text_enabled))
73
      .text(Z_LABEL_POS, GET_TEXT_F(MSG_MESH_EDIT_Z))
73
      .text(Z_LABEL_POS, GET_TEXT_F(MSG_MESH_EDIT_Z))
74
      .font(font_small);
74
      .font(font_small);
75
 
75
 
161
 void BedMeshViewScreen::doMeshValidation() {
161
 void BedMeshViewScreen::doMeshValidation() {
162
   mydata.count = 0;
162
   mydata.count = 0;
163
   GOTO_SCREEN(StatusScreen);
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
 void BedMeshViewScreen::show() {
167
 void BedMeshViewScreen::show() {

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

46
   w.heading(                  GET_TEXT_F(MSG_ZPROBE_ZOFFSET));
46
   w.heading(                  GET_TEXT_F(MSG_ZPROBE_ZOFFSET));
47
   w.color(z_axis).adjuster(4, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), getZOffset_mm());
47
   w.color(z_axis).adjuster(4, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), getZOffset_mm());
48
   w.increments();
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
   // We can't store state after the call to the AlertBox, so
53
   // We can't store state after the call to the AlertBox, so
54
   // check whether the current position equal mydata.z in order
54
   // check whether the current position equal mydata.z in order
55
   // to know whether the user started the wizard.
55
   // to know whether the user started the wizard.
56
   if (getAxisPosition_mm(Z) == mydata.z) {
56
   if (getAxisPosition_mm(Z) == mydata.z) {
57
-    mydata.z += inc;
57
+    // In the wizard
58
+    mydata.z += mm;
58
     setAxisPosition_mm(mydata.z, Z);
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
 void ZOffsetScreen::runWizard() {
67
 void ZOffsetScreen::runWizard() {
80
 }
85
 }
81
 
86
 
82
 bool ZOffsetScreen::onTouchHeld(uint8_t tag) {
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
   switch (tag) {
90
   switch (tag) {
85
     case 2: runWizard(); break;
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
     default:
94
     default:
89
       return false;
95
       return false;
90
   }
96
   }

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

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

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

70
   PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_2      = WEBSITE_URL;
70
   PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_2      = WEBSITE_URL;
71
   PROGMEM Language_Str MSG_LICENSE                  = u8"This program is free software: you can redistribute it and/or modify it under the terms of "
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
                                                         "the GNU General Public License as published by the Free Software Foundation, either version 3 "
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
                                                         "Public License, go to the following location: https://www.gnu.org/licenses.";
74
                                                         "Public License, go to the following location: https://www.gnu.org/licenses.";
75
   PROGMEM Language_Str MSG_RUNOUT_1                 = u8"Runout 1";
75
   PROGMEM Language_Str MSG_RUNOUT_1                 = u8"Runout 1";
76
   PROGMEM Language_Str MSG_RUNOUT_2                 = u8"Runout 2";
76
   PROGMEM Language_Str MSG_RUNOUT_2                 = u8"Runout 2";
130
   PROGMEM Language_Str MSG_EEPROM_RESTORED          = u8"Settings restored from backup";
130
   PROGMEM Language_Str MSG_EEPROM_RESTORED          = u8"Settings restored from backup";
131
   PROGMEM Language_Str MSG_EEPROM_RESET             = u8"Settings restored to default";
131
   PROGMEM Language_Str MSG_EEPROM_RESET             = u8"Settings restored to default";
132
   PROGMEM Language_Str MSG_EEPROM_SAVED             = u8"Settings saved!";
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
   PROGMEM Language_Str MSG_EEPROM_RESET_WARNING     = u8"Are you sure? Customizations will be lost.";
134
   PROGMEM Language_Str MSG_EEPROM_RESET_WARNING     = u8"Are you sure? Customizations will be lost.";
135
 
135
 
136
   PROGMEM Language_Str MSG_PASSCODE_REJECTED        = u8"Wrong passcode!";
136
   PROGMEM Language_Str MSG_PASSCODE_REJECTED        = u8"Wrong passcode!";

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

767
       return steps > 0 ? CEIL(steps) : FLOOR(steps);
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
   #endif // BABYSTEPPING
774
   #endif // BABYSTEPPING
771
 
775
 
772
   float getZOffset_mm() {
776
   float getZOffset_mm() {

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

239
 
239
 
240
   #if ENABLED(BABYSTEPPING)
240
   #if ENABLED(BABYSTEPPING)
241
     int16_t mmToWholeSteps(const_float_t mm, const axis_t axis);
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
     bool babystepAxis_steps(const int16_t steps, const axis_t axis);
244
     bool babystepAxis_steps(const int16_t steps, const axis_t axis);
244
     void smartAdjustAxis_steps(const int16_t steps, const axis_t axis, bool linked_nozzles);
245
     void smartAdjustAxis_steps(const int16_t steps, const axis_t axis, bool linked_nozzles);

Loading…
Cancel
Save