Improve and fix LULZBOT_TOUCH_UI (#15434)

- Add start print confirmation dialog box
- Fix incorrect text colors in UI
- Adjust bio printer UI
This commit is contained in:
Marcio Teixeira 2019-09-30 21:15:48 -06:00 committed by Scott Lahteine
parent b198f321c8
commit 087fe0e9d6
14 changed files with 178 additions and 100 deletions

View file

@ -184,6 +184,7 @@ namespace Language_en {
PROGMEM Language_Str ERASING = u8"Erasing..."; PROGMEM Language_Str ERASING = u8"Erasing...";
PROGMEM Language_Str ERASED = u8"SPI flash erased"; PROGMEM Language_Str ERASED = u8"SPI flash erased";
PROGMEM Language_Str CALIBRATION_WARNING = u8"For best results, unload the filament and clean the hotend prior to starting calibration. Continue?"; PROGMEM Language_Str CALIBRATION_WARNING = u8"For best results, unload the filament and clean the hotend prior to starting calibration. Continue?";
PROGMEM Language_Str START_PRINT_CONFIRMATION = u8"Start printing %s?";
PROGMEM Language_Str ABORT_WARNING = u8"Are you sure you want to cancel the print?"; PROGMEM Language_Str ABORT_WARNING = u8"Are you sure you want to cancel the print?";
PROGMEM Language_Str EXTRUDER_SELECTION = u8"Extruder Selection"; PROGMEM Language_Str EXTRUDER_SELECTION = u8"Extruder Selection";
PROGMEM Language_Str CURRENT_TEMPERATURE = u8"Current Temp"; PROGMEM Language_Str CURRENT_TEMPERATURE = u8"Current Temp";
@ -222,10 +223,12 @@ namespace Language_en {
#ifdef LULZBOT_USE_BIOPRINTER_UI #ifdef LULZBOT_USE_BIOPRINTER_UI
PROGMEM Language_Str MAIN_MENU = u8"Main Menu"; PROGMEM Language_Str MAIN_MENU = u8"Main Menu";
PROGMEM Language_Str RELEASE_XY_AXIS = u8"Release XY Axis"; PROGMEM Language_Str MOVE_TO_HOME = u8"Move To Home";
PROGMEM Language_Str LOAD_SYRINGE = u8"Load Syringe"; PROGMEM Language_Str RAISE_PLUNGER = u8"Raise Plunger";
PROGMEM Language_Str RELEASE_XY_AXIS = u8"Release X and Y Axis";
PROGMEM Language_Str AUTOLEVEL_X_AXIS = u8"Auto-level X Axis";
PROGMEM Language_Str BED_TEMPERATURE = u8"Bed Temperature"; PROGMEM Language_Str BED_TEMPERATURE = u8"Bed Temperature";
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?"; 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?";
PROGMEM Language_Str HOMING_WARNING = u8"About to re-home plunger and auto-level. Remove syringe prior to proceeding.\n\nContinue?"; PROGMEM Language_Str HOME_E_WARNING = u8"About to re-home plunger and auto-level. Remove syringe prior to proceeding.\n\nContinue?";
#endif #endif
}; // namespace Language_en }; // namespace Language_en

View file

@ -1,26 +0,0 @@
/***************
* languages.h *
***************/
/****************************************************************************
* Written By Marcio Teixeira 2019 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <http://www.gnu.org/licenses/>. *
****************************************************************************/
#pragma once
#include "language_en.h"
#include "language_de.h"
#include "language_fr.h"

View file

@ -85,12 +85,14 @@ void BaseNumericAdjustmentScreen::widgets_t::_button_style(CommandProcessor &cmd
default: break; default: break;
} }
const bool rgb_changed = old_colors->rgb != new_colors->rgb; const bool rgb_changed = (old_colors->rgb != new_colors->rgb) ||
(_style == TEXT_LABEL && style != TEXT_LABEL) ||
(_style != TEXT_LABEL && style == TEXT_LABEL);
const bool grad_changed = old_colors->grad != new_colors->grad; const bool grad_changed = old_colors->grad != new_colors->grad;
const bool fg_changed = (old_colors->fg != new_colors->fg) || (_style == TEXT_AREA); const bool fg_changed = (old_colors->fg != new_colors->fg) || (_style == TEXT_AREA);
const bool bg_changed = old_colors->bg != new_colors->bg; const bool bg_changed = old_colors->bg != new_colors->bg;
if (rgb_changed) cmd.cmd(COLOR_RGB(new_colors->rgb)); if (rgb_changed) cmd.cmd(COLOR_RGB(style == TEXT_LABEL ? bg_text_enabled : new_colors->rgb));
if (grad_changed) cmd.gradcolor(new_colors->grad); if (grad_changed) cmd.gradcolor(new_colors->grad);
if (fg_changed) cmd.fgcolor(new_colors->fg); if (fg_changed) cmd.fgcolor(new_colors->fg);
if (bg_changed) cmd.bgcolor(new_colors->bg); if (bg_changed) cmd.bgcolor(new_colors->bg);
@ -122,6 +124,7 @@ BaseNumericAdjustmentScreen::widgets_t &BaseNumericAdjustmentScreen::widgets_t::
void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) { void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) {
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
CommandProcessor cmd; CommandProcessor cmd;
_button_style(cmd, TEXT_LABEL);
cmd.font(font_medium) cmd.font(font_medium)
.text( .text(
#ifdef TOUCH_UI_PORTRAIT #ifdef TOUCH_UI_PORTRAIT
@ -208,11 +211,12 @@ void BaseNumericAdjustmentScreen::widgets_t::adjuster_sram_val(uint8_t tag, prog
CommandProcessor cmd; CommandProcessor cmd;
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
_button_style(cmd, TEXT_AREA); _button_style(cmd, TEXT_LABEL);
cmd.tag(0) cmd.tag(0)
.font(font_small) .font(font_small)
.text( BTN_POS(1,_line), BTN_SIZE(4,1), label) .text( BTN_POS(1,_line), BTN_SIZE(4,1), label);
.fgcolor(_color).button( BTN_POS(5,_line), BTN_SIZE(5,1), F(""), OPT_FLAT); _button_style(cmd, TEXT_AREA);
cmd.fgcolor(_color).button( BTN_POS(5,_line), BTN_SIZE(5,1), F(""), OPT_FLAT);
} }
cmd.font(font_medium); cmd.font(font_medium);
@ -267,12 +271,13 @@ void BaseNumericAdjustmentScreen::widgets_t::text_field(uint8_t tag, progmem_str
CommandProcessor cmd; CommandProcessor cmd;
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
_button_style(cmd, TEXT_AREA); _button_style(cmd, TEXT_LABEL);
cmd.enabled(1) cmd.enabled(1)
.tag(0) .tag(0)
.font(font_small) .font(font_small)
.text( BTN_POS(1,_line), BTN_SIZE(4,1), label) .text( BTN_POS(1,_line), BTN_SIZE(4,1), label);
.fgcolor(_color) _button_style(cmd, TEXT_AREA);
cmd.fgcolor(_color)
.tag(tag) .tag(tag)
.button( BTN_POS(5,_line), BTN_SIZE(9,1), F(""), OPT_FLAT); .button( BTN_POS(5,_line), BTN_SIZE(9,1), F(""), OPT_FLAT);
} }
@ -297,14 +302,15 @@ void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, progmem_str lab
CommandProcessor cmd; CommandProcessor cmd;
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
_button_style(cmd, TEXT_LABEL);
cmd.font(font_small) cmd.font(font_small)
.text( .text(
#ifdef TOUCH_UI_PORTRAIT #ifdef TOUCH_UI_PORTRAIT
BTN_POS(1, _line), BTN_SIZE( 8,1), BTN_POS(1, _line), BTN_SIZE( 8,1),
#else #else
BTN_POS(1, _line), BTN_SIZE(10,1), BTN_POS(1, _line), BTN_SIZE(10,1),
#endif #endif
label label
); );
} }
@ -314,12 +320,12 @@ void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, progmem_str lab
.enabled(is_enabled) .enabled(is_enabled)
.font(font_small) .font(font_small)
.toggle2( .toggle2(
#ifdef TOUCH_UI_PORTRAIT #ifdef TOUCH_UI_PORTRAIT
BTN_POS( 9,_line), BTN_SIZE(5,1), BTN_POS( 9,_line), BTN_SIZE(5,1),
#else #else
BTN_POS(10,_line), BTN_SIZE(4,1), BTN_POS(10,_line), BTN_SIZE(4,1),
#endif #endif
GET_TEXTF(NO), GET_TEXTF(YES), value GET_TEXTF(NO), GET_TEXTF(YES), value
); );
} }
@ -330,6 +336,7 @@ void BaseNumericAdjustmentScreen::widgets_t::home_buttons(uint8_t tag) {
CommandProcessor cmd; CommandProcessor cmd;
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
_button_style(cmd, TEXT_LABEL);
cmd.font(font_small) cmd.font(font_small)
.text(BTN_POS(1, _line), BTN_SIZE(4,1), GET_TEXTF(HOME)); .text(BTN_POS(1, _line), BTN_SIZE(4,1), GET_TEXTF(HOME));
} }

