From 166324fc7b12119d5deded9ff51188bd6cba3173 Mon Sep 17 00:00:00 2001 From: Marcio T Date: Wed, 14 Jul 2021 21:13:08 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20and=20improve=20FTDI=20Eve?= =?UTF-8?q?=20Touch=20UI=20(#22361,=20#22439,=20#22459,=20#22468,=20#22500?= =?UTF-8?q?,=20#22530)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/LINUX/hardware/Gpio.h | 2 +- Marlin/src/HAL/LINUX/hardware/LinearAxis.cpp | 2 +- Marlin/src/HAL/LINUX/hardware/Timer.h | 2 +- .../bioprinter/advanced_settings.cpp | 2 +- .../bioprinter/confirm_home_e.cpp | 2 +- .../bioprinter/confirm_home_xyz.cpp | 2 +- .../bioprinter/main_menu.cpp | 20 +++--- .../bioprinter/status_screen.cpp | 2 +- .../bioprinter/tune_menu.cpp | 4 +- .../cocoa_press/advanced_settings_menu.cpp | 2 +- .../cocoa_press/leveling_menu.cpp | 4 +- .../cocoa_press/load_chocolate.cpp | 2 +- .../cocoa_press/main_menu.cpp | 2 +- .../cocoa_press/preheat_menu.cpp | 2 +- .../cocoa_press/preheat_screen.cpp | 2 +- .../ftdi_eve_touch_ui/cocoa_press/screens.h | 2 +- .../cocoa_press/status_screen.cpp | 2 +- .../ftdi_eve_lib/extended/adjuster_widget.cpp | 2 +- .../ftdi_eve_lib/extended/command_processor.h | 4 +- .../ftdi_eve_lib/extended/text_box.cpp | 12 ++-- .../ftdi_eve_lib/extended/text_ellipsis.cpp | 40 +++++------ .../ftdi_eve_lib/extended/unicode/unicode.cpp | 10 +-- .../generic/about_screen.cpp | 2 +- .../generic/advanced_settings_menu.cpp | 2 +- .../generic/alert_dialog_box.cpp | 8 +-- .../base_numeric_adjustment_screen.cpp | 2 +- .../generic/bed_mesh_edit_screen.cpp | 4 +- .../generic/change_filament_screen.cpp | 2 +- .../generic/custom_user_menus.cpp | 2 +- .../generic/dialog_box_base_class.cpp | 14 ++-- .../generic/dialog_box_base_class.h | 5 +- .../generic/endstop_state_screen.cpp | 2 +- .../generic/filament_menu.cpp | 2 +- .../generic/files_screen.cpp | 2 +- .../generic/interface_settings_screen.cpp | 6 +- .../generic/interface_sounds_screen.cpp | 56 +++------------- .../generic/interface_sounds_screen.h | 2 - .../generic/leveling_menu.cpp | 8 +-- .../ftdi_eve_touch_ui/generic/main_menu.cpp | 4 +- .../generic/move_axis_screen.cpp | 8 +-- .../generic/spinner_dialog_box.cpp | 67 +++++++++++++++---- .../generic/spinner_dialog_box.h | 15 +++-- .../generic/statistics_screen.cpp | 2 +- .../ftdi_eve_touch_ui/generic/tune_menu.cpp | 2 +- .../generic/z_offset_screen.cpp | 2 +- 45 files changed, 175 insertions(+), 168 deletions(-) diff --git a/Marlin/src/HAL/LINUX/hardware/Gpio.h b/Marlin/src/HAL/LINUX/hardware/Gpio.h index 2d9b1f29eb..f946be6484 100644 --- a/Marlin/src/HAL/LINUX/hardware/Gpio.h +++ b/Marlin/src/HAL/LINUX/hardware/Gpio.h @@ -40,7 +40,7 @@ struct GpioEvent { pin_type pin_id; GpioEvent::Type event; - GpioEvent(uint64_t timestamp, pin_type pin_id, GpioEvent::Type event){ + GpioEvent(uint64_t timestamp, pin_type pin_id, GpioEvent::Type event) { this->timestamp = timestamp; this->pin_id = pin_id; this->event = event; diff --git a/Marlin/src/HAL/LINUX/hardware/LinearAxis.cpp b/Marlin/src/HAL/LINUX/hardware/LinearAxis.cpp index c5b3ccc986..e122ef3666 100644 --- a/Marlin/src/HAL/LINUX/hardware/LinearAxis.cpp +++ b/Marlin/src/HAL/LINUX/hardware/LinearAxis.cpp @@ -51,7 +51,7 @@ void LinearAxis::update() { } void LinearAxis::interrupt(GpioEvent ev) { - if (ev.pin_id == step_pin && !Gpio::pin_map[enable_pin].value){ + if (ev.pin_id == step_pin && !Gpio::pin_map[enable_pin].value) { if (ev.event == GpioEvent::RISE) { last_update = ev.timestamp; position += -1 + 2 * Gpio::pin_map[dir_pin].value; diff --git a/Marlin/src/HAL/LINUX/hardware/Timer.h b/Marlin/src/HAL/LINUX/hardware/Timer.h index 757efdcdbd..1b3b800dca 100644 --- a/Marlin/src/HAL/LINUX/hardware/Timer.h +++ b/Marlin/src/HAL/LINUX/hardware/Timer.h @@ -52,7 +52,7 @@ public: return (*(intptr_t*)timerid); } - static void handler(int sig, siginfo_t *si, void *uc){ + static void handler(int sig, siginfo_t *si, void *uc) { Timer* _this = (Timer*)si->si_value.sival_ptr; _this->avg_error += (Clock::nanos() - _this->start_time) - _this->period; //high_resolution_clock is also limited in precision, but best we have _this->avg_error /= 2; //very crude precision analysis (actually within +-500ns usually) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp index fd478c95a2..40ec16a9df 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp @@ -87,7 +87,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(13) .button(BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE)) .tag(14) .button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_RESTORE_DEFAULTS)) .colors(action_btn) - .tag(1). button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); + .tag(1). button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); #undef GRID_COLS #undef GRID_ROWS } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_e.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_e.cpp index dedda6d215..a5511f94b9 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_e.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_e.cpp @@ -36,7 +36,7 @@ bool BioConfirmHomeE::onTouchEnd(uint8_t tag) { switch (tag) { case 1: #if defined(AXIS_LEVELING_COMMANDS) && defined(PARK_AND_RELEASE_COMMANDS) - SpinnerDialogBox::enqueueAndWait_P(F( + SpinnerDialogBox::enqueueAndWait(F( "G28 E\n" AXIS_LEVELING_COMMANDS "\n" PARK_AND_RELEASE_COMMANDS diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_xyz.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_xyz.cpp index bff1808d0d..e34df42b84 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_xyz.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_xyz.cpp @@ -36,7 +36,7 @@ bool BioConfirmHomeXYZ::onTouchEnd(uint8_t tag) { switch (tag) { case 1: #ifdef PARK_AND_RELEASE_COMMANDS - SpinnerDialogBox::enqueueAndWait_P(F( + SpinnerDialogBox::enqueueAndWait(F( "G28\n" PARK_AND_RELEASE_COMMANDS )); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/main_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/main_menu.cpp index ae5e7d8ab1..adc84dfa25 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/main_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/main_menu.cpp @@ -54,7 +54,7 @@ void MainMenu::onRedraw(draw_mode_t what) { .tag(8).button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_ADVANCED_SETTINGS)) .tag(9).button(BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_MENU)) .colors(action_btn) - .tag(1).button(BTN_POS(1,10), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); + .tag(1).button(BTN_POS(1,10), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); } #undef GRID_COLS @@ -67,17 +67,17 @@ bool MainMenu::onTouchEnd(uint8_t tag) { const bool e_homed = isAxisPositionKnown(E0); switch (tag) { - case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; - case 2: GOTO_SCREEN(BioConfirmHomeXYZ); break; - case 3: SpinnerDialogBox::enqueueAndWait_P(e_homed ? F("G0 E0 F120") : F("G112")); break; - case 4: StatusScreen::unlockMotors(); break; + case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; + case 2: GOTO_SCREEN(BioConfirmHomeXYZ); break; + case 3: SpinnerDialogBox::enqueueAndWait(e_homed ? F("G0 E0 F120") : F("G112")); break; + case 4: StatusScreen::unlockMotors(); break; #ifdef AXIS_LEVELING_COMMANDS - case 5: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break; + case 5: SpinnerDialogBox::enqueueAndWait(F(AXIS_LEVELING_COMMANDS)); break; #endif - case 6: GOTO_SCREEN(TemperatureScreen); break; - case 7: GOTO_SCREEN(InterfaceSettingsScreen); break; - case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; - case 9: GOTO_SCREEN(AboutScreen); break; + case 6: GOTO_SCREEN(TemperatureScreen); break; + case 7: GOTO_SCREEN(InterfaceSettingsScreen); break; + case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; + case 9: GOTO_SCREEN(AboutScreen); break; default: return false; } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp index 6fa4d761f6..1382a13bf8 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp @@ -316,7 +316,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { case 9: GOTO_SCREEN(FilesScreen); break; case 10: GOTO_SCREEN(MainMenu); break; case 13: GOTO_SCREEN(BioConfirmHomeE); break; - case 14: SpinnerDialogBox::enqueueAndWait_P(F("G28Z")); break; + case 14: SpinnerDialogBox::enqueueAndWait(F("G28Z")); break; case 15: GOTO_SCREEN(TemperatureScreen); break; case 16: fine_motion = !fine_motion; break; default: return false; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/tune_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/tune_menu.cpp index 31021c31c0..48eff0a661 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/tune_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/tune_menu.cpp @@ -54,7 +54,7 @@ void TuneMenu::onRedraw(draw_mode_t what) { .enabled(!isPrinting()).tag(5).button(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_MOVE_TO_HOME)) .enabled(!isPrinting()).tag(6).button(BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_RAISE_PLUNGER)) .enabled(!isPrinting()).tag(7).button(BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_RELEASE_XY_AXIS)) - .colors(action_btn) .tag(1).button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); + .colors(action_btn) .tag(1).button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); } #undef GRID_COLS #undef GRID_ROWS @@ -67,7 +67,7 @@ bool TuneMenu::onTouchEnd(uint8_t tag) { case 3: GOTO_SCREEN(TemperatureScreen); break; case 4: GOTO_SCREEN(NudgeNozzleScreen); break; case 5: GOTO_SCREEN(BioConfirmHomeXYZ); break; - case 6: SpinnerDialogBox::enqueueAndWait_P(F("G0 E0 F120")); break; + case 6: SpinnerDialogBox::enqueueAndWait(F("G0 E0 F120")); break; case 7: StatusScreen::unlockMotors(); break; default: return false; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp index d984dbe120..7549e8d54e 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp @@ -67,7 +67,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(10).button(DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU)) .tag(11).button(RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS)) .colors(action_btn) - .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp index 6718fe0a41..2e3472987e 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp @@ -71,7 +71,7 @@ void LevelingMenu::onRedraw(draw_mode_t what) { #undef GRID_COLS #define GRID_COLS 3 .colors(action_btn) - .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } @@ -82,7 +82,7 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) { case 3: BedMeshViewScreen::show(); break; case 4: BedMeshEditScreen::show(); break; case 5: injectCommands_P(PSTR("M280 P0 S60")); break; - case 6: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break; + case 6: SpinnerDialogBox::enqueueAndWait(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break; default: return false; } return true; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.cpp index 8c15cae60f..d40b3be354 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.cpp @@ -90,7 +90,7 @@ void LoadChocolateScreen::draw_buttons(draw_mode_t what) { cmd.tag(3).button(x, y, h, v, GET_TEXT_F(MSG_FULL_LOAD)); ui.bounds(POLY(load_screen_back_btn), x, y, h, v); - cmd.tag(1).colors(action_btn).button(x, y, h, v, GET_TEXT_F(MSG_BACK)); + cmd.tag(1).colors(action_btn).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_DONE)); } void LoadChocolateScreen::draw_text(draw_mode_t what) { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp index a990717fb3..3fe17b72d5 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp @@ -68,7 +68,7 @@ void MainMenu::onRedraw(draw_mode_t what) { .tag(10).button(LEVELING_POS, GET_TEXT_F(MSG_LEVELING)) .tag(11).button(ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) .colors(action_btn) - .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.cpp index 56e90ceb4d..424e0afa76 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.cpp @@ -65,7 +65,7 @@ void PreheatMenu::onRedraw(draw_mode_t what) { } #endif cmd.colors(action_btn) - .tag(1) .button(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); + .tag(1) .button(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_screen.cpp index 75b1fcc9c1..300878670e 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_screen.cpp @@ -77,7 +77,7 @@ void PreheatTimerScreen::draw_interaction_buttons(draw_mode_t what) { CommandProcessor cmd; cmd.colors(normal_btn) .font(font_medium) - .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/screens.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/screens.h index 87d31da6f6..8481e446c4 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/screens.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/screens.h @@ -108,7 +108,6 @@ enum { #include "../generic/display_tuning_screen.h" #include "../generic/statistics_screen.h" #include "../generic/stepper_current_screen.h" -#include "../generic/leveling_menu.h" #include "../generic/z_offset_screen.h" #include "../generic/bed_mesh_base.h" #include "../generic/bed_mesh_view_screen.h" @@ -130,5 +129,6 @@ enum { #include "preheat_menu.h" #include "preheat_screen.h" #include "load_chocolate.h" +#include "leveling_menu.h" #include "move_xyz_screen.h" #include "move_e_screen.h" diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp index 467d3b9119..af3875967d 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp @@ -233,7 +233,7 @@ bool StatusScreen::onTouchStart(uint8_t) { bool StatusScreen::onTouchEnd(uint8_t tag) { switch (tag) { - case 1: SpinnerDialogBox::enqueueAndWait_P(F("G28 O\nG27")); break; + case 1: SpinnerDialogBox::enqueueAndWait(F("G28 O\nG27")); break; case 2: GOTO_SCREEN(LoadChocolateScreen); break; case 3: GOTO_SCREEN(PreheatMenu); break; case 4: GOTO_SCREEN(MainMenu); break; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/adjuster_widget.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/adjuster_widget.cpp index 26be9f4e59..3ef71f573f 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/adjuster_widget.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/adjuster_widget.cpp @@ -42,7 +42,7 @@ namespace FTDI { strcat_P(str, (const char*) units); } - cmd.text(VAL_POS, str); + cmd.tag(0).text(VAL_POS, str); } void draw_adjuster(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t tag, float value, progmem_str units, int8_t width, uint8_t precision, draw_mode_t what) { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h index 9a83e9ee09..639f2cd990 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h @@ -232,13 +232,11 @@ class CommandProcessor : public CLCD::CommandFifo { FORCEDINLINE CommandProcessor& toggle(int16_t x, int16_t y, int16_t w, int16_t h, T text, bool state, uint16_t options = FTDI::OPT_3D) { CLCD::FontMetrics fm(_font); const int16_t widget_h = fm.height * 20.0 / 16; - //const int16_t outer_bar_r = widget_h / 2; - //const int16_t knob_r = outer_bar_r - 1.5; // The y coordinate of the toggle is the baseline of the text, // so we must introduce a fudge factor based on the line height to // actually center the control. const int16_t fudge_y = fm.height * 5 / 16; - CLCD::CommandFifo::toggle(x + h / 2, y + (h - widget_h) / 2 + fudge_y, w - h, _font, options, state); + CLCD::CommandFifo::toggle(x + widget_h, y + (h - widget_h) / 2 + fudge_y, w - widget_h, _font, options, state); CLCD::CommandFifo::str(text); return *this; } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp index 0701e7d682..544c5fed05 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp @@ -67,12 +67,12 @@ namespace FTDI { width = height = 0; for (;;) { const uint16_t line_width = find_line_break(utf8_fm, clcd_fm, wrap_width, line_start, line_end, use_utf8); - if (line_end == line_start) break; width = max(width, line_width); height += utf8_fm.get_height(); + if (*line_end == '\n' || *line_end == ' ') line_end++; + if (*line_end == '\0') break; + if (line_end == line_start) break; line_start = line_end; - if (*line_start == '\n' || *line_start == ' ') line_start++; - if (*line_start == '\0') break; } } @@ -109,7 +109,6 @@ namespace FTDI { const char *line_start = str, *line_end; for (;;) { find_line_break(utf8_fm, clcd_fm, w, line_start, line_end, use_utf8); - if (line_end == line_start) break; const size_t line_len = line_end - line_start; if (line_len) { @@ -125,9 +124,10 @@ namespace FTDI { } y += utf8_fm.get_height(); + if (*line_end == '\n' || *line_end == ' ') line_end++; + if (*line_end == '\0') break; + if (line_end == line_start) break; line_start = line_end; - if (*line_start == '\n' || *line_start == ' ') line_start++; - if (*line_start == '\0') break; } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp index 6a58dd2e49..4262dd1155 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp @@ -29,30 +29,30 @@ namespace FTDI { * Helper function for drawing text with ellipses. The str buffer may be modified and should have space for up to two extra characters. */ 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) { - FontMetrics fm(font); - const int16_t ellipsisWidth = fm.get_char_width('.') * 3; + #if ENABLED(TOUCH_UI_USE_UTF8) + const bool use_utf8 = has_utf8_chars(str); + #define CHAR_WIDTH(c) use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c] + #else + #define CHAR_WIDTH(c) utf8_fm.get_char_width(c) + constexpr bool use_utf8 = false; + #endif + FontMetrics utf8_fm(font); + CLCD::FontMetrics clcd_fm; + clcd_fm.load(font); + const int16_t ellipsisWidth = utf8_fm.get_char_width('.') * 3; // Compute the total line length, as well as // the location in the string where it can // split and still allow the ellipsis to fit. int16_t lineWidth = 0; - char *breakPoint = str; - #ifdef TOUCH_UI_USE_UTF8 - char *tstr = str; - while (*tstr) { - breakPoint = tstr; - const utf8_char_t c = get_utf8_char_and_inc(tstr); - lineWidth += fm.get_char_width(c); - if (lineWidth + ellipsisWidth < w) - break; - } - #else - for (char *c = str; *c; c++) { - lineWidth += fm.get_char_width(*c); - if (lineWidth + ellipsisWidth < w) - breakPoint = c; - } - #endif + char *breakPoint = str; + char *next = str; + while (*next) { + const utf8_char_t c = get_utf8_char_and_inc(next); + lineWidth += CHAR_WIDTH(c); + if (lineWidth + ellipsisWidth < w) + breakPoint = next; + } if (lineWidth > w) { *breakPoint = '\0'; @@ -61,7 +61,7 @@ namespace FTDI { cmd.apply_text_alignment(x, y, w, h, options); #if ENABLED(TOUCH_UI_USE_UTF8) - if (has_utf8_chars(str)) { + if (use_utf8) { draw_utf8_text(cmd, x, y, str, font_size_t::from_romfont(font), options); } else #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp index 2bb44e81d0..2da5d55ff0 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp @@ -68,15 +68,17 @@ utf8_char_t FTDI::get_utf8_char_and_inc(const char *&c) { utf8_char_t val = *(uint8_t*)c++; - while ((*c & 0xC0) == 0x80) - val = (val << 8) | *(uint8_t*)c++; + if ((val & 0xC0) == 0xC0) + while ((*c & 0xC0) == 0x80) + val = (val << 8) | *(uint8_t*)c++; return val; } utf8_char_t FTDI::get_utf8_char_and_inc(char *&c) { utf8_char_t val = *(uint8_t*)c++; - while ((*c & 0xC0) == 0x80) - val = (val << 8) | *(uint8_t*)c++; + if ((val & 0xC0) == 0xC0) + while ((*c & 0xC0) == 0x80) + val = (val << 8) | *(uint8_t*)c++; return val; } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp index ad6c9d4622..d2aec0baf7 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/about_screen.cpp @@ -96,7 +96,7 @@ void AboutScreen::onRedraw(draw_mode_t) { .tag(2).button(STATS_POS, GET_TEXT_F(MSG_INFO_STATS_MENU)); #endif cmd.colors(action_btn) - .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } bool AboutScreen::onTouchEnd(uint8_t tag) { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/advanced_settings_menu.cpp index 503abbdb05..a83cc07515 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/advanced_settings_menu.cpp @@ -111,7 +111,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .enabled(ENABLED(BACKLASH_GCODE)) .tag(8).button(BACKLASH_POS, GET_TEXT_F(MSG_BACKLASH)) .colors(action_btn) - .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/alert_dialog_box.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/alert_dialog_box.cpp index ccdfa89419..0d309bff75 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/alert_dialog_box.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/alert_dialog_box.cpp @@ -43,7 +43,7 @@ void AlertDialogBox::onRedraw(draw_mode_t what) { } template -void AlertDialogBox::show(const T message) { +void AlertDialogBox::show(T message) { drawMessage(message); storeBackground(); mydata.isError = false; @@ -51,7 +51,7 @@ void AlertDialogBox::show(const T message) { } template -void AlertDialogBox::showError(const T message) { +void AlertDialogBox::showError(T message) { drawMessage(message); storeBackground(); mydata.isError = true; @@ -64,8 +64,8 @@ void AlertDialogBox::hide() { } template void AlertDialogBox::show(const char *); -template void AlertDialogBox::show(const progmem_str); +template void AlertDialogBox::show(progmem_str); template void AlertDialogBox::showError(const char *); -template void AlertDialogBox::showError(const progmem_str); +template void AlertDialogBox::showError(progmem_str); #endif // FTDI_ALERT_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_numeric_adjustment_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_numeric_adjustment_screen.cpp index 90199783fd..d0ba74721c 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_numeric_adjustment_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_numeric_adjustment_screen.cpp @@ -61,7 +61,7 @@ BaseNumericAdjustmentScreen::widgets_t::widgets_t(draw_mode_t what) : _what(what #else BTN_POS(15,7), BTN_SIZE(4,1), #endif - GET_TEXT_F(MSG_BACK), true, true + GET_TEXT_F(MSG_BUTTON_DONE), true, true ); _line = 1; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_edit_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_edit_screen.cpp index 3dfcd429a5..c7d0cc3f73 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_edit_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/bed_mesh_edit_screen.cpp @@ -136,7 +136,7 @@ void BedMeshEditScreen::drawHighlightedPointValue() { if (mydata.highlight.x != NONE) draw_adjuster(cmd, Z_VALUE_POS, 3, getHighlightedValue(), GET_TEXT_F(MSG_UNITS_MM), 4, 3); cmd.colors(mydata.needSave ? normal_btn : action_btn) - .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_BACK)) + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)) .colors(mydata.needSave ? action_btn : normal_btn) .enabled(mydata.needSave) .tag(2).button(SAVE_POS, GET_TEXT_F(MSG_TOUCHMI_SAVE)); @@ -191,7 +191,7 @@ bool BedMeshEditScreen::onTouchEnd(uint8_t tag) { void BedMeshEditScreen::show() { // On entry, always home (to account for possible Z offset changes) and save current mesh - SpinnerDialogBox::enqueueAndWait_P(F("G28\nG29 S1")); + SpinnerDialogBox::enqueueAndWait(F("G28\nG29 S1")); // After the spinner, go to this screen. current_screen.forget(); PUSH_SCREEN(BedMeshEditScreen); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp index 46d3a4ea1c..fa0748c17b 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/change_filament_screen.cpp @@ -224,7 +224,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { .tag(6) .enabled(t_ok).button (LOAD_MOMN_POS, GET_TEXT_F(MSG_MOMENTARY)) .tag(7).TOG_STYLE(tog7).enabled(t_ok).button (UNLD_CONT_POS, GET_TEXT_F(MSG_CONTINUOUS)) .tag(8).TOG_STYLE(tog8).enabled(t_ok).button (LOAD_CONT_POS, GET_TEXT_F(MSG_CONTINUOUS)) - .tag(1).colors(action_btn) .button (BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).colors(action_btn) .button (BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/custom_user_menus.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/custom_user_menus.cpp index 5f8ff92922..8807480897 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/custom_user_menus.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/custom_user_menus.cpp @@ -135,7 +135,7 @@ void CustomUserMenus::onRedraw(draw_mode_t what) { _USER_ITEM(20) #endif .colors(action_btn) - .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.cpp index 0d604751f1..1811779297 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.cpp @@ -32,14 +32,14 @@ using namespace Theme; #define GRID_ROWS 8 template -void DialogBoxBaseClass::drawMessage(const T message, int16_t font) { +void DialogBoxBaseClass::drawMessage(T message, int16_t font) { CommandProcessor cmd; cmd.cmd(CMD_DLSTART) .cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)) .cmd(COLOR_RGB(bg_text_enabled)) .tag(0); - draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,3), message, OPT_CENTER, font ? font : font_large); + draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,6), message, OPT_CENTER, font ? font : font_large); cmd.colors(normal_btn); } @@ -59,17 +59,15 @@ void DialogBoxBaseClass::drawOkayButton() { .tag(1).button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_OKAY)); } -void DialogBoxBaseClass::drawButton(const progmem_str label) { +template +void DialogBoxBaseClass::drawButton(T label) { CommandProcessor cmd; cmd.font(font_medium) .tag(1).button(BTN_POS(1,8), BTN_SIZE(2,1), label); } -void DialogBoxBaseClass::drawSpinner() { - CommandProcessor cmd; - cmd.cmd(COLOR_RGB(bg_text_enabled)) - .spinner(BTN_POS(1,4), BTN_SIZE(2,3)).execute(); -} +template void DialogBoxBaseClass::drawButton(const char *); +template void DialogBoxBaseClass::drawButton(progmem_str); bool DialogBoxBaseClass::onTouchEnd(uint8_t tag) { switch (tag) { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.h index ef5e6b569b..c876409928 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/dialog_box_base_class.h @@ -27,11 +27,10 @@ class DialogBoxBaseClass : public BaseScreen { protected: - template static void drawMessage(const T, int16_t font = 0); + template static void drawMessage(T, int16_t font = 0); + template static void drawButton(T); static void drawYesNoButtons(uint8_t default_btn = 0); static void drawOkayButton(); - static void drawSpinner(); - static void drawButton(const progmem_str); static void onRedraw(draw_mode_t) {}; public: diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp index d12cb32e20..c7042e760e 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp @@ -120,7 +120,7 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) { cmd.font(font_medium) .colors(action_btn) - .tag(1).button(BTN_POS(1,7), BTN_SIZE(6,1), GET_TEXT_F(MSG_BACK)); + .tag(1).button(BTN_POS(1,7), BTN_SIZE(6,1), GET_TEXT_F(MSG_BUTTON_DONE)); #undef GRID_COLS #undef GRID_ROWS } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/filament_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/filament_menu.cpp index bd5fa96e8d..9c9e70cebf 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/filament_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/filament_menu.cpp @@ -63,7 +63,7 @@ void FilamentMenu::onRedraw(draw_mode_t what) { .enabled(ENABLED(LIN_ADVANCE)) .tag(3).button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE)) .colors(action_btn) - .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp index bf32502594..aa54e88967 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/files_screen.cpp @@ -168,7 +168,7 @@ void FilesScreen::drawFooter() { cmd.colors(normal_btn) .font(font_medium) .colors(has_selection ? normal_btn : action_btn) - .tag(back_tag).button(BTN_POS(4,y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BACK)) + .tag(back_tag).button(BTN_POS(4,y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_DONE)) .enabled(has_selection) .colors(has_selection ? action_btn : normal_btn); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_settings_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_settings_screen.cpp index a3febb39a2..5b160c80df 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_settings_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_settings_screen.cpp @@ -104,15 +104,15 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { #endif #undef EDGE_R #define EDGE_R 0 - #if ENABLED(TOUCH_UI_PORTRAIT) .colors(normal_btn) + #if ENABLED(TOUCH_UI_PORTRAIT) .tag(6).button (BTN_POS(1,6), BTN_SIZE(4,1), GET_TEXT_F(MSG_SOUNDS)) .colors(action_btn) - .tag(1).button (BTN_POS(1,7), BTN_SIZE(4,1), GET_TEXT_F(MSG_BACK)); + .tag(1).button (BTN_POS(1,7), BTN_SIZE(4,1), GET_TEXT_F(MSG_BUTTON_DONE)); #else .tag(6).button (BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_SOUNDS)) .colors(action_btn) - .tag(1).button (BTN_POS(3,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); + .tag(1).button (BTN_POS(3,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); #endif } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_sounds_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_sounds_screen.cpp index 3ba035f19b..889fd60684 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_sounds_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_sounds_screen.cpp @@ -74,8 +74,7 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) { #undef EDGE_R #define EDGE_R 30 .font(font_small) - .tag(0).text (BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_SOUND_VOLUME), OPT_RIGHTX | OPT_CENTERY) - .text (BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_CLICK_SOUNDS), OPT_RIGHTX | OPT_CENTERY) + .tag(0).text (BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_CLICK_SOUNDS), OPT_RIGHTX | OPT_CENTERY) .text (BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_STARTING), OPT_RIGHTX | OPT_CENTERY) .text (BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_FINISHED), OPT_RIGHTX | OPT_CENTERY) .text (BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_ERROR), OPT_RIGHTX | OPT_CENTERY); @@ -89,20 +88,18 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) { constexpr uint8_t w = 1; #endif - cmd.font(font_medium) - .colors(ui_slider) + cmd.font(font_small) #define EDGE_R 30 - .tag(2).slider (BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettingsScreen.volume, 0xFF) .colors(ui_toggle) - .tag(3).toggle2 (BTN_POS(3,3), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), UIData::touch_sounds_enabled()) + .tag(2).toggle2 (BTN_POS(3,3), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), UIData::touch_sounds_enabled()) #undef EDGE_R .colors(normal_btn) #define EDGE_R 0 - .tag(4).button (BTN_POS(3,5), BTN_SIZE(2,1), getSoundSelection(PRINTING_STARTED)) - .tag(5).button (BTN_POS(3,6), BTN_SIZE(2,1), getSoundSelection(PRINTING_FINISHED)) - .tag(6).button (BTN_POS(3,7), BTN_SIZE(2,1), getSoundSelection(PRINTING_FAILED)) + .tag(3).button (BTN_POS(3,5), BTN_SIZE(2,1), getSoundSelection(PRINTING_STARTED)) + .tag(4).button (BTN_POS(3,6), BTN_SIZE(2,1), getSoundSelection(PRINTING_FINISHED)) + .tag(5).button (BTN_POS(3,7), BTN_SIZE(2,1), getSoundSelection(PRINTING_FAILED)) .colors(action_btn) - .tag(1).button (BTN_POS(1,9), BTN_SIZE(4,1), GET_TEXT_F(MSG_BACK)); + .tag(1).button (BTN_POS(1,9), BTN_SIZE(4,1), GET_TEXT_F(MSG_BUTTON_DONE)); } } @@ -114,10 +111,10 @@ void InterfaceSoundsScreen::onEntry() { bool InterfaceSoundsScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); return true; - case 3: UIData::enable_touch_sounds(!UIData::touch_sounds_enabled()); break; - case 4: toggleSoundSelection(PRINTING_STARTED); break; - case 5: toggleSoundSelection(PRINTING_FINISHED); break; - case 6: toggleSoundSelection(PRINTING_FAILED); break; + case 2: UIData::enable_touch_sounds(!UIData::touch_sounds_enabled()); break; + case 3: toggleSoundSelection(PRINTING_STARTED); break; + case 4: toggleSoundSelection(PRINTING_FINISHED); break; + case 5: toggleSoundSelection(PRINTING_FAILED); break; default: return false; } @@ -125,35 +122,4 @@ bool InterfaceSoundsScreen::onTouchEnd(uint8_t tag) { return true; } -bool InterfaceSoundsScreen::onTouchStart(uint8_t tag) { - CommandProcessor cmd; - #undef EDGE_R - #define EDGE_R 30 - switch (tag) { - case 2: cmd.track_linear(BTN_POS(3,2), BTN_SIZE(2,1), 2).execute(); break; - default: break; - } - return true; -} - -void InterfaceSoundsScreen::onIdle() { - if (refresh_timer.elapsed(TOUCH_UPDATE_INTERVAL)) { - refresh_timer.start(); - - uint16_t value; - CommandProcessor cmd; - switch (cmd.track_tag(value)) { - case 2: - screen_data.InterfaceSettingsScreen.volume = value >> 8; - SoundPlayer::set_volume(screen_data.InterfaceSettingsScreen.volume); - SaveSettingsDialogBox::settingsChanged(); - break; - default: - return; - } - onRefresh(); - } - BaseScreen::onIdle(); -} - #endif // FTDI_INTERFACE_SOUNDS_SCREEN diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_sounds_screen.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_sounds_screen.h index 046d7390fe..258fc77c26 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_sounds_screen.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/interface_sounds_screen.h @@ -51,7 +51,5 @@ class InterfaceSoundsScreen : public BaseScreen, public CachedScreen { +class SpinnerDialogBox : public UIScreen { public: + static void onEntry(); + static void onExit(); static void onRedraw(draw_mode_t); + static void onRefresh(); static void onIdle(); - static void show(const progmem_str); + static void show(progmem_str); static void hide(); - static void enqueueAndWait_P(const progmem_str commands); - static void enqueueAndWait_P(const progmem_str message, const progmem_str commands); + + template + static void enqueueAndWait(T commands) {enqueueAndWait(GET_TEXT_F(MSG_PLEASE_WAIT), commands);} + + static void enqueueAndWait(progmem_str message, char *commands); + static void enqueueAndWait(progmem_str message, progmem_str commands); }; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/statistics_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/statistics_screen.cpp index 2153a1e1ad..b6d9770e9d 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/statistics_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/statistics_screen.cpp @@ -63,7 +63,7 @@ void StatisticsScreen::onRedraw(draw_mode_t what) { if (what & FOREGROUND) { cmd.font(Theme::font_medium) .colors(action_btn) - .tag(1).button(BTN_POS(1,7), BTN_SIZE(4,1), GET_TEXT_F(MSG_BACK)); + .tag(1).button(BTN_POS(1,7), BTN_SIZE(4,1), GET_TEXT_F(MSG_BUTTON_DONE)); } } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp index a5e2460631..6f4beb6673 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp @@ -92,7 +92,7 @@ void TuneMenu::onRedraw(draw_mode_t what) { .tag(10).button(CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT)) .tag(11).button(ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS)) .tag(1).colors(action_btn) - .button(BACK_POS, GET_TEXT_F(MSG_BACK)); + .button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } #undef GRID_COLS #undef GRID_ROWS diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp index 2a75596a03..eb36798794 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp @@ -84,7 +84,7 @@ void ZOffsetScreen::runWizard() { strcat(cmd, str); injectCommands(cmd); // Show instructions for user. - AlertDialogBox::show(PSTR("After the printer finishes homing, adjust the Z Offset so that a sheet of paper can pass between the nozzle and bed with slight resistance.")); + AlertDialogBox::show(F("After the printer finishes homing, adjust the Z Offset so that a sheet of paper can pass between the nozzle and bed with slight resistance.")); } bool ZOffsetScreen::wizardRunning() {