From 90c04ee15d3ba3e686e33dafaa95c1e1f91f7870 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 3 Jan 2021 21:45:31 -0600 Subject: [PATCH] Rename FTDI EVE screen data structs --- .../screens/alert_dialog_box.cpp | 6 +- .../base_numeric_adjustment_screen.cpp | 12 ++-- .../screens/bed_mesh_screen.cpp | 42 ++++++------- .../screens/change_filament_screen.cpp | 52 ++++++++-------- .../screens/cocoa_press_move_e_screen.cpp | 10 ++-- .../screens/cocoa_press_preheat_menu.cpp | 2 +- .../screens/cocoa_press_preheat_screen.cpp | 6 +- .../confirm_start_print_dialog_box.cpp | 4 +- .../confirm_user_request_alert_box.cpp | 3 +- .../screens/files_screen.cpp | 60 +++++++++---------- .../screens/interface_settings_screen.cpp | 16 ++--- .../screens/interface_sounds_screen.cpp | 8 +-- .../ftdi_eve_touch_ui/screens/lock_screen.cpp | 20 +++---- .../screens/move_axis_screen.cpp | 28 ++++----- .../screens/nudge_nozzle_screen.cpp | 36 +++++------ .../ftdi_eve_touch_ui/screens/screen_data.h | 26 ++++---- .../screens/spinner_dialog_box.cpp | 8 +-- .../screens/stress_test_screen.cpp | 14 ++--- 18 files changed, 177 insertions(+), 176 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp index 89d9f05330..d63119afe5 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp @@ -32,7 +32,7 @@ using namespace Theme; void AlertDialogBox::onEntry() { BaseScreen::onEntry(); - sound.play(screen_data.AlertDialogBox.isError ? sad_trombone : twinkle, PLAY_ASYNCHRONOUS); + sound.play(screen_data.AlertDialog.isError ? sad_trombone : twinkle, PLAY_ASYNCHRONOUS); } void AlertDialogBox::onRedraw(draw_mode_t what) { @@ -45,7 +45,7 @@ template void AlertDialogBox::show(const T message) { drawMessage(message); storeBackground(); - screen_data.AlertDialogBox.isError = false; + screen_data.AlertDialog.isError = false; GOTO_SCREEN(AlertDialogBox); } @@ -53,7 +53,7 @@ template void AlertDialogBox::showError(const T message) { drawMessage(message); storeBackground(); - screen_data.AlertDialogBox.isError = true; + screen_data.AlertDialog.isError = true; GOTO_SCREEN(AlertDialogBox); } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp index 2d11f6948f..5271df3022 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp @@ -116,8 +116,8 @@ void BaseNumericAdjustmentScreen::widgets_t::_button(CommandProcessor &cmd, uint BaseNumericAdjustmentScreen::widgets_t &BaseNumericAdjustmentScreen::widgets_t::precision(uint8_t decimals, precision_default_t initial) { _decimals = decimals; - if (screen_data.BaseNumericAdjustmentScreen.increment == 0) { - screen_data.BaseNumericAdjustmentScreen.increment = 243 + (initial - DEFAULT_LOWEST) - _decimals; + if (screen_data.BaseNumericAdjustment.increment == 0) { + screen_data.BaseNumericAdjustment.increment = 243 + (initial - DEFAULT_LOWEST) - _decimals; } return *this; } @@ -154,7 +154,7 @@ void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) { void BaseNumericAdjustmentScreen::widgets_t::_draw_increment_btn(CommandProcessor &cmd, uint8_t, const uint8_t tag) { const char *label = PSTR("?"); uint8_t pos; - uint8_t & increment = screen_data.BaseNumericAdjustmentScreen.increment; + uint8_t & increment = screen_data.BaseNumericAdjustment.increment; if (increment == 0) { increment = tag; // Set the default value to be the first. @@ -358,7 +358,7 @@ void BaseNumericAdjustmentScreen::widgets_t::home_buttons(uint8_t tag) { } void BaseNumericAdjustmentScreen::onEntry() { - screen_data.BaseNumericAdjustmentScreen.increment = 0; // This will force the increment to be picked while drawing. + screen_data.BaseNumericAdjustment.increment = 0; // This will force the increment to be picked while drawing. BaseScreen::onEntry(); CommandProcessor cmd; cmd.set_button_style_callback(nullptr); @@ -367,14 +367,14 @@ void BaseNumericAdjustmentScreen::onEntry() { bool BaseNumericAdjustmentScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); return true; - case 240 ... 245: screen_data.BaseNumericAdjustmentScreen.increment = tag; break; + case 240 ... 245: screen_data.BaseNumericAdjustment.increment = tag; break; default: return current_screen.onTouchHeld(tag); } return true; } float BaseNumericAdjustmentScreen::getIncrement() { - switch (screen_data.BaseNumericAdjustmentScreen.increment) { + switch (screen_data.BaseNumericAdjustment.increment) { case 240: return 0.001; case 241: return 0.01; case 242: return 0.1; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp index 2ed602a809..9ac8c61efb 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp @@ -196,7 +196,7 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI:: } if (opts & USE_HIGHLIGHT) { - const uint8_t tag = screen_data.BedMeshScreen.highlightedTag; + const uint8_t tag = screen_data.BedMesh.highlightedTag; uint8_t x, y; if (tagToPoint(tag, x, y)) { cmd.cmd(COLOR_A(128)) @@ -221,16 +221,16 @@ bool BedMeshScreen::tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y) { } void BedMeshScreen::onEntry() { - screen_data.BedMeshScreen.highlightedTag = 0; - screen_data.BedMeshScreen.count = GRID_MAX_POINTS; - screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE; + screen_data.BedMesh.highlightedTag = 0; + screen_data.BedMesh.count = GRID_MAX_POINTS; + screen_data.BedMesh.message = screen_data.BedMesh.MSG_NONE; BaseScreen::onEntry(); } float BedMeshScreen::getHightlightedValue() { - if (screen_data.BedMeshScreen.highlightedTag) { + if (screen_data.BedMesh.highlightedTag) { xy_uint8_t pt; - tagToPoint(screen_data.BedMeshScreen.highlightedTag, pt.x, pt.y); + tagToPoint(screen_data.BedMesh.highlightedTag, pt.x, pt.y); return ExtUI::getMeshPoint(pt); } return NAN; @@ -253,9 +253,9 @@ void BedMeshScreen::drawHighlightedPointValue() { .tag(1).button(OKAY_POS, GET_TEXT_F(MSG_BUTTON_OKAY)) .tag(0); - switch (screen_data.BedMeshScreen.message) { - case screen_data.BedMeshScreen.MSG_MESH_COMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); break; - case screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE)); break; + switch (screen_data.BedMesh.message) { + case screen_data.BedMesh.MSG_MESH_COMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); break; + case screen_data.BedMesh.MSG_MESH_INCOMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE)); break; default: break; } } @@ -277,11 +277,11 @@ void BedMeshScreen::onRedraw(draw_mode_t what) { if (what & FOREGROUND) { constexpr float autoscale_max_amplitude = 0.03; - const bool gotAllPoints = screen_data.BedMeshScreen.count >= GRID_MAX_POINTS; + const bool gotAllPoints = screen_data.BedMesh.count >= GRID_MAX_POINTS; if (gotAllPoints) { drawHighlightedPointValue(); } - const float levelingProgress = sq(float(screen_data.BedMeshScreen.count) / GRID_MAX_POINTS); + const float levelingProgress = sq(float(screen_data.BedMesh.count) / GRID_MAX_POINTS); BedMeshScreen::drawMesh(INSET_POS(MESH_POS), ExtUI::getMeshArray(), USE_POINTS | USE_HIGHLIGHT | USE_AUTOSCALE | (gotAllPoints ? USE_COLORS : 0), autoscale_max_amplitude * levelingProgress @@ -290,7 +290,7 @@ void BedMeshScreen::onRedraw(draw_mode_t what) { } bool BedMeshScreen::onTouchStart(uint8_t tag) { - screen_data.BedMeshScreen.highlightedTag = tag; + screen_data.BedMesh.highlightedTag = tag; return true; } @@ -323,21 +323,21 @@ bool BedMeshScreen::isMeshComplete(ExtUI::bed_mesh_t data) { void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { switch (state) { case ExtUI::MESH_START: - screen_data.BedMeshScreen.count = 0; - screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE; + screen_data.BedMesh.count = 0; + screen_data.BedMesh.message = screen_data.BedMesh.MSG_NONE; break; case ExtUI::MESH_FINISH: - if (screen_data.BedMeshScreen.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray())) - screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_COMPLETE; + if (screen_data.BedMesh.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray())) + screen_data.BedMesh.message = screen_data.BedMesh.MSG_MESH_COMPLETE; else - screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE; - screen_data.BedMeshScreen.count = GRID_MAX_POINTS; + screen_data.BedMesh.message = screen_data.BedMesh.MSG_MESH_INCOMPLETE; + screen_data.BedMesh.count = GRID_MAX_POINTS; break; case ExtUI::PROBE_START: - screen_data.BedMeshScreen.highlightedTag = pointToTag(x, y); + screen_data.BedMesh.highlightedTag = pointToTag(x, y); break; case ExtUI::PROBE_FINISH: - screen_data.BedMeshScreen.count++; + screen_data.BedMesh.count++; break; } BedMeshScreen::onMeshUpdate(x, y, 0); @@ -345,7 +345,7 @@ void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::pr void BedMeshScreen::startMeshProbe() { GOTO_SCREEN(BedMeshScreen); - screen_data.BedMeshScreen.count = 0; + screen_data.BedMesh.count = 0; injectCommands_P(PSTR(BED_LEVELING_COMMANDS)); } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp index 3cb7942446..624bb263eb 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp @@ -122,17 +122,17 @@ void ChangeFilamentScreen::drawTempGradient(uint16_t x, uint16_t y, uint16_t w, void ChangeFilamentScreen::onEntry() { BaseScreen::onEntry(); - screen_data.ChangeFilamentScreen.e_tag = ExtUI::getActiveTool() + 10; - screen_data.ChangeFilamentScreen.t_tag = 0; - screen_data.ChangeFilamentScreen.repeat_tag = 0; - screen_data.ChangeFilamentScreen.saved_extruder = getActiveTool(); + screen_data.ChangeFilament.e_tag = ExtUI::getActiveTool() + 10; + screen_data.ChangeFilament.t_tag = 0; + screen_data.ChangeFilament.repeat_tag = 0; + screen_data.ChangeFilament.saved_extruder = getActiveTool(); #if FILAMENT_UNLOAD_PURGE_LENGTH > 0 - screen_data.ChangeFilamentScreen.need_purge = true; + screen_data.ChangeFilament.need_purge = true; #endif } void ChangeFilamentScreen::onExit() { - setActiveTool(screen_data.ChangeFilamentScreen.saved_extruder, true); + setActiveTool(screen_data.ChangeFilament.saved_extruder, true); } void ChangeFilamentScreen::onRedraw(draw_mode_t what) { @@ -170,7 +170,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10; - if (screen_data.ChangeFilamentScreen.t_tag && !t_ok) { + if (screen_data.ChangeFilament.t_tag && !t_ok) { cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING)); } else if (getActualTemp_celsius(e) > 100) { cmd.cmd(COLOR_RGB(0xFF0000)) @@ -181,12 +181,12 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { #define TOG_STYLE(A) colors(A ? action_btn : normal_btn) - const bool tog2 = screen_data.ChangeFilamentScreen.t_tag == 2; - const bool tog3 = screen_data.ChangeFilamentScreen.t_tag == 3; - const bool tog4 = screen_data.ChangeFilamentScreen.t_tag == 4; - const bool tog10 = screen_data.ChangeFilamentScreen.e_tag == 10; + const bool tog2 = screen_data.ChangeFilament.t_tag == 2; + const bool tog3 = screen_data.ChangeFilament.t_tag == 3; + const bool tog4 = screen_data.ChangeFilament.t_tag == 4; + const bool tog10 = screen_data.ChangeFilament.e_tag == 10; #if HAS_MULTI_HOTEND - const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11; + const bool tog11 = screen_data.ChangeFilament.e_tag == 11; #endif cmd.TOG_STYLE(tog10) @@ -200,8 +200,8 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { if (!t_ok) reset_menu_timeout(); - const bool tog7 = screen_data.ChangeFilamentScreen.repeat_tag == 7; - const bool tog8 = screen_data.ChangeFilamentScreen.repeat_tag == 8; + const bool tog7 = screen_data.ChangeFilament.repeat_tag == 7; + const bool tog8 = screen_data.ChangeFilament.repeat_tag == 8; { char str[30]; @@ -228,7 +228,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { } uint8_t ChangeFilamentScreen::getSoftenTemp() { - switch (screen_data.ChangeFilamentScreen.t_tag) { + switch (screen_data.ChangeFilament.t_tag) { case 2: return LOW_TEMP; case 3: return MED_TEMP; case 4: return HIGH_TEMP; @@ -237,7 +237,7 @@ uint8_t ChangeFilamentScreen::getSoftenTemp() { } ExtUI::extruder_t ChangeFilamentScreen::getExtruder() { - switch (screen_data.ChangeFilamentScreen.e_tag) { + switch (screen_data.ChangeFilament.e_tag) { case 13: return ExtUI::E3; case 12: return ExtUI::E2; case 11: return ExtUI::E1; @@ -248,8 +248,8 @@ ExtUI::extruder_t ChangeFilamentScreen::getExtruder() { void ChangeFilamentScreen::doPurge() { #if FILAMENT_UNLOAD_PURGE_LENGTH > 0 constexpr float purge_distance_mm = FILAMENT_UNLOAD_PURGE_LENGTH; - if (screen_data.ChangeFilamentScreen.need_purge) { - screen_data.ChangeFilamentScreen.need_purge = false; + if (screen_data.ChangeFilament.need_purge) { + screen_data.ChangeFilament.need_purge = false; MoveAxisScreen::setManualFeedrate(getExtruder(), purge_distance_mm); ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(getExtruder()) + purge_distance_mm, getExtruder()); } @@ -277,23 +277,23 @@ bool ChangeFilamentScreen::onTouchEnd(uint8_t tag) { case 3: case 4: // Change temperature - screen_data.ChangeFilamentScreen.t_tag = tag; + screen_data.ChangeFilament.t_tag = tag; setTargetTemp_celsius(getSoftenTemp(), getExtruder()); break; case 7: - screen_data.ChangeFilamentScreen.repeat_tag = (screen_data.ChangeFilamentScreen.repeat_tag == 7) ? 0 : 7; + screen_data.ChangeFilament.repeat_tag = (screen_data.ChangeFilament.repeat_tag == 7) ? 0 : 7; break; case 8: - screen_data.ChangeFilamentScreen.repeat_tag = (screen_data.ChangeFilamentScreen.repeat_tag == 8) ? 0 : 8; + screen_data.ChangeFilament.repeat_tag = (screen_data.ChangeFilament.repeat_tag == 8) ? 0 : 8; break; case 10: case 11: // Change extruder - screen_data.ChangeFilamentScreen.e_tag = tag; - screen_data.ChangeFilamentScreen.t_tag = 0; - screen_data.ChangeFilamentScreen.repeat_tag = 0; + screen_data.ChangeFilament.e_tag = tag; + screen_data.ChangeFilament.t_tag = 0; + screen_data.ChangeFilament.repeat_tag = 0; #if FILAMENT_UNLOAD_PURGE_LENGTH > 0 - screen_data.ChangeFilamentScreen.need_purge = true; + screen_data.ChangeFilament.need_purge = true; #endif setActiveTool(getExtruder(), true); break; @@ -319,7 +319,7 @@ bool ChangeFilamentScreen::onTouchHeld(uint8_t tag) { void ChangeFilamentScreen::onIdle() { reset_menu_timeout(); - if (screen_data.ChangeFilamentScreen.repeat_tag) onTouchHeld(screen_data.ChangeFilamentScreen.repeat_tag); + if (screen_data.ChangeFilament.repeat_tag) onTouchHeld(screen_data.ChangeFilament.repeat_tag); if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { onRefresh(); refresh_timer.start(); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.cpp index 6e2b4adc39..61411afa1b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.cpp @@ -38,15 +38,15 @@ void MoveEScreen::onRedraw(draw_mode_t what) { w.heading( GET_TEXT_F(MSG_E_MOVE)); w.color(Theme::e_axis); #if EXTRUDERS == 1 - w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), screen_data.MoveAxisScreen.e_rel[0], canMove(E0)); + w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), screen_data.MoveAxis.e_rel[0], canMove(E0)); #elif HAS_MULTI_EXTRUDER - w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxisScreen.e_rel[0], canMove(E0)); - w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxisScreen.e_rel[1], canMove(E1)); + w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxis.e_rel[0], canMove(E0)); + w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxis.e_rel[1], canMove(E1)); #if EXTRUDERS > 2 - w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), screen_data.MoveAxisScreen.e_rel[2], canMove(E2)); + w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), screen_data.MoveAxis.e_rel[2], canMove(E2)); #endif #if EXTRUDERS > 3 - w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), screen_data.MoveAxisScreen.e_rel[3], canMove(E3)); + w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), screen_data.MoveAxis.e_rel[3], canMove(E3)); #endif #endif w.increments(); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp index 4707924b20..99c0c1b664 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp @@ -21,7 +21,7 @@ #include "../config.h" -#if ENABLED(TOUCH_UI_FTDI_EVE) && defined(TOUCH_UI_COCOA_PRESS) +#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) #include "screens.h" diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp index e9996e4bc0..c9caef6524 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp @@ -21,7 +21,7 @@ #include "../config.h" -#if ENABLED(TOUCH_UI_FTDI_EVE) && defined(TOUCH_UI_COCOA_PRESS) +#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) #include "screens.h" #include "screen_data.h" @@ -54,7 +54,7 @@ void PreheatTimerScreen::draw_message(draw_mode_t what) { } uint16_t PreheatTimerScreen::secondsRemaining() { - const uint32_t elapsed_sec = (millis() - screen_data.PreheatTimerScreen.start_ms) / 1000; + const uint32_t elapsed_sec = (millis() - screen_data.PreheatTimer.start_ms) / 1000; return (COCOA_PRESS_PREHEAT_SECONDS > elapsed_sec) ? COCOA_PRESS_PREHEAT_SECONDS - elapsed_sec : 0; } @@ -118,7 +118,7 @@ void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, progmem_st } void PreheatTimerScreen::onEntry() { - screen_data.PreheatTimerScreen.start_ms = millis(); + screen_data.PreheatTimer.start_ms = millis(); } void PreheatTimerScreen::onRedraw(draw_mode_t what) { diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.cpp index 0dbee2414d..eeca88f280 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.cpp @@ -53,12 +53,12 @@ bool ConfirmStartPrintDialogBox::onTouchEnd(uint8_t tag) { const char *ConfirmStartPrintDialogBox::getFilename(bool longName) { FileList files; - files.seek(screen_data.ConfirmStartPrintDialogBox.file_index, true); + files.seek(screen_data.ConfirmStartPrintDialog.file_index, true); return longName ? files.longFilename() : files.shortFilename(); } void ConfirmStartPrintDialogBox::show(uint8_t file_index) { - screen_data.ConfirmStartPrintDialogBox.file_index = file_index; + screen_data.ConfirmStartPrintDialog.file_index = file_index; GOTO_SCREEN(ConfirmStartPrintDialogBox); } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.cpp index 93dfcba47d..637709e186 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.cpp @@ -47,7 +47,7 @@ bool ConfirmUserRequestAlertBox::onTouchEnd(uint8_t tag) { void ConfirmUserRequestAlertBox::show(const char* msg) { drawMessage(msg); storeBackground(); - screen_data.AlertDialogBox.isError = false; + screen_data.AlertDialog.isError = false; GOTO_SCREEN(ConfirmUserRequestAlertBox); } @@ -55,4 +55,5 @@ void ConfirmUserRequestAlertBox::hide() { if (AT_SCREEN(ConfirmUserRequestAlertBox)) GOTO_PREVIOUS(); } + #endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp index 112d70c074..cadc582267 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp @@ -32,8 +32,8 @@ using namespace ExtUI; using namespace Theme; void FilesScreen::onEntry() { - screen_data.FilesScreen.cur_page = 0; - screen_data.FilesScreen.selected_tag = 0xFF; + screen_data.Files.cur_page = 0; + screen_data.Files.selected_tag = 0xFF; #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) CLCD::mem_write_32(CLCD::REG::MACRO_0,DL::NOP); #endif @@ -50,21 +50,21 @@ const char *FilesScreen::getSelectedFilename(bool longName) { void FilesScreen::drawSelectedFile() { FileList files; files.seek(getSelectedFileIndex(), true); - screen_data.FilesScreen.flags.is_dir = files.isDir(); + screen_data.Files.flags.is_dir = files.isDir(); drawFileButton( files.filename(), - screen_data.FilesScreen.selected_tag, - screen_data.FilesScreen.flags.is_dir, + screen_data.Files.selected_tag, + screen_data.Files.flags.is_dir, true ); } uint16_t FilesScreen::getSelectedFileIndex() { - return getFileForTag(screen_data.FilesScreen.selected_tag); + return getFileForTag(screen_data.Files.selected_tag); } uint16_t FilesScreen::getFileForTag(uint8_t tag) { - return screen_data.FilesScreen.cur_page * files_per_page + tag - 2; + return screen_data.Files.cur_page * files_per_page + tag - 2; } #if ENABLED(TOUCH_UI_PORTRAIT) @@ -106,15 +106,15 @@ void FilesScreen::drawFileButton(const char* filename, uint8_t tag, bool is_dir, void FilesScreen::drawFileList() { FileList files; - screen_data.FilesScreen.num_page = max(1,ceil(float(files.count()) / files_per_page)); - screen_data.FilesScreen.cur_page = min(screen_data.FilesScreen.cur_page, screen_data.FilesScreen.num_page-1); - screen_data.FilesScreen.flags.is_root = files.isAtRootDir(); + screen_data.Files.num_page = max(1,ceil(float(files.count()) / files_per_page)); + screen_data.Files.cur_page = min(screen_data.Files.cur_page, screen_data.Files.num_page-1); + screen_data.Files.flags.is_root = files.isAtRootDir(); #undef MARGIN_T #undef MARGIN_B #define MARGIN_T 0 #define MARGIN_B 0 - uint16_t fileIndex = screen_data.FilesScreen.cur_page * files_per_page; + uint16_t fileIndex = screen_data.Files.cur_page * files_per_page; for (uint8_t i = 0; i < files_per_page; i++, fileIndex++) { if (files.seek(fileIndex)) { drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false); @@ -126,8 +126,8 @@ void FilesScreen::drawFileList() { } void FilesScreen::drawHeader() { - const bool prev_enabled = screen_data.FilesScreen.cur_page > 0; - const bool next_enabled = screen_data.FilesScreen.cur_page < (screen_data.FilesScreen.num_page - 1); + const bool prev_enabled = screen_data.Files.cur_page > 0; + const bool next_enabled = screen_data.Files.cur_page < (screen_data.Files.num_page - 1); #undef MARGIN_T #undef MARGIN_B @@ -136,7 +136,7 @@ void FilesScreen::drawHeader() { char str[16]; sprintf_P(str, PSTR("Page %d of %d"), - screen_data.FilesScreen.cur_page + 1, screen_data.FilesScreen.num_page); + screen_data.Files.cur_page + 1, screen_data.Files.num_page); CommandProcessor cmd; cmd.colors(normal_btn) @@ -158,8 +158,8 @@ void FilesScreen::drawFooter() { #define MARGIN_T 5 #define MARGIN_B 5 #endif - const bool has_selection = screen_data.FilesScreen.selected_tag != 0xFF; - const uint8_t back_tag = screen_data.FilesScreen.flags.is_root ? 240 : 245; + const bool has_selection = screen_data.Files.selected_tag != 0xFF; + const uint8_t back_tag = screen_data.Files.flags.is_root ? 240 : 245; const uint8_t y = GRID_ROWS - footer_h + 1; const uint8_t h = footer_h; @@ -171,7 +171,7 @@ void FilesScreen::drawFooter() { .enabled(has_selection) .colors(has_selection ? action_btn : normal_btn); - if (screen_data.FilesScreen.flags.is_dir) + if (screen_data.Files.flags.is_dir) cmd.tag(244).button(BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_OPEN)); else cmd.tag(243).button(BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_PRINT)); @@ -186,8 +186,8 @@ void FilesScreen::onRedraw(draw_mode_t what) { } void FilesScreen::gotoPage(uint8_t page) { - screen_data.FilesScreen.selected_tag = 0xFF; - screen_data.FilesScreen.cur_page = page; + screen_data.Files.selected_tag = 0xFF; + screen_data.Files.cur_page = page; CommandProcessor cmd; cmd.cmd(CMD_DLSTART) .cmd(CLEAR_COLOR_RGB(bg_color)) @@ -201,13 +201,13 @@ bool FilesScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 240: GOTO_PREVIOUS(); return true; case 241: - if (screen_data.FilesScreen.cur_page > 0) { - gotoPage(screen_data.FilesScreen.cur_page-1); + if (screen_data.Files.cur_page > 0) { + gotoPage(screen_data.Files.cur_page-1); } break; case 242: - if (screen_data.FilesScreen.cur_page < (screen_data.FilesScreen.num_page-1)) { - gotoPage(screen_data.FilesScreen.cur_page+1); + if (screen_data.Files.cur_page < (screen_data.Files.num_page-1)) { + gotoPage(screen_data.Files.cur_page+1); } break; case 243: @@ -229,18 +229,18 @@ bool FilesScreen::onTouchEnd(uint8_t tag) { break; default: if (tag < 240) { - screen_data.FilesScreen.selected_tag = tag; + screen_data.Files.selected_tag = tag; #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) if (FTDI::ftdi_chip >= 810) { const char *longFilename = getSelectedLongFilename(); if (longFilename[0]) { CommandProcessor cmd; uint16_t text_width = cmd.font(font_medium).text_width(longFilename); - screen_data.FilesScreen.scroll_pos = 0; + screen_data.Files.scroll_pos = 0; if (text_width > display_width) - screen_data.FilesScreen.scroll_max = text_width - display_width + MARGIN_L + MARGIN_R; + screen_data.Files.scroll_max = text_width - display_width + MARGIN_L + MARGIN_R; else - screen_data.FilesScreen.scroll_max = 0; + screen_data.Files.scroll_max = 0; } } #endif @@ -254,9 +254,9 @@ void FilesScreen::onIdle() { #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) if (FTDI::ftdi_chip >= 810) { CLCD::mem_write_32(CLCD::REG::MACRO_0, - VERTEX_TRANSLATE_X(-int32_t(screen_data.FilesScreen.scroll_pos))); - if (screen_data.FilesScreen.scroll_pos < screen_data.FilesScreen.scroll_max * 16) - screen_data.FilesScreen.scroll_pos++; + VERTEX_TRANSLATE_X(-int32_t(screen_data.Files.scroll_pos))); + if (screen_data.Files.scroll_pos < screen_data.Files.scroll_max * 16) + screen_data.Files.scroll_pos++; } #endif } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp index f0c6539bed..3d50b616fc 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp @@ -47,8 +47,8 @@ void InterfaceSettingsScreen::onStartup() { } void InterfaceSettingsScreen::onEntry() { - screen_data.InterfaceSettingsScreen.brightness = CLCD::get_brightness(); - screen_data.InterfaceSettingsScreen.volume = SoundPlayer::get_volume(); + screen_data.InterfaceSettings.brightness = CLCD::get_brightness(); + screen_data.InterfaceSettings.volume = SoundPlayer::get_volume(); BaseScreen::onEntry(); } @@ -96,9 +96,9 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { #define EDGE_R 30 .colors(ui_slider) #if DISABLED(LCD_FYSETC_TFT81050) - .tag(2).slider(BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettingsScreen.brightness, 128) + .tag(2).slider(BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettings.brightness, 128) #endif - .tag(3).slider(BTN_POS(3,3), BTN_SIZE(2,1), screen_data.InterfaceSettingsScreen.volume, 0xFF) + .tag(3).slider(BTN_POS(3,3), BTN_SIZE(2,1), screen_data.InterfaceSettings.volume, 0xFF) .colors(ui_toggle) .tag(4).toggle2(BTN_POS(3,4), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), LockScreen::is_enabled()) #if DISABLED(TOUCH_UI_NO_BOOTSCREEN) @@ -161,13 +161,13 @@ void InterfaceSettingsScreen::onIdle() { CommandProcessor cmd; switch (cmd.track_tag(value)) { case 2: - screen_data.InterfaceSettingsScreen.brightness = max(11, (value * 128UL) / 0xFFFF); - CLCD::set_brightness(screen_data.InterfaceSettingsScreen.brightness); + screen_data.InterfaceSettings.brightness = max(11, (value * 128UL) / 0xFFFF); + CLCD::set_brightness(screen_data.InterfaceSettings.brightness); SaveSettingsDialogBox::settingsChanged(); break; case 3: - screen_data.InterfaceSettingsScreen.volume = value >> 8; - SoundPlayer::set_volume(screen_data.InterfaceSettingsScreen.volume); + screen_data.InterfaceSettings.volume = value >> 8; + SoundPlayer::set_volume(screen_data.InterfaceSettings.volume); SaveSettingsDialogBox::settingsChanged(); break; default: diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp index 3e60639304..9f21c6b8c7 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp @@ -93,7 +93,7 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) { cmd.font(font_medium) .colors(ui_slider) #define EDGE_R 30 - .tag(2).slider (BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettingsScreen.volume, 0xFF) + .tag(2).slider (BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettings.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()) #undef EDGE_R @@ -108,7 +108,7 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) { } void InterfaceSoundsScreen::onEntry() { - screen_data.InterfaceSettingsScreen.volume = SoundPlayer::get_volume(); + screen_data.InterfaceSettings.volume = SoundPlayer::get_volume(); BaseScreen::onEntry(); } @@ -145,8 +145,8 @@ void InterfaceSoundsScreen::onIdle() { CommandProcessor cmd; switch (cmd.track_tag(value)) { case 2: - screen_data.InterfaceSettingsScreen.volume = value >> 8; - SoundPlayer::set_volume(screen_data.InterfaceSettingsScreen.volume); + screen_data.InterfaceSettings.volume = value >> 8; + SoundPlayer::set_volume(screen_data.InterfaceSettings.volume); SaveSettingsDialogBox::settingsChanged(); break; default: diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp index a3f2d09188..766f414a11 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp @@ -33,9 +33,9 @@ using namespace Theme; uint16_t LockScreen::passcode = 0; void LockScreen::onEntry() { - const uint8_t siz = sizeof(screen_data.LockScreen.passcode); - memset(screen_data.LockScreen.passcode, '_', siz-1); - screen_data.LockScreen.passcode[siz-1] = '\0'; + const uint8_t siz = sizeof(screen_data.Lock.passcode); + memset(screen_data.Lock.passcode, '_', siz-1); + screen_data.Lock.passcode[siz-1] = '\0'; BaseScreen::onEntry(); } @@ -84,11 +84,11 @@ void LockScreen::onRedraw(draw_mode_t what) { #if ENABLED(TOUCH_UI_PORTRAIT) .text(BTN_POS(1,2), BTN_SIZE(1,1), message) .font(font_xlarge) - .text(BTN_POS(1,4), BTN_SIZE(1,1), screen_data.LockScreen.passcode) + .text(BTN_POS(1,4), BTN_SIZE(1,1), screen_data.Lock.passcode) #else .text(BTN_POS(1,1), BTN_SIZE(1,1), message) .font(font_xlarge) - .text(BTN_POS(1,2), BTN_SIZE(1,1), screen_data.LockScreen.passcode) + .text(BTN_POS(1,2), BTN_SIZE(1,1), screen_data.Lock.passcode) #endif .font(font_large) .colors(normal_btn) @@ -117,8 +117,8 @@ void LockScreen::onRedraw(draw_mode_t what) { char &LockScreen::message_style() { // We use the last byte of the passcode string as a flag to indicate, // which message to show. - constexpr uint8_t last_char = sizeof(screen_data.LockScreen.passcode)-1; - return screen_data.LockScreen.passcode[last_char]; + constexpr uint8_t last_char = sizeof(screen_data.Lock.passcode)-1; + return screen_data.Lock.passcode[last_char]; } void LockScreen::onPasscodeEntered() { @@ -145,10 +145,10 @@ void LockScreen::onPasscodeEntered() { } bool LockScreen::onTouchEnd(uint8_t tag) { - char *c = strchr(screen_data.LockScreen.passcode,'_'); + char *c = strchr(screen_data.Lock.passcode,'_'); if (c) { if (tag == '<') { - if (c != screen_data.LockScreen.passcode) { + if (c != screen_data.Lock.passcode) { // Backspace deletes previous entered characters. *--c = '_'; } @@ -167,7 +167,7 @@ bool LockScreen::onTouchEnd(uint8_t tag) { uint16_t LockScreen::compute_checksum() { uint16_t checksum = 0; - const char* c = screen_data.LockScreen.passcode; + const char* c = screen_data.Lock.passcode; while (*c) { checksum = (checksum << 2) ^ *c++; } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp index 972b758024..75c6093955 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp @@ -37,7 +37,7 @@ void BaseMoveAxisScreen::onEntry() { // screen is entered. LOOP_L_N(i, ExtUI::extruderCount) { - screen_data.MoveAxisScreen.e_rel[i] = 0; + screen_data.MoveAxis.e_rel[i] = 0; } BaseNumericAdjustmentScreen::onEntry(); } @@ -54,15 +54,15 @@ void MoveAxisScreen::onRedraw(draw_mode_t what) { w.color(Theme::e_axis); #if EXTRUDERS == 1 - w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), screen_data.MoveAxisScreen.e_rel[0], canMove(E0)); + w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), screen_data.MoveAxis.e_rel[0], canMove(E0)); #elif HAS_MULTI_EXTRUDER - w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxisScreen.e_rel[0], canMove(E0)); - w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxisScreen.e_rel[1], canMove(E1)); + w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxis.e_rel[0], canMove(E0)); + w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxis.e_rel[1], canMove(E1)); #if EXTRUDERS > 2 - w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), screen_data.MoveAxisScreen.e_rel[2], canMove(E2)); + w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), screen_data.MoveAxis.e_rel[2], canMove(E2)); #endif #if EXTRUDERS > 3 - w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), screen_data.MoveAxisScreen.e_rel[3], canMove(E3)); + w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), screen_data.MoveAxis.e_rel[3], canMove(E3)); #endif #endif w.increments(); @@ -80,19 +80,19 @@ bool BaseMoveAxisScreen::onTouchHeld(uint8_t tag) { case 6: UI_DECREMENT_AXIS(Z); break; case 7: UI_INCREMENT_AXIS(Z); break; // For extruders, also update relative distances. - case 8: UI_DECREMENT_AXIS(E0); screen_data.MoveAxisScreen.e_rel[0] -= increment; break; - case 9: UI_INCREMENT_AXIS(E0); screen_data.MoveAxisScreen.e_rel[0] += increment; break; + case 8: UI_DECREMENT_AXIS(E0); screen_data.MoveAxis.e_rel[0] -= increment; break; + case 9: UI_INCREMENT_AXIS(E0); screen_data.MoveAxis.e_rel[0] += increment; break; #if HAS_MULTI_EXTRUDER - case 10: UI_DECREMENT_AXIS(E1); screen_data.MoveAxisScreen.e_rel[1] -= increment; break; - case 11: UI_INCREMENT_AXIS(E1); screen_data.MoveAxisScreen.e_rel[1] += increment; break; + case 10: UI_DECREMENT_AXIS(E1); screen_data.MoveAxis.e_rel[1] -= increment; break; + case 11: UI_INCREMENT_AXIS(E1); screen_data.MoveAxis.e_rel[1] += increment; break; #endif #if EXTRUDERS > 2 - case 12: UI_DECREMENT_AXIS(E2); screen_data.MoveAxisScreen.e_rel[2] -= increment; break; - case 13: UI_INCREMENT_AXIS(E2); screen_data.MoveAxisScreen.e_rel[2] += increment; break; + case 12: UI_DECREMENT_AXIS(E2); screen_data.MoveAxis.e_rel[2] -= increment; break; + case 13: UI_INCREMENT_AXIS(E2); screen_data.MoveAxis.e_rel[2] += increment; break; #endif #if EXTRUDERS > 3 - case 14: UI_DECREMENT_AXIS(E3); screen_data.MoveAxisScreen.e_rel[3] -= increment; break; - case 15: UI_INCREMENT_AXIS(E3); screen_data.MoveAxisScreen.e_rel[3] += increment; break; + case 14: UI_DECREMENT_AXIS(E3); screen_data.MoveAxis.e_rel[3] -= increment; break; + case 15: UI_INCREMENT_AXIS(E3); screen_data.MoveAxis.e_rel[3] += increment; break; #endif case 20: SpinnerDialogBox::enqueueAndWait_P(F("G28 X")); break; case 21: SpinnerDialogBox::enqueueAndWait_P(F("G28 Y")); break; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp index aac0f9a277..f0d3f7eec5 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp @@ -32,11 +32,11 @@ using namespace Theme; using namespace ExtUI; void NudgeNozzleScreen::onEntry() { - screen_data.NudgeNozzleScreen.show_offsets = false; + screen_data.NudgeNozzle.show_offsets = false; #if HAS_MULTI_EXTRUDER - screen_data.NudgeNozzleScreen.link_nozzles = true; + screen_data.NudgeNozzle.link_nozzles = true; #endif - screen_data.NudgeNozzleScreen.rel.reset(); + screen_data.NudgeNozzle.rel.reset(); BaseNumericAdjustmentScreen::onEntry(); } @@ -47,19 +47,19 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) { w.heading(GET_TEXT_F(MSG_NUDGE_NOZZLE)); #if ENABLED(BABYSTEP_XY) - w.color(x_axis).adjuster(2, GET_TEXT_F(MSG_AXIS_X), screen_data.NudgeNozzleScreen.rel.x / getAxisSteps_per_mm(X)); - w.color(y_axis).adjuster(4, GET_TEXT_F(MSG_AXIS_Y), screen_data.NudgeNozzleScreen.rel.y / getAxisSteps_per_mm(Y)); + w.color(x_axis).adjuster(2, GET_TEXT_F(MSG_AXIS_X), screen_data.NudgeNozzle.rel.x / getAxisSteps_per_mm(X)); + w.color(y_axis).adjuster(4, GET_TEXT_F(MSG_AXIS_Y), screen_data.NudgeNozzle.rel.y / getAxisSteps_per_mm(Y)); #endif - w.color(z_axis).adjuster(6, GET_TEXT_F(MSG_AXIS_Z), screen_data.NudgeNozzleScreen.rel.z / getAxisSteps_per_mm(Z)); + w.color(z_axis).adjuster(6, GET_TEXT_F(MSG_AXIS_Z), screen_data.NudgeNozzle.rel.z / getAxisSteps_per_mm(Z)); w.increments(); #if HAS_MULTI_EXTRUDER - w.toggle(8, GET_TEXT_F(MSG_ADJUST_BOTH_NOZZLES), screen_data.NudgeNozzleScreen.link_nozzles); + w.toggle(8, GET_TEXT_F(MSG_ADJUST_BOTH_NOZZLES), screen_data.NudgeNozzle.link_nozzles); #endif #if HAS_MULTI_EXTRUDER || HAS_BED_PROBE - w.toggle(9, GET_TEXT_F(MSG_SHOW_OFFSETS), screen_data.NudgeNozzleScreen.show_offsets); + w.toggle(9, GET_TEXT_F(MSG_SHOW_OFFSETS), screen_data.NudgeNozzle.show_offsets); - if (screen_data.NudgeNozzleScreen.show_offsets) { + if (screen_data.NudgeNozzle.show_offsets) { char str[19]; w.draw_mode(BOTH); @@ -83,22 +83,22 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) { bool NudgeNozzleScreen::onTouchHeld(uint8_t tag) { const float inc = getIncrement(); #if HAS_MULTI_EXTRUDER - const bool link = screen_data.NudgeNozzleScreen.link_nozzles; + const bool link = screen_data.NudgeNozzle.link_nozzles; #else constexpr bool link = true; #endif int16_t steps; switch (tag) { - case 2: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps(-steps, X, link); screen_data.NudgeNozzleScreen.rel.x -= steps; break; - case 3: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps( steps, X, link); screen_data.NudgeNozzleScreen.rel.x += steps; break; - case 4: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps(-steps, Y, link); screen_data.NudgeNozzleScreen.rel.y -= steps; break; - case 5: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps( steps, Y, link); screen_data.NudgeNozzleScreen.rel.y += steps; break; - case 6: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps(-steps, Z, link); screen_data.NudgeNozzleScreen.rel.z -= steps; break; - case 7: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps( steps, Z, link); screen_data.NudgeNozzleScreen.rel.z += steps; break; + case 2: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps(-steps, X, link); screen_data.NudgeNozzle.rel.x -= steps; break; + case 3: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps( steps, X, link); screen_data.NudgeNozzle.rel.x += steps; break; + case 4: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps(-steps, Y, link); screen_data.NudgeNozzle.rel.y -= steps; break; + case 5: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps( steps, Y, link); screen_data.NudgeNozzle.rel.y += steps; break; + case 6: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps(-steps, Z, link); screen_data.NudgeNozzle.rel.z -= steps; break; + case 7: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps( steps, Z, link); screen_data.NudgeNozzle.rel.z += steps; break; #if HAS_MULTI_EXTRUDER - case 8: screen_data.NudgeNozzleScreen.link_nozzles = !link; break; + case 8: screen_data.NudgeNozzle.link_nozzles = !link; break; #endif - case 9: screen_data.NudgeNozzleScreen.show_offsets = !screen_data.NudgeNozzleScreen.show_offsets; break; + case 9: screen_data.NudgeNozzle.show_offsets = !screen_data.NudgeNozzle.show_offsets; break; default: return false; } #if HAS_MULTI_EXTRUDER || HAS_BED_PROBE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h index dab411a256..fe35fc457b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h @@ -30,19 +30,19 @@ struct base_numeric_adjustment_t {uint8_t increment;}; union screen_data_t { - struct base_numeric_adjustment_t BaseNumericAdjustmentScreen; - struct {uint8_t volume; uint8_t brightness;} InterfaceSettingsScreen; - struct {char passcode[5];} LockScreen; - struct {bool isError;} AlertDialogBox; - struct {bool auto_hide;} SpinnerDialogBox; - struct {uint8_t file_index;} ConfirmStartPrintDialogBox; + struct base_numeric_adjustment_t BaseNumericAdjustment; + struct {uint8_t volume; uint8_t brightness;} InterfaceSettings; + struct {char passcode[5];} Lock; + struct {bool isError;} AlertDialog; + struct {bool auto_hide;} SpinnerDialog; + struct {uint8_t file_index;} ConfirmStartPrintDialog; struct { uint8_t e_tag, t_tag, repeat_tag; ExtUI::extruder_t saved_extruder; #if FILAMENT_UNLOAD_PURGE_LENGTH > 0 bool need_purge; #endif - } ChangeFilamentScreen; + } ChangeFilament; struct { struct { uint8_t is_dir : 1; @@ -55,11 +55,11 @@ union screen_data_t { uint16_t scroll_pos; uint16_t scroll_max; #endif - } FilesScreen; + } Files; struct { struct base_numeric_adjustment_t placeholder; float e_rel[ExtUI::extruderCount]; - } MoveAxisScreen; + } MoveAxis; #if HAS_MESH struct { enum : uint8_t { @@ -69,18 +69,18 @@ union screen_data_t { } message; uint8_t count; uint8_t highlightedTag; - } BedMeshScreen; + } BedMesh; #endif #if ENABLED(TOUCH_UI_DEVELOPER_MENU) struct { uint32_t next_watchdog_trigger; const char* message; - } StressTestScreen; + } StressTest; #endif #if ENABLED(TOUCH_UI_COCOA_PRESS) struct { uint32_t start_ms; - } PreheatTimerScreen; + } PreheatTimer; #endif #if ENABLED(BABYSTEPPING) struct { @@ -90,7 +90,7 @@ union screen_data_t { bool link_nozzles; #endif bool show_offsets; - } NudgeNozzleScreen; + } NudgeNozzle; #endif }; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.cpp index a4464c1e49..2318a0d108 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.cpp @@ -37,7 +37,7 @@ void SpinnerDialogBox::show(const progmem_str message) { drawMessage(message); drawSpinner(); storeBackground(); - screen_data.SpinnerDialogBox.auto_hide = false; + screen_data.SpinnerDialog.auto_hide = false; } void SpinnerDialogBox::hide() { @@ -53,13 +53,13 @@ void SpinnerDialogBox::enqueueAndWait_P(const progmem_str message, const progmem show(message); GOTO_SCREEN(SpinnerDialogBox); ExtUI::injectCommands_P((const char*)commands); - screen_data.SpinnerDialogBox.auto_hide = true; + screen_data.SpinnerDialog.auto_hide = true; } void SpinnerDialogBox::onIdle() { reset_menu_timeout(); - if (screen_data.SpinnerDialogBox.auto_hide && !commandsInQueue()) { - screen_data.SpinnerDialogBox.auto_hide = false; + if (screen_data.SpinnerDialog.auto_hide && !commandsInQueue()) { + screen_data.SpinnerDialog.auto_hide = false; hide(); GOTO_PREVIOUS(); } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.cpp index 2ffbdb9b8e..0aed1b7c53 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.cpp @@ -47,8 +47,8 @@ void StressTestScreen::drawDots(uint16_t x, uint16_t y, uint16_t w, uint16_t h) } bool StressTestScreen::watchDogTestNow() { - return screen_data.StressTestScreen.next_watchdog_trigger && - ELAPSED(millis(), screen_data.StressTestScreen.next_watchdog_trigger); + return screen_data.StressTest.next_watchdog_trigger && + ELAPSED(millis(), screen_data.StressTest.next_watchdog_trigger); } void StressTestScreen::onRedraw(draw_mode_t) { @@ -58,7 +58,7 @@ void StressTestScreen::onRedraw(draw_mode_t) { .cmd(CLEAR(true,true,true)) .cmd(COLOR_RGB(bg_text_enabled)) .font(font_medium) - .text(BTN_POS(1,1), BTN_SIZE(4,1), progmem_str(screen_data.StressTestScreen.message)); + .text(BTN_POS(1,1), BTN_SIZE(4,1), progmem_str(screen_data.StressTest.message)); drawDots(BTN_POS(1,3), BTN_SIZE(4,4)); @@ -92,8 +92,8 @@ void StressTestScreen::startupCheck() { } void StressTestScreen::onEntry() { - screen_data.StressTestScreen.next_watchdog_trigger = millis() + 10000 + random(40000); - screen_data.StressTestScreen.message = PSTR("Test 1: Stress testing..."); + screen_data.StressTest.next_watchdog_trigger = millis() + 10000 + random(40000); + screen_data.StressTest.message = PSTR("Test 1: Stress testing..."); // Turn off heaters. setTargetTemp_celsius(0, E0); @@ -104,13 +104,13 @@ void StressTestScreen::onEntry() { } void StressTestScreen::recursiveLockup() { - screen_data.StressTestScreen.message = PSTR("Test 2: Printer will restart."); + screen_data.StressTest.message = PSTR("Test 2: Printer will restart."); current_screen.onRefresh(); recursiveLockup(); } void StressTestScreen::iterativeLockup() { - screen_data.StressTestScreen.message = PSTR("Test 3: Printer will restart."); + screen_data.StressTest.message = PSTR("Test 3: Printer will restart."); for (;;) current_screen.onRefresh(); }