View file

@ -29,14 +29,18 @@
using namespace FTDI; using namespace FTDI;
void BioConfirmHomeE::onRedraw(draw_mode_t) { void BioConfirmHomeE::onRedraw(draw_mode_t) {
drawMessage(GET_TEXTF(HOMING_WARNING)); drawMessage(GET_TEXTF(HOME_E_WARNING));
drawYesNoButtons(1); drawYesNoButtons(1);
} }
bool BioConfirmHomeE::onTouchEnd(uint8_t tag) { bool BioConfirmHomeE::onTouchEnd(uint8_t tag) {
switch (tag) { switch (tag) {
case 1: case 1:
SpinnerDialogBox::enqueueAndWait_P(F(LULZBOT_HOME_E_COMMANDS)); SpinnerDialogBox::enqueueAndWait_P(F(
"G112\n"
LULZBOT_AXIS_LEVELING_COMMANDS "\n"
LULZBOT_PARK_AND_RELEASE_COMMANDS
));
current_screen.forget(); current_screen.forget();
break; break;
case 2: case 2:

View file

@ -29,14 +29,17 @@
using namespace FTDI; using namespace FTDI;
void BioConfirmHomeXYZ::onRedraw(draw_mode_t) { void BioConfirmHomeXYZ::onRedraw(draw_mode_t) {
drawMessage(GET_TEXTF(LOADING_WARNING)); drawMessage(GET_TEXTF(HOME_XYZ_WARNING));
drawYesNoButtons(1); drawYesNoButtons(1);
} }
bool BioConfirmHomeXYZ::onTouchEnd(uint8_t tag) { bool BioConfirmHomeXYZ::onTouchEnd(uint8_t tag) {
switch (tag) { switch (tag) {
case 1: case 1:
SpinnerDialogBox::enqueueAndWait_P(F(LULZBOT_HOME_XYZ_COMMANDS)); SpinnerDialogBox::enqueueAndWait_P(F(
"G28\n"
LULZBOT_PARK_AND_RELEASE_COMMANDS
));
current_screen.forget(); current_screen.forget();
break; break;
case 2: case 2:

View file

@ -30,7 +30,7 @@ using namespace FTDI;
using namespace Theme; using namespace Theme;
void MainMenu::onRedraw(draw_mode_t what) { void MainMenu::onRedraw(draw_mode_t what) {
#define GRID_ROWS 8 #define GRID_ROWS 10
#define GRID_COLS 2 #define GRID_COLS 2
if (what & BACKGROUND) { if (what & BACKGROUND) {
@ -45,14 +45,16 @@ void MainMenu::onRedraw(draw_mode_t what) {
.font(font_large).text( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXTF(MAIN_MENU)) .font(font_large).text( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXTF(MAIN_MENU))
.colors(normal_btn) .colors(normal_btn)
.font(font_medium) .font(font_medium)
.tag(2).button( BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXTF(LOAD_SYRINGE)) .tag(2).button( BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXTF(MOVE_TO_HOME))
.tag(3).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXTF(RELEASE_XY_AXIS)) .tag(3).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXTF(RAISE_PLUNGER))
.tag(4).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXTF(BED_TEMPERATURE)) .tag(4).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXTF(RELEASE_XY_AXIS))
.tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(INTERFACE_SETTINGS)) .tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(AUTOLEVEL_X_AXIS))
.tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(ADVANCED_SETTINGS)) .tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(BED_TEMPERATURE))
.tag(7).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXTF(ABOUT_PRINTER)) .tag(7).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXTF(INTERFACE_SETTINGS))
.tag(8).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXTF(ADVANCED_SETTINGS))
.tag(9).button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXTF(ABOUT_PRINTER))
.colors(action_btn) .colors(action_btn)
.tag(1).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXTF(BACK)); .tag(1).button( BTN_POS(1,10), BTN_SIZE(2,1), GET_TEXTF(BACK));
} }
#undef GRID_COLS #undef GRID_COLS
@ -62,14 +64,18 @@ void MainMenu::onRedraw(draw_mode_t what) {
bool MainMenu::onTouchEnd(uint8_t tag) { bool MainMenu::onTouchEnd(uint8_t tag) {
using namespace ExtUI; using namespace ExtUI;
const bool e_homed = isAxisPositionKnown(E0);
switch (tag) { switch (tag) {
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
case 2: GOTO_SCREEN(BioConfirmHomeXYZ); break; case 2: GOTO_SCREEN(BioConfirmHomeXYZ); break;
case 3: StatusScreen::unlockMotors(); break; case 3: SpinnerDialogBox::enqueueAndWait_P(e_homed ? F("G0 E0 F120") : F("G112")); break;
case 4: GOTO_SCREEN(TemperatureScreen); break; case 4: StatusScreen::unlockMotors(); break;
case 5: GOTO_SCREEN(InterfaceSettingsScreen); break; case 5: SpinnerDialogBox::enqueueAndWait_P(F(LULZBOT_AXIS_LEVELING_COMMANDS)); break;
case 6: GOTO_SCREEN(AdvancedSettingsMenu); break; case 6: GOTO_SCREEN(TemperatureScreen); break;
case 7: GOTO_SCREEN(AboutScreen); break; case 7: GOTO_SCREEN(InterfaceSettingsScreen); break;
case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
case 9: GOTO_SCREEN(AboutScreen); break;
default: default:
return false; return false;
} }

View file

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

View file

@ -38,7 +38,7 @@ void TuneMenu::onRedraw(draw_mode_t what) {
.font(font_medium); .font(font_medium);
} }
#define GRID_ROWS 7 #define GRID_ROWS 8
#define GRID_COLS 2 #define GRID_COLS 2
if (what & FOREGROUND) { if (what & FOREGROUND) {
@ -55,9 +55,10 @@ void TuneMenu::onRedraw(draw_mode_t what) {
.enabled(false) .enabled(false)
#endif #endif
.tag(4).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXTF(NUDGE_NOZZLE)) .tag(4).button( BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXTF(NUDGE_NOZZLE))
.enabled(!isPrinting()).tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(LOAD_SYRINGE)) .enabled(!isPrinting()).tag(5).button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(MOVE_TO_HOME))
.enabled(!isPrinting()).tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(RELEASE_XY_AXIS)) .enabled(!isPrinting()).tag(6).button( BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(RAISE_PLUNGER))
.colors(action_btn) .tag(1).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXTF(BACK)); .enabled(!isPrinting()).tag(7).button( BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXTF(RELEASE_XY_AXIS))
.colors(action_btn) .tag(1).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXTF(BACK));
} }
#undef GRID_COLS #undef GRID_COLS
#undef GRID_ROWS #undef GRID_ROWS
@ -65,12 +66,13 @@ void TuneMenu::onRedraw(draw_mode_t what) {
bool TuneMenu::onTouchEnd(uint8_t tag) { bool TuneMenu::onTouchEnd(uint8_t tag) {
switch (tag) { switch (tag) {
case 1: GOTO_PREVIOUS(); break; case 1: GOTO_PREVIOUS(); break;
case 2: GOTO_SCREEN(FeedratePercentScreen); break; case 2: GOTO_SCREEN(FeedratePercentScreen); break;
case 3: GOTO_SCREEN(TemperatureScreen); break; case 3: GOTO_SCREEN(TemperatureScreen); break;
case 4: GOTO_SCREEN(NudgeNozzleScreen); break; case 4: GOTO_SCREEN(NudgeNozzleScreen); break;
case 5: GOTO_SCREEN(BioConfirmHomeXYZ); break; case 5: GOTO_SCREEN(BioConfirmHomeXYZ); break;
case 6: StatusScreen::unlockMotors(); break; case 6: SpinnerDialogBox::enqueueAndWait_P(F("G0 E0 F120")); break;
case 7: StatusScreen::unlockMotors(); break;
default: default:
return false; return false;
} }

View file

@ -0,0 +1,70 @@
/**************************************
* confirm_start_print_dialog_box.cpp *
**************************************/
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <http://www.gnu.org/licenses/>. *
****************************************************************************/
#include "../config.h"
#if ENABLED(LULZBOT_TOUCH_UI)
#include "screens.h"
#include "screen_data.h"
using namespace FTDI;
using namespace Theme;
using namespace ExtUI;
void ConfirmStartPrintDialogBox::onEntry() {
BaseScreen::onEntry();
sound.play(twinkle, PLAY_ASYNCHRONOUS);
}
void ConfirmStartPrintDialogBox::onRedraw(draw_mode_t) {
const char *filename = getLongFilename();
char buffer[strlen_P(GET_TEXT(START_PRINT_CONFIRMATION)) + strlen(filename) + 1];
sprintf_P(buffer, GET_TEXT(START_PRINT_CONFIRMATION), filename);
drawMessage((const char *)buffer);
drawYesNoButtons(1);
}
bool ConfirmStartPrintDialogBox::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1:
printFile(getShortFilename());
StatusScreen::setStatusMessage(GET_TEXTF(PRINT_STARTING));
GOTO_SCREEN(StatusScreen);
return true;
case 2: GOTO_PREVIOUS(); return true;
default: return false;
}
}
const char *ConfirmStartPrintDialogBox::getFilename(bool longName) {
FileList files;
files.seek(screen_data.ConfirmStartPrintDialogBox.file_index, true);
return longName ? files.longFilename() : files.shortFilename();
}
void ConfirmStartPrintDialogBox::show(uint8_t file_index) {
screen_data.ConfirmStartPrintDialogBox.file_index = file_index;
GOTO_SCREEN(ConfirmStartPrintDialogBox);
}
#endif // LULZBOT_TOUCH_UI

View file

@ -41,21 +41,15 @@ void FilesScreen::onEntry() {
BaseScreen::onEntry(); BaseScreen::onEntry();
} }
const char *FilesScreen::getSelectedShortFilename() { const char *FilesScreen::getSelectedFilename(bool longName) {
FileList files; FileList files;
files.seek(getFileForTag(screen_data.FilesScreen.selected_tag), true); files.seek(getSelectedFileIndex(), true);
return files.shortFilename(); return longName ? files.longFilename() : files.shortFilename();
}
const char *FilesScreen::getSelectedLongFilename() {
FileList files;
files.seek(getFileForTag(screen_data.FilesScreen.selected_tag), true);
return files.longFilename();
} }
void FilesScreen::drawSelectedFile() { void FilesScreen::drawSelectedFile() {
FileList files; FileList files;
files.seek(getFileForTag(screen_data.FilesScreen.selected_tag), true); files.seek(getSelectedFileIndex(), true);
screen_data.FilesScreen.flags.is_dir = files.isDir(); screen_data.FilesScreen.flags.is_dir = files.isDir();
drawFileButton( drawFileButton(
files.filename(), files.filename(),
@ -65,6 +59,10 @@ void FilesScreen::drawSelectedFile() {
); );
} }
uint16_t FilesScreen::getSelectedFileIndex() {
return getFileForTag(screen_data.FilesScreen.selected_tag);
}
uint16_t FilesScreen::getFileForTag(uint8_t tag) { uint16_t FilesScreen::getFileForTag(uint8_t tag) {
return screen_data.FilesScreen.cur_page * files_per_page + tag - 2; return screen_data.FilesScreen.cur_page * files_per_page + tag - 2;
} }
@ -213,9 +211,7 @@ bool FilesScreen::onTouchEnd(uint8_t tag) {
} }
break; break;
case 243: case 243:
printFile(getSelectedShortFilename()); ConfirmStartPrintDialogBox::show(getSelectedFileIndex());
StatusScreen::setStatusMessage(GET_TEXTF(PRINT_STARTING));
GOTO_SCREEN(StatusScreen);
return true; return true;
case 244: case 244:
{ {

View file

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

View file

@ -43,6 +43,7 @@ SCREEN_TABLE {
DECL_SCREEN(ConfirmUserRequestAlertBox), DECL_SCREEN(ConfirmUserRequestAlertBox),
DECL_SCREEN(RestoreFailsafeDialogBox), DECL_SCREEN(RestoreFailsafeDialogBox),
DECL_SCREEN(SaveSettingsDialogBox), DECL_SCREEN(SaveSettingsDialogBox),
DECL_SCREEN(ConfirmStartPrintDialogBox),
DECL_SCREEN(ConfirmAbortPrintDialogBox), DECL_SCREEN(ConfirmAbortPrintDialogBox),
#if ENABLED(CALIBRATION_GCODE) #if ENABLED(CALIBRATION_GCODE)
DECL_SCREEN(ConfirmAutoCalibrationDialogBox), DECL_SCREEN(ConfirmAutoCalibrationDialogBox),

View file

@ -179,6 +179,20 @@ class SaveSettingsDialogBox : public DialogBoxBaseClass, public UncachedScreen {
static void settingsChanged() {needs_save = true;} static void settingsChanged() {needs_save = true;}
}; };
class ConfirmStartPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen {
private:
inline static const char *getShortFilename() {return getFilename(false);}
inline static const char *getLongFilename() {return getFilename(true);}
static const char *getFilename(bool longName);
public:
static void onEntry();
static void onRedraw(draw_mode_t);
static bool onTouchEnd(uint8_t);
static void show(uint8_t file_index);
};
class ConfirmAbortPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen { class ConfirmAbortPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen {
public: public:
static void onRedraw(draw_mode_t); static void onRedraw(draw_mode_t);
@ -360,7 +374,8 @@ class BaseNumericAdjustmentScreen : public BaseScreen {
BTN_ACTION, BTN_ACTION,
BTN_TOGGLE, BTN_TOGGLE,
BTN_DISABLED, BTN_DISABLED,
TEXT_AREA TEXT_AREA,
TEXT_LABEL
} _style; } _style;
protected: protected:
@ -637,9 +652,11 @@ class FilesScreen : public BaseScreen, public CachedScreen<FILES_SCREEN_CACHE, F
static uint8_t getTagForLine(uint8_t line) {return line + 2;} static uint8_t getTagForLine(uint8_t line) {return line + 2;}
static uint8_t getLineForTag(uint8_t tag) {return tag - 2;} static uint8_t getLineForTag(uint8_t tag) {return tag - 2;}
static uint16_t getFileForTag(uint8_t tag); static uint16_t getFileForTag(uint8_t tag);
static uint16_t getSelectedFileIndex();
static const char *getSelectedShortFilename(); inline static const char *getSelectedShortFilename() {return getSelectedFilename(false);}
static const char *getSelectedLongFilename(); inline static const char *getSelectedLongFilename() {return getSelectedFilename(true);}
static const char *getSelectedFilename(bool longName);
static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted); static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted);
static void drawFileList(); static void drawFileList();

View file

@ -30,12 +30,6 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wno-format" #pragma GCC diagnostic ignored "-Wno-format"
#ifdef __AVR__
#define S_FMT "%S"
#else
#define S_FMT "%s"
#endif
/** /**
* Formats a temperature string (e.g. "100°C") * Formats a temperature string (e.g. "100°C")
*/ */