浏览代码

Improve and fix LULZBOT_TOUCH_UI (#15434)

- Add start print confirmation dialog box
- Fix incorrect text colors in UI
- Adjust bio printer UI
Marcio Teixeira 5 年前
父节点
当前提交
087fe0e9d6

+ 7
- 4
Marlin/src/lcd/extensible_ui/lib/lulzbot/language/language_en.h 查看文件

@@ -184,6 +184,7 @@ namespace Language_en {
184 184
   PROGMEM Language_Str ERASING                  = u8"Erasing...";
185 185
   PROGMEM Language_Str ERASED                   = u8"SPI flash erased";
186 186
   PROGMEM Language_Str CALIBRATION_WARNING      = u8"For best results, unload the filament and clean the hotend prior to starting calibration. Continue?";
187
+  PROGMEM Language_Str START_PRINT_CONFIRMATION = u8"Start printing %s?";
187 188
   PROGMEM Language_Str ABORT_WARNING            = u8"Are you sure you want to cancel the print?";
188 189
   PROGMEM Language_Str EXTRUDER_SELECTION       = u8"Extruder Selection";
189 190
   PROGMEM Language_Str CURRENT_TEMPERATURE      = u8"Current Temp";
@@ -222,10 +223,12 @@ namespace Language_en {
222 223
 
223 224
   #ifdef LULZBOT_USE_BIOPRINTER_UI
224 225
     PROGMEM Language_Str MAIN_MENU              = u8"Main Menu";
225
-    PROGMEM Language_Str RELEASE_XY_AXIS        = u8"Release XY Axis";
226
-    PROGMEM Language_Str LOAD_SYRINGE           = u8"Load Syringe";
226
+    PROGMEM Language_Str MOVE_TO_HOME           = u8"Move To Home";
227
+    PROGMEM Language_Str RAISE_PLUNGER          = u8"Raise Plunger";
228
+    PROGMEM Language_Str RELEASE_XY_AXIS        = u8"Release X and Y Axis";
229
+    PROGMEM Language_Str AUTOLEVEL_X_AXIS       = u8"Auto-level X Axis";
227 230
     PROGMEM Language_Str BED_TEMPERATURE        = u8"Bed Temperature";
228
-    PROGMEM Language_Str LOADING_WARNING        = u8"About to home to loading position. Ensure the top and the bed of the printer are clear.\n\nContinue?";
229
-    PROGMEM Language_Str HOMING_WARNING         = u8"About to re-home plunger and auto-level. Remove syringe prior to proceeding.\n\nContinue?";
231
+    PROGMEM Language_Str HOME_XYZ_WARNING       = u8"About to move to home position. Ensure the top and the bed of the printer are clear.\n\nContinue?";
232
+    PROGMEM Language_Str HOME_E_WARNING         = u8"About to re-home plunger and auto-level. Remove syringe prior to proceeding.\n\nContinue?";
230 233
   #endif
231 234
 }; // namespace Language_en

+ 0
- 26
Marlin/src/lcd/extensible_ui/lib/lulzbot/language/languages.h 查看文件

@@ -1,26 +0,0 @@
1
-/***************
2
- * languages.h *
3
- ***************/
4
-
5
-/****************************************************************************
6
- *   Written By Marcio Teixeira 2019 - Aleph Objects, Inc.                  *
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
- *   To view a copy of the GNU General Public License, go to the following  *
19
- *   location: <http://www.gnu.org/licenses/>.                              *
20
- ****************************************************************************/
21
-
22
-#pragma once
23
-
24
-#include "language_en.h"
25
-#include "language_de.h"
26
-#include "language_fr.h"

+ 27
- 20
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/base_numeric_adjustment_screen.cpp 查看文件

@@ -85,12 +85,14 @@ void BaseNumericAdjustmentScreen::widgets_t::_button_style(CommandProcessor &cmd
85 85
       default: break;
86 86
     }
87 87
 
88
-    const bool rgb_changed  =  old_colors->rgb  != new_colors->rgb;
88
+    const bool rgb_changed  =  (old_colors->rgb  != new_colors->rgb) ||
89
+                               (_style == TEXT_LABEL && style != TEXT_LABEL) ||
90
+                               (_style != TEXT_LABEL && style == TEXT_LABEL);
89 91
     const bool grad_changed =  old_colors->grad != new_colors->grad;
90 92
     const bool fg_changed   = (old_colors->fg   != new_colors->fg) || (_style == TEXT_AREA);
91 93
     const bool bg_changed   =  old_colors->bg   != new_colors->bg;
92 94
 
93
-    if (rgb_changed)  cmd.cmd(COLOR_RGB(new_colors->rgb));
95
+    if (rgb_changed)  cmd.cmd(COLOR_RGB(style == TEXT_LABEL ? bg_text_enabled : new_colors->rgb));
94 96
     if (grad_changed) cmd.gradcolor(new_colors->grad);
95 97
     if (fg_changed)   cmd.fgcolor(new_colors->fg);
96 98
     if (bg_changed)   cmd.bgcolor(new_colors->bg);
@@ -122,6 +124,7 @@ BaseNumericAdjustmentScreen::widgets_t &BaseNumericAdjustmentScreen::widgets_t::
122 124
 void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) {
123 125
   if (_what & BACKGROUND) {
124 126
     CommandProcessor cmd;
127
+    _button_style(cmd, TEXT_LABEL);
125 128
     cmd.font(font_medium)
126 129
        .text(
127 130
          #ifdef TOUCH_UI_PORTRAIT
@@ -208,11 +211,12 @@ void BaseNumericAdjustmentScreen::widgets_t::adjuster_sram_val(uint8_t tag, prog
208 211
   CommandProcessor cmd;
209 212
 
210 213
   if (_what & BACKGROUND) {
211
-    _button_style(cmd, TEXT_AREA);
214
+    _button_style(cmd, TEXT_LABEL);
212 215
     cmd.tag(0)
213 216
        .font(font_small)
214
-       .text( BTN_POS(1,_line), BTN_SIZE(4,1), label)
215
-       .fgcolor(_color).button( BTN_POS(5,_line), BTN_SIZE(5,1), F(""), OPT_FLAT);
217
+       .text( BTN_POS(1,_line), BTN_SIZE(4,1), label);
218
+    _button_style(cmd, TEXT_AREA);
219
+    cmd.fgcolor(_color).button( BTN_POS(5,_line), BTN_SIZE(5,1), F(""), OPT_FLAT);
216 220
   }
217 221
 
218 222
   cmd.font(font_medium);
@@ -267,12 +271,13 @@ void BaseNumericAdjustmentScreen::widgets_t::text_field(uint8_t tag, progmem_str
267 271
   CommandProcessor cmd;
268 272
 
269 273
   if (_what & BACKGROUND) {
270
-    _button_style(cmd, TEXT_AREA);
274
+    _button_style(cmd, TEXT_LABEL);
271 275
     cmd.enabled(1)
272 276
        .tag(0)
273 277
        .font(font_small)
274
-       .text(   BTN_POS(1,_line), BTN_SIZE(4,1), label)
275
-       .fgcolor(_color)
278
+       .text(   BTN_POS(1,_line), BTN_SIZE(4,1), label);
279
+    _button_style(cmd, TEXT_AREA);
280
+    cmd.fgcolor(_color)
276 281
        .tag(tag)
277 282
        .button( BTN_POS(5,_line), BTN_SIZE(9,1), F(""), OPT_FLAT);
278 283
   }
@@ -297,14 +302,15 @@ void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, progmem_str lab
297 302
   CommandProcessor cmd;
298 303
 
299 304
   if (_what & BACKGROUND) {
305
+    _button_style(cmd, TEXT_LABEL);
300 306
     cmd.font(font_small)
301 307
        .text(
302
-         #ifdef TOUCH_UI_PORTRAIT
303
-           BTN_POS(1, _line), BTN_SIZE( 8,1),
304
-         #else
305
-           BTN_POS(1, _line), BTN_SIZE(10,1),
306
-         #endif
307
-         label
308
+        #ifdef TOUCH_UI_PORTRAIT
309
+          BTN_POS(1, _line), BTN_SIZE( 8,1),
310
+        #else
311
+          BTN_POS(1, _line), BTN_SIZE(10,1),
312
+        #endif
313
+        label
308 314
        );
309 315
   }
310 316
 
@@ -314,12 +320,12 @@ void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, progmem_str lab
314 320
        .enabled(is_enabled)
315 321
        .font(font_small)
316 322
        .toggle2(
317
-         #ifdef TOUCH_UI_PORTRAIT
318
-           BTN_POS( 9,_line), BTN_SIZE(5,1),
319
-         #else
320
-           BTN_POS(10,_line), BTN_SIZE(4,1),
321
-         #endif
322
-         GET_TEXTF(NO), GET_TEXTF(YES), value
323
+        #ifdef TOUCH_UI_PORTRAIT
324
+          BTN_POS( 9,_line), BTN_SIZE(5,1),
325
+        #else
326
+          BTN_POS(10,_line), BTN_SIZE(4,1),
327
+        #endif
328
+        GET_TEXTF(NO), GET_TEXTF(YES), value
323 329
        );
324 330
   }
325 331
 
@@ -330,6 +336,7 @@ void BaseNumericAdjustmentScreen::widgets_t::home_buttons(uint8_t tag) {
330 336
   CommandProcessor cmd;
331 337
 
332 338
   if (_what & BACKGROUND) {
339
+    _button_style(cmd, TEXT_LABEL);
333 340
     cmd.font(font_small)
334 341
        .text(BTN_POS(1, _line), BTN_SIZE(4,1), GET_TEXTF(HOME));
335 342
   }

+ 6
- 2
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_confirm_home_e.cpp 查看文件

@@ -29,14 +29,18 @@
29 29
 using namespace FTDI;
30 30
 
31 31
 void BioConfirmHomeE::onRedraw(draw_mode_t) {
32
-  drawMessage(GET_TEXTF(HOMING_WARNING));
32
+  drawMessage(GET_TEXTF(HOME_E_WARNING));
33 33
   drawYesNoButtons(1);
34 34
 }
35 35
 
36 36
 bool BioConfirmHomeE::onTouchEnd(uint8_t tag) {
37 37
   switch (tag) {
38 38
     case 1:
39
-      SpinnerDialogBox::enqueueAndWait_P(F(LULZBOT_HOME_E_COMMANDS));
39
+      SpinnerDialogBox::enqueueAndWait_P(F(
40
+        "G112\n"
41
+        LULZBOT_AXIS_LEVELING_COMMANDS "\n"
42
+        LULZBOT_PARK_AND_RELEASE_COMMANDS
43
+      ));
40 44
       current_screen.forget();
41 45
       break;
42 46
     case 2:

+ 5
- 2
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_confirm_home_xyz.cpp 查看文件

@@ -29,14 +29,17 @@
29 29
 using namespace FTDI;
30 30
 
31 31
 void BioConfirmHomeXYZ::onRedraw(draw_mode_t) {
32
-  drawMessage(GET_TEXTF(LOADING_WARNING));
32
+  drawMessage(GET_TEXTF(HOME_XYZ_WARNING));
33 33
   drawYesNoButtons(1);
34 34
 }
35 35
 
36 36
 bool BioConfirmHomeXYZ::onTouchEnd(uint8_t tag) {
37 37
   switch (tag) {
38 38
     case 1:
39
-      SpinnerDialogBox::enqueueAndWait_P(F(LULZBOT_HOME_XYZ_COMMANDS));
39
+      SpinnerDialogBox::enqueueAndWait_P(F(
40
+       "G28\n"
41
+       LULZBOT_PARK_AND_RELEASE_COMMANDS
42
+      ));
40 43
       current_screen.forget();
41 44
       break;
42 45
     case 2:

+ 19
- 13
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_main_menu.cpp 查看文件

@@ -30,7 +30,7 @@ using namespace FTDI;
30 30
 using namespace Theme;
31 31
 
32 32
 void MainMenu::onRedraw(draw_mode_t what) {
33
-  #define GRID_ROWS 8
33
+  #define GRID_ROWS 10
34 34
   #define GRID_COLS 2
35 35
 
36 36
   if (what & BACKGROUND) {
@@ -45,14 +45,16 @@ void MainMenu::onRedraw(draw_mode_t what) {
45 45
        .font(font_large).text( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXTF(MAIN_MENU))
46 46
        .colors(normal_btn)
47 47
        .font(font_medium)
48
-       .tag(2).button( BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXTF(LOAD_SYRINGE))
49
-       .tag(3).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXTF(RELEASE_XY_AXIS))
50
-       .tag(4).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXTF(BED_TEMPERATURE))
51
-       .tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(INTERFACE_SETTINGS))
52
-       .tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(ADVANCED_SETTINGS))
53
-       .tag(7).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXTF(ABOUT_PRINTER))
48
+       .tag(2).button( BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXTF(MOVE_TO_HOME))
49
+       .tag(3).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXTF(RAISE_PLUNGER))
50
+       .tag(4).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXTF(RELEASE_XY_AXIS))
51
+       .tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(AUTOLEVEL_X_AXIS))
52
+       .tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(BED_TEMPERATURE))
53
+       .tag(7).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXTF(INTERFACE_SETTINGS))
54
+       .tag(8).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXTF(ADVANCED_SETTINGS))
55
+       .tag(9).button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXTF(ABOUT_PRINTER))
54 56
        .colors(action_btn)
55
-       .tag(1).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXTF(BACK));
57
+       .tag(1).button( BTN_POS(1,10), BTN_SIZE(2,1), GET_TEXTF(BACK));
56 58
   }
