Browse Source

Add missing FTDI EVE menu source (#19382)

Marcio T 3 years ago
parent
commit
941b890881
No account linked to committer's email address

+ 2
- 2
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp View File

@@ -30,12 +30,12 @@ namespace FTDI {
30 30
    */
31 31
   static void _draw_text_with_ellipsis(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, char *str, uint16_t options, uint8_t font) {
32 32
     FontMetrics fm(font);
33
-    const uint16_t ellipsisWidth = fm.get_char_width('.') * 3;
33
+    const int16_t ellipsisWidth = fm.get_char_width('.') * 3;
34 34
 
35 35
     // Compute the total line length, as well as
36 36
     // the location in the string where it can
37 37
     // split and still allow the ellipsis to fit.
38
-    uint16_t lineWidth = 0;
38
+    int16_t lineWidth = 0;
39 39
     char *breakPoint   = str;
40 40
     for(char* c = str; *c; c++) {
41 41
       lineWidth += fm.get_char_width(*c);

+ 3
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp View File

@@ -61,7 +61,9 @@ namespace ExtUI {
61 61
     if (AT_SCREEN(StatusScreen) || isPrintingFromMedia())
62 62
       StatusScreen::setStatusMessage(GET_TEXT_F(MSG_MEDIA_REMOVED));
63 63
 
64
-    if (AT_SCREEN(FilesScreen)) GOTO_SCREEN(StatusScreen);
64
+    #if ENABLED(SDSUPPORT)
65
+      if (AT_SCREEN(FilesScreen)) GOTO_SCREEN(StatusScreen);
66
+    #endif
65 67
   }
66 68
 
67 69
   void onMediaError() {

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp View File

@@ -304,7 +304,7 @@ void StatusScreen::draw_overlay_icons(draw_mode_t what) {
304 304
   PolyUI ui(cmd, what);
305 305
 
306 306
   if (what & FOREGROUND) {
307
-    ui.button_fill  (TERN(TOUCH_UI_COCOA_PRESS, stroke_rgb, fill_rgb);
307
+    ui.button_fill  (TERN(TOUCH_UI_COCOA_PRESS, stroke_rgb, fill_rgb));
308 308
     ui.button_stroke(stroke_rgb, 28);
309 309
     ui.button_shadow(shadow_rgb, shadow_depth);
310 310
 

+ 121
- 0
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp View File

@@ -0,0 +1,121 @@
1
+/*********************
2
+ * leveling_menu.cpp *
3
+ *********************/
4
+
5
+/****************************************************************************
6
+ *   Written By Mark Pelletier  2017 - Aleph Objects, Inc.                  *
7
+ *   Written By Marcio Teixeira 2018 - Aleph Objects, Inc.                  *
8
+ *                                                                          *
9
+ *   This program is free software: you can redistribute it and/or modify   *
10
+ *   it under the terms of the GNU General Public License as published by   *
11
+ *   the Free Software Foundation, either version 3 of the License, or      *
12
+ *   (at your option) any later version.                                    *
13
+ *                                                                          *
14
+ *   This program is distributed in the hope that it will be useful,        *
15
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
16
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
17
+ *   GNU General Public License for more details.                           *
18
+ *                                                                          *
19
+ *   To view a copy of the GNU General Public License, go to the following  *
20
+ *   location: <https://www.gnu.org/licenses/>.                              *
21
+ ****************************************************************************/
22
+
23
+#include "../config.h"
24
+
25
+#if BOTH(TOUCH_UI_FTDI_EVE,HAS_LEVELING)
26
+
27
+#include "screens.h"
28
+
29
+#if BOTH(HAS_BED_PROBE,BLTOUCH)
30
+  #include "../../../../../feature/bltouch.h"
31
+#endif
32
+
33
+using namespace FTDI;
34
+using namespace ExtUI;
35
+using namespace Theme;
36
+
37
+#ifdef TOUCH_UI_PORTRAIT
38
+  #define GRID_ROWS 9
39
+  #define GRID_COLS 2
40
+  #define TITLE_POS          BTN_POS(1,1), BTN_SIZE(2,1)
41
+  #define LEVEL_BED_POS      BTN_POS(1,2), BTN_SIZE(2,1)
42
+  #define LEVEL_AXIS_POS     BTN_POS(1,3), BTN_SIZE(2,1)
43
+  #define SHOW_MESH_POS      BTN_POS(1,4), BTN_SIZE(2,1)
44
+  #define BLTOUCH_TITLE_POS  BTN_POS(1,6), BTN_SIZE(2,1)
45
+  #define BLTOUCH_RESET_POS  BTN_POS(1,7), BTN_SIZE(1,1)
46
+  #define BLTOUCH_TEST_POS   BTN_POS(2,7), BTN_SIZE(1,1)
47
+  #define BACK_POS           BTN_POS(1,9), BTN_SIZE(2,1)
48
+#else
49
+  #define GRID_ROWS 7
50
+  #define GRID_COLS 2
51
+  #define TITLE_POS          BTN_POS(1,1), BTN_SIZE(2,1)
52
+  #define LEVEL_BED_POS      BTN_POS(1,2), BTN_SIZE(2,1)
53
+  #define LEVEL_AXIS_POS     BTN_POS(1,3), BTN_SIZE(2,1)
54
+  #define SHOW_MESH_POS      BTN_POS(1,4), BTN_SIZE(2,1)
55
+  #define BLTOUCH_TITLE_POS  BTN_POS(1,5), BTN_SIZE(2,1)
56
+  #define BLTOUCH_RESET_POS  BTN_POS(1,6), BTN_SIZE(1,1)
57
+  #define BLTOUCH_TEST_POS   BTN_POS(2,6), BTN_SIZE(1,1)
58
+  #define BACK_POS           BTN_POS(1,7), BTN_SIZE(2,1)
59
+#endif
60
+
61
+void LevelingMenu::onRedraw(draw_mode_t what) {
62
+  if (what & BACKGROUND) {
63
+    CommandProcessor cmd;
64
+    cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
65
+       .cmd(CLEAR(true,true,true))
66
+       .tag(0);
67
+  }
68
+
69
+  if (what & FOREGROUND) {
70
+    CommandProcessor cmd;
71
+    cmd.font(font_large)
72
+       .text(TITLE_POS, GET_TEXT_F(MSG_LEVELING))
73
+       .font(font_medium).colors(normal_btn)
74
+       .tag(2).button(LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED))
75
+       .enabled(
76
+         #ifdef AXIS_LEVELING_COMMANDS
77
+           1
78
+         #endif
79
+        )
80
+       .tag(3).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS))
81
+       .enabled(ENABLED(HAS_MESH))
82
+       .tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH));
83
+    #if ENABLED(BLTOUCH)
84
+      cmd.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH))
85
+         .tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET))
86
+         .tag(6).button(BLTOUCH_TEST_POS,  GET_TEXT_F(MSG_BLTOUCH_SELFTEST));
87
+    #endif
88
+    cmd.colors(action_btn)
89
+       .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
90
+  }
91
+}
92
+
93
+bool LevelingMenu::onTouchEnd(uint8_t tag) {
94
+  switch (tag) {
95
+    case 1: GOTO_PREVIOUS();                   break;
96
+    case 2:
97
+    #ifndef BED_LEVELING_COMMANDS
98
+      #define BED_LEVELING_COMMANDS "G29"
99
+    #endif
100
+    #if HAS_MESH
101
+      BedMeshScreen::startMeshProbe();
102
+    #else
103
+      SpinnerDialogBox::enqueueAndWait_P(F(BED_LEVELING_COMMANDS));
104
+    #endif
105
+    break;
106
+    #ifdef AXIS_LEVELING_COMMANDS
107
+    case 3: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break;
108
+    #endif
109
+    #if HAS_MESH
110
+    case 4: GOTO_SCREEN(BedMeshScreen); break;
111
+    #endif
112
+    #if ENABLED(BLTOUCH)
113
+    case 5: injectCommands_P(PSTR("M280 P0 S60")); break;
114
+    case 6: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
115
+    #endif
116
+    default: return false;
117
+  }
118
+  return true;
119
+}
120
+
121
+#endif // BOTH(TOUCH_UI_FTDI_EVE,HAS_LEVELING)

+ 3
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp View File

@@ -376,7 +376,9 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
376 376
   using namespace ExtUI;
377 377
 
378 378
   switch (tag) {
379
-    case 3: GOTO_SCREEN(FilesScreen); break;
379
+    #if ENABLED(SDSUPPORT)
380
+      case 3: GOTO_SCREEN(FilesScreen); break;
381
+    #endif
380 382
     case 4:
381 383
       if (isPrinting()) {
382 384
         GOTO_SCREEN(TuneMenu);

Loading…
Cancel
Save