57 59
 
58 60
   #undef GRID_COLS
@@ -62,14 +64,18 @@ void MainMenu::onRedraw(draw_mode_t what) {
62 64
 bool MainMenu::onTouchEnd(uint8_t tag) {
63 65
   using namespace ExtUI;
64 66
 
67
+  const bool e_homed = isAxisPositionKnown(E0);
68
+
65 69
   switch (tag) {
66 70
     case 1: SaveSettingsDialogBox::promptToSaveSettings();                               break;
67 71
     case 2: GOTO_SCREEN(BioConfirmHomeXYZ);                                              break;
68
-    case 3: StatusScreen::unlockMotors();                                                break;
69
-    case 4:  GOTO_SCREEN(TemperatureScreen);                                             break;
70
-    case 5: GOTO_SCREEN(InterfaceSettingsScreen);                                        break;
71
-    case 6: GOTO_SCREEN(AdvancedSettingsMenu);                                           break;
72
-    case 7: GOTO_SCREEN(AboutScreen);                                                    break;
72
+    case 3: SpinnerDialogBox::enqueueAndWait_P(e_homed ? F("G0 E0 F120") : F("G112"));   break;
73
+    case 4: StatusScreen::unlockMotors();                                                break;
74
+    case 5: SpinnerDialogBox::enqueueAndWait_P(F(LULZBOT_AXIS_LEVELING_COMMANDS));       break;
75
+    case 6: GOTO_SCREEN(TemperatureScreen);                                              break;
76
+    case 7: GOTO_SCREEN(InterfaceSettingsScreen);                                        break;
77
+    case 8: GOTO_SCREEN(AdvancedSettingsMenu);                                           break;
78
+    case 9: GOTO_SCREEN(AboutScreen);                                                    break;
73 79
     default:
74 80
       return false;
75 81
   }

+ 1
- 1
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_status_screen.cpp 查看文件

@@ -275,7 +275,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
275 275
       break;
276 276
     case  9: GOTO_SCREEN(FilesScreen); break;
277 277
     case 10: GOTO_SCREEN(MainMenu); break;
278
-    case 13: SpinnerDialogBox::enqueueAndWait_P(F("G112"));  break;
278
+    case 13: GOTO_SCREEN(BioConfirmHomeE); break;
279 279
     case 14: SpinnerDialogBox::enqueueAndWait_P(F("G28 Z")); break;
280 280
     case 15: GOTO_SCREEN(TemperatureScreen);  break;
281 281
     case 16: fine_motion = !fine_motion; break;

+ 12
- 10
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_tune_menu.cpp 查看文件

@@ -38,7 +38,7 @@ void TuneMenu::onRedraw(draw_mode_t what) {
38 38
        .font(font_medium);
39 39
   }
40 40
 
41
-  #define GRID_ROWS 7
41
+  #define GRID_ROWS 8
42 42
   #define GRID_COLS 2
43 43
 
44 44
   if (what & FOREGROUND) {
@@ -55,9 +55,10 @@ void TuneMenu::onRedraw(draw_mode_t what) {
55 55
           .enabled(false)
56 56
         #endif
57 57
                               .tag(4).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXTF(NUDGE_NOZZLE))
58
-       .enabled(!isPrinting()).tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(LOAD_SYRINGE))
59
-       .enabled(!isPrinting()).tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(RELEASE_XY_AXIS))
60
-       .colors(action_btn)    .tag(1).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXTF(BACK));
58
+       .enabled(!isPrinting()).tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(MOVE_TO_HOME))
59
+       .enabled(!isPrinting()).tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(RAISE_PLUNGER))
60
+       .enabled(!isPrinting()).tag(7).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXTF(RELEASE_XY_AXIS))
61
+       .colors(action_btn)    .tag(1).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXTF(BACK));
61 62
   }
62 63
   #undef GRID_COLS
63 64
   #undef GRID_ROWS
@@ -65,12 +66,13 @@ void TuneMenu::onRedraw(draw_mode_t what) {
65 66
 
66 67
 bool TuneMenu::onTouchEnd(uint8_t tag) {
67 68
   switch (tag) {
68
-    case 1: GOTO_PREVIOUS();                    break;
69
-    case 2: GOTO_SCREEN(FeedratePercentScreen); break;
70
-    case 3: GOTO_SCREEN(TemperatureScreen);     break;
71
-    case 4: GOTO_SCREEN(NudgeNozzleScreen);     break;
72
-    case 5: GOTO_SCREEN(BioConfirmHomeXYZ);     break;
73
-    case 6: StatusScreen::unlockMotors();       break;
69
+    case 1: GOTO_PREVIOUS();                                     break;
70
+    case 2: GOTO_SCREEN(FeedratePercentScreen);                  break;
71
+    case 3: GOTO_SCREEN(TemperatureScreen);                      break;
72
+    case 4: GOTO_SCREEN(NudgeNozzleScreen);                      break;
73
+    case 5: GOTO_SCREEN(BioConfirmHomeXYZ);                      break;
74
+    case 6: SpinnerDialogBox::enqueueAndWait_P(F("G0 E0 F120")); break;
75
+    case 7: StatusScreen::unlockMotors();                        break;
74 76
     default:
75 77
       return false;
76 78
   }

+ 70
- 0
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/confirm_start_print_dialog_box.cpp 查看文件

@@ -0,0 +1,70 @@
1
+/**************************************
2
+ * confirm_start_print_dialog_box.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: <http://www.gnu.org/licenses/>.                              *
21
+ ****************************************************************************/
22
+
23
+#include "../config.h"
24
+
25
+#if ENABLED(LULZBOT_TOUCH_UI)
26
+
27
+#include "screens.h"
28
+#include "screen_data.h"
29
+
30
+using namespace FTDI;
31
+using namespace Theme;
32
+using namespace ExtUI;
33
+
34
+void ConfirmStartPrintDialogBox::onEntry() {
35
+  BaseScreen::onEntry();
36
+  sound.play(twinkle, PLAY_ASYNCHRONOUS);
37
+}
38
+
39
+void ConfirmStartPrintDialogBox::onRedraw(draw_mode_t) {
40
+  const char *filename = getLongFilename();
41
+  char buffer[strlen_P(GET_TEXT(START_PRINT_CONFIRMATION)) + strlen(filename) + 1];
42
+  sprintf_P(buffer, GET_TEXT(START_PRINT_CONFIRMATION), filename);
43
+  drawMessage((const char *)buffer);
44
+  drawYesNoButtons(1);
45
+}
46
+
47
+bool ConfirmStartPrintDialogBox::onTouchEnd(uint8_t tag) {
48
+  switch (tag) {
49
+    case 1:
50
+      printFile(getShortFilename());
51
+      StatusScreen::setStatusMessage(GET_TEXTF(PRINT_STARTING));
52
+      GOTO_SCREEN(StatusScreen);
53
+      return true;
54
+    case 2: GOTO_PREVIOUS(); return true;
55
+    default:                 return false;
56
+  }
57
+}
58
+
59
+const char *ConfirmStartPrintDialogBox::getFilename(bool longName) {
60
+  FileList files;
61
+  files.seek(screen_data.ConfirmStartPrintDialogBox.file_index, true);
62
+  return longName ? files.longFilename() : files.shortFilename();
63
+}
64
+
65
+void ConfirmStartPrintDialogBox::show(uint8_t file_index) {
66
+  screen_data.ConfirmStartPrintDialogBox.file_index = file_index;
67
+   GOTO_SCREEN(ConfirmStartPrintDialogBox);
68
+}
69
+
70
+#endif // LULZBOT_TOUCH_UI

+ 9
- 13
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/files_screen.cpp 查看文件

@@ -41,21 +41,15 @@ void FilesScreen::onEntry() {
41 41
   BaseScreen::onEntry();
42 42
 }
43 43
 
44
-const char *FilesScreen::getSelectedShortFilename() {
44
+const char *FilesScreen::getSelectedFilename(bool longName) {
45 45
   FileList files;
46
-  files.seek(getFileForTag(screen_data.FilesScreen.selected_tag), true);
47
-  return files.shortFilename();
48
-}
49
-
50
-const char *FilesScreen::getSelectedLongFilename() {
51
-  FileList files;
52
-  files.seek(getFileForTag(screen_data.FilesScreen.selected_tag), true);
53
-  return files.longFilename();
46
+  files.seek(getSelectedFileIndex(), true);
47
+  return longName ? files.longFilename() : files.shortFilename();
54 48
 }
55 49
 
56 50
 void FilesScreen::drawSelectedFile() {
57 51
   FileList files;
58
-  files.seek(getFileForTag(screen_data.FilesScreen.selected_tag), true);
52
+  files.seek(getSelectedFileIndex(), true);
59 53
   screen_data.FilesScreen.flags.is_dir = files.isDir();
60 54
   drawFileButton(
61 55
     files.filename(),
@@ -65,6 +59,10 @@ void FilesScreen::drawSelectedFile() {
65 59
   );
66 60
 }
67 61
 
62
+uint16_t FilesScreen::getSelectedFileIndex() {
63
+  return getFileForTag(screen_data.FilesScreen.selected_tag);
64
+}
65
+
68 66
 uint16_t FilesScreen::getFileForTag(uint8_t tag) {
69 67
   return screen_data.FilesScreen.cur_page * files_per_page + tag - 2;
70 68
 }
@@ -213,9 +211,7 @@ bool FilesScreen::onTouchEnd(uint8_t tag) {
213 211
       }
214 212
       break;
215 213
     case 243:
216
-      printFile(getSelectedShortFilename());
217
-      StatusScreen::setStatusMessage(GET_TEXTF(PRINT_STARTING));
218
-      GOTO_SCREEN(StatusScreen);
214
+      ConfirmStartPrintDialogBox::show(getSelectedFileIndex());
219 215
       return true;
220 216
     case 244:
221 217
       {

+ 1
- 0
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/screen_data.h 查看文件

@@ -35,6 +35,7 @@ union screen_data_t {
35 35
   struct {char passcode[5];}                   LockScreen;
36 36
   struct {bool isError;}                       AlertDialogBox;
37 37
   struct {bool auto_hide;}                     SpinnerDialogBox;
38
+  struct {uint8_t file_index;}                 ConfirmStartPrintDialogBox;
38 39
   struct {
39 40
     uint8_t e_tag, t_tag, repeat_tag;
40 41
     ExtUI::extruder_t saved_extruder;

+ 1
- 0
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/screens.cpp 查看文件

@@ -43,6 +43,7 @@ SCREEN_TABLE {
43 43
   DECL_SCREEN(ConfirmUserRequestAlertBox),
44 44
   DECL_SCREEN(RestoreFailsafeDialogBox),
45 45
   DECL_SCREEN(SaveSettingsDialogBox),
46
+  DECL_SCREEN(ConfirmStartPrintDialogBox),
46 47
   DECL_SCREEN(ConfirmAbortPrintDialogBox),
47 48
 #if ENABLED(CALIBRATION_GCODE)
48 49
   DECL_SCREEN(ConfirmAutoCalibrationDialogBox),

+ 20
- 3
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/screens.h 查看文件

@@ -179,6 +179,20 @@ class SaveSettingsDialogBox : public DialogBoxBaseClass, public UncachedScreen {
179 179
     static void settingsChanged() {needs_save = true;}
180 180
 };
181 181
 
182
+class ConfirmStartPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen {
183
+  private:
184
+    inline static const char *getShortFilename() {return getFilename(false);}
185
+    inline static const char *getLongFilename()  {return getFilename(true);}
186
+
187
+    static const char *getFilename(bool longName);
188
+  public:
189
+    static void onEntry();
190
+    static void onRedraw(draw_mode_t);
191
+    static bool onTouchEnd(uint8_t);
192
+
193
+    static void show(uint8_t file_index);
194
+};
195
+
182 196
 class ConfirmAbortPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen {
183 197
   public:
184 198
     static void onRedraw(draw_mode_t);
@@ -360,7 +374,8 @@ class BaseNumericAdjustmentScreen : public BaseScreen {
360 374
           BTN_ACTION,
361 375
           BTN_TOGGLE,
362 376
           BTN_DISABLED,
363
-          TEXT_AREA
377
+          TEXT_AREA,
378
+          TEXT_LABEL
364 379
         } _style;
365 380
 
366 381
       protected:
@@ -637,9 +652,11 @@ class FilesScreen : public BaseScreen, public CachedScreen<FILES_SCREEN_CACHE, F
637 652
     static uint8_t  getTagForLine(uint8_t line) {return line + 2;}
638 653
     static uint8_t  getLineForTag(uint8_t tag)  {return  tag - 2;}
639 654
     static uint16_t getFileForTag(uint8_t tag);
655
+    static uint16_t getSelectedFileIndex();
640 656
 
641
-    static const char *getSelectedShortFilename();
642
-    static const char *getSelectedLongFilename();
657
+    inline static const char *getSelectedShortFilename() {return getSelectedFilename(false);}
658
+    inline static const char *getSelectedLongFilename()  {return getSelectedFilename(true);}
659
+    static const char *getSelectedFilename(bool longName);
643 660
 
644 661
     static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted);
645 662
     static void drawFileList();

+ 0
- 6
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/string_format.cpp 查看文件

@@ -30,12 +30,6 @@
30 30
 #pragma GCC diagnostic push
31 31
 #pragma GCC diagnostic ignored "-Wno-format"
32 32
 
33
-#ifdef __AVR__
34
-  #define S_FMT "%S"
35
-#else
36
-  #define S_FMT "%s"
37
-#endif
38
-
39 33
 /**
40 34
  * Formats a temperature string (e.g. "100°C")
41 35
  */

正在加载...
取消
保存