Browse Source

Rename FTDI EVE screen data structs

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
committed by Scott Lahteine
parent
commit
90c04ee15d
  1. 6
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp
  2. 12
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp
  3. 42
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp
  4. 52
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp
  5. 10
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.cpp
  6. 2
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp
  7. 6
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp
  8. 4
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.cpp
  9. 3
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.cpp
  10. 60
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp
  11. 16
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp
  12. 8
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp
  13. 20
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp
  14. 28
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp
  15. 36
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp
  16. 26
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h
  17. 8
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.cpp
  18. 14
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.cpp

6
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp

@ -32,7 +32,7 @@ using namespace Theme;
void AlertDialogBox::onEntry() { void AlertDialogBox::onEntry() {
BaseScreen::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) { void AlertDialogBox::onRedraw(draw_mode_t what) {
@ -45,7 +45,7 @@ template<typename T>
void AlertDialogBox::show(const T message) { void AlertDialogBox::show(const T message) {
drawMessage(message); drawMessage(message);
storeBackground(); storeBackground();
screen_data.AlertDialogBox.isError = false; screen_data.AlertDialog.isError = false;
GOTO_SCREEN(AlertDialogBox); GOTO_SCREEN(AlertDialogBox);
} }
@ -53,7 +53,7 @@ template<typename T>
void AlertDialogBox::showError(const T message) { void AlertDialogBox::showError(const T message) {
drawMessage(message); drawMessage(message);
storeBackground(); storeBackground();
screen_data.AlertDialogBox.isError = true; screen_data.AlertDialog.isError = true;
GOTO_SCREEN(AlertDialogBox); GOTO_SCREEN(AlertDialogBox);
} }

12
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) { BaseNumericAdjustmentScreen::widgets_t &BaseNumericAdjustmentScreen::widgets_t::precision(uint8_t decimals, precision_default_t initial) {
_decimals = decimals; _decimals = decimals;
if (screen_data.BaseNumericAdjustmentScreen.increment == 0) { if (screen_data.BaseNumericAdjustment.increment == 0) {
screen_data.BaseNumericAdjustmentScreen.increment = 243 + (initial - DEFAULT_LOWEST) - _decimals; screen_data.BaseNumericAdjustment.increment = 243 + (initial - DEFAULT_LOWEST) - _decimals;
} }
return *this; 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) { void BaseNumericAdjustmentScreen::widgets_t::_draw_increment_btn(CommandProcessor &cmd, uint8_t, const uint8_t tag) {
const char *label = PSTR("?"); const char *label = PSTR("?");
uint8_t pos; uint8_t pos;
uint8_t & increment = screen_data.BaseNumericAdjustmentScreen.increment; uint8_t & increment = screen_data.BaseNumericAdjustment.increment;
if (increment == 0) { if (increment == 0) {
increment = tag; // Set the default value to be the first. 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() { 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(); BaseScreen::onEntry();
CommandProcessor cmd; CommandProcessor cmd;
cmd.set_button_style_callback(nullptr); cmd.set_button_style_callback(nullptr);
@ -367,14 +367,14 @@ void BaseNumericAdjustmentScreen::onEntry() {
bool BaseNumericAdjustmentScreen::onTouchEnd(uint8_t tag) { bool BaseNumericAdjustmentScreen::onTouchEnd(uint8_t tag) {
switch (tag) { switch (tag) {
case 1: GOTO_PREVIOUS(); return true; 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); default: return current_screen.onTouchHeld(tag);
} }
return true; return true;
} }
float BaseNumericAdjustmentScreen::getIncrement() { float BaseNumericAdjustmentScreen::getIncrement() {
switch (screen_data.BaseNumericAdjustmentScreen.increment) { switch (screen_data.BaseNumericAdjustment.increment) {
case 240: return 0.001; case 240: return 0.001;
case 241: return 0.01; case 241: return 0.01;
case 242: return 0.1; case 242: return 0.1;

42
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) { if (opts & USE_HIGHLIGHT) {
const uint8_t tag = screen_data.BedMeshScreen.highlightedTag; const uint8_t tag = screen_data.BedMesh.highlightedTag;
uint8_t x, y; uint8_t x, y;
if (tagToPoint(tag, x, y)) { if (tagToPoint(tag, x, y)) {
cmd.cmd(COLOR_A(128)) cmd.cmd(COLOR_A(128))
@ -221,16 +221,16 @@ bool BedMeshScreen::tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y) {
} }
void BedMeshScreen::onEntry() { void BedMeshScreen::onEntry() {
screen_data.BedMeshScreen.highlightedTag = 0; screen_data.BedMesh.highlightedTag = 0;
screen_data.BedMeshScreen.count = GRID_MAX_POINTS; screen_data.BedMesh.count = GRID_MAX_POINTS;
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE; screen_data.BedMesh.message = screen_data.BedMesh.MSG_NONE;
BaseScreen::onEntry(); BaseScreen::onEntry();
} }
float BedMeshScreen::getHightlightedValue() { float BedMeshScreen::getHightlightedValue() {
if (screen_data.BedMeshScreen.highlightedTag) { if (screen_data.BedMesh.highlightedTag) {
xy_uint8_t pt; 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 ExtUI::getMeshPoint(pt);
} }
return NAN; return NAN;
@ -253,9 +253,9 @@ void BedMeshScreen::drawHighlightedPointValue() {
.tag(1).button(OKAY_POS, GET_TEXT_F(MSG_BUTTON_OKAY)) .tag(1).button(OKAY_POS, GET_TEXT_F(MSG_BUTTON_OKAY))
.tag(0); .tag(0);
switch (screen_data.BedMeshScreen.message) { switch (screen_data.BedMesh.message) {
case screen_data.BedMeshScreen.MSG_MESH_COMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); break; case screen_data.BedMesh.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; case screen_data.BedMesh.MSG_MESH_INCOMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE)); break;
default: break; default: break;
} }
} }
@ -277,11 +277,11 @@ void BedMeshScreen::onRedraw(draw_mode_t what) {
if (what & FOREGROUND) { if (what & FOREGROUND) {
constexpr float autoscale_max_amplitude = 0.03; 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) { if (gotAllPoints) {
drawHighlightedPointValue(); 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(), BedMeshScreen::drawMesh(INSET_POS(MESH_POS), ExtUI::getMeshArray(),
USE_POINTS | USE_HIGHLIGHT | USE_AUTOSCALE | (gotAllPoints ? USE_COLORS : 0), USE_POINTS | USE_HIGHLIGHT | USE_AUTOSCALE | (gotAllPoints ? USE_COLORS : 0),
autoscale_max_amplitude * levelingProgress autoscale_max_amplitude * levelingProgress
@ -290,7 +290,7 @@ void BedMeshScreen::onRedraw(draw_mode_t what) {
} }
bool BedMeshScreen::onTouchStart(uint8_t tag) { bool BedMeshScreen::onTouchStart(uint8_t tag) {
screen_data.BedMeshScreen.highlightedTag = tag; screen_data.BedMesh.highlightedTag = tag;
return true; 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) { void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) {
switch (state) { switch (state) {
case ExtUI::MESH_START: case ExtUI::MESH_START:
screen_data.BedMeshScreen.count = 0; screen_data.BedMesh.count = 0;
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE; screen_data.BedMesh.message = screen_data.BedMesh.MSG_NONE;
break; break;
case ExtUI::MESH_FINISH: case ExtUI::MESH_FINISH:
if (screen_data.BedMeshScreen.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray())) if (screen_data.BedMesh.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray()))
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_COMPLETE; screen_data.BedMesh.message = screen_data.BedMesh.MSG_MESH_COMPLETE;
else else
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE; screen_data.BedMesh.message = screen_data.BedMesh.MSG_MESH_INCOMPLETE;
screen_data.BedMeshScreen.count = GRID_MAX_POINTS; screen_data.BedMesh.count = GRID_MAX_POINTS;
break; break;
case ExtUI::PROBE_START: case ExtUI::PROBE_START:
screen_data.BedMeshScreen.highlightedTag = pointToTag(x, y); screen_data.BedMesh.highlightedTag = pointToTag(x, y);
break; break;
case ExtUI::PROBE_FINISH: case ExtUI::PROBE_FINISH:
screen_data.BedMeshScreen.count++; screen_data.BedMesh.count++;
break; break;
} }
BedMeshScreen::onMeshUpdate(x, y, 0); 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() { void BedMeshScreen::startMeshProbe() {
GOTO_SCREEN(BedMeshScreen); GOTO_SCREEN(BedMeshScreen);
screen_data.BedMeshScreen.count = 0; screen_data.BedMesh.count = 0;
injectCommands_P(PSTR(BED_LEVELING_COMMANDS)); injectCommands_P(PSTR(BED_LEVELING_COMMANDS));
} }

52
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() { void ChangeFilamentScreen::onEntry() {
BaseScreen::onEntry(); BaseScreen::onEntry();
screen_data.ChangeFilamentScreen.e_tag = ExtUI::getActiveTool() + 10; screen_data.ChangeFilament.e_tag = ExtUI::getActiveTool() + 10;
screen_data.ChangeFilamentScreen.t_tag = 0; screen_data.ChangeFilament.t_tag = 0;
screen_data.ChangeFilamentScreen.repeat_tag = 0; screen_data.ChangeFilament.repeat_tag = 0;
screen_data.ChangeFilamentScreen.saved_extruder = getActiveTool(); screen_data.ChangeFilament.saved_extruder = getActiveTool();
#if FILAMENT_UNLOAD_PURGE_LENGTH > 0 #if FILAMENT_UNLOAD_PURGE_LENGTH > 0
screen_data.ChangeFilamentScreen.need_purge = true; screen_data.ChangeFilament.need_purge = true;
#endif #endif
} }
void ChangeFilamentScreen::onExit() { void ChangeFilamentScreen::onExit() {
setActiveTool(screen_data.ChangeFilamentScreen.saved_extruder, true); setActiveTool(screen_data.ChangeFilament.saved_extruder, true);
} }
void ChangeFilamentScreen::onRedraw(draw_mode_t what) { 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; 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)); cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING));
} else if (getActualTemp_celsius(e) > 100) { } else if (getActualTemp_celsius(e) > 100) {
cmd.cmd(COLOR_RGB(0xFF0000)) 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) #define TOG_STYLE(A) colors(A ? action_btn : normal_btn)
const bool tog2 = screen_data.ChangeFilamentScreen.t_tag == 2; const bool tog2 = screen_data.ChangeFilament.t_tag == 2;
const bool tog3 = screen_data.ChangeFilamentScreen.t_tag == 3; const bool tog3 = screen_data.ChangeFilament.t_tag == 3;
const bool tog4 = screen_data.ChangeFilamentScreen.t_tag == 4; const bool tog4 = screen_data.ChangeFilament.t_tag == 4;
const bool tog10 = screen_data.ChangeFilamentScreen.e_tag == 10; const bool tog10 = screen_data.ChangeFilament.e_tag == 10;
#if HAS_MULTI_HOTEND #if HAS_MULTI_HOTEND
const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11; const bool tog11 = screen_data.ChangeFilament.e_tag == 11;
#endif #endif
cmd.TOG_STYLE(tog10) cmd.TOG_STYLE(tog10)
@ -200,8 +200,8 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
if (!t_ok) reset_menu_timeout(); if (!t_ok) reset_menu_timeout();
const bool tog7 = screen_data.ChangeFilamentScreen.repeat_tag == 7; const bool tog7 = screen_data.ChangeFilament.repeat_tag == 7;
const bool tog8 = screen_data.ChangeFilamentScreen.repeat_tag == 8; const bool tog8 = screen_data.ChangeFilament.repeat_tag == 8;
{ {
char str[30]; char str[30];
@ -228,7 +228,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
} }
uint8_t ChangeFilamentScreen::getSoftenTemp() { uint8_t ChangeFilamentScreen::getSoftenTemp() {
switch (screen_data.ChangeFilamentScreen.t_tag) { switch (screen_data.ChangeFilament.t_tag) {
case 2: return LOW_TEMP; case 2: return LOW_TEMP;
case 3: return MED_TEMP; case 3: return MED_TEMP;
case 4: return HIGH_TEMP; case 4: return HIGH_TEMP;
@ -237,7 +237,7 @@ uint8_t ChangeFilamentScreen::getSoftenTemp() {
} }
ExtUI::extruder_t ChangeFilamentScreen::getExtruder() { ExtUI::extruder_t ChangeFilamentScreen::getExtruder() {
switch (screen_data.ChangeFilamentScreen.e_tag) { switch (screen_data.ChangeFilament.e_tag) {
case 13: return ExtUI::E3; case 13: return ExtUI::E3;
case 12: return ExtUI::E2; case 12: return ExtUI::E2;
case 11: return ExtUI::E1; case 11: return ExtUI::E1;
@ -248,8 +248,8 @@ ExtUI::extruder_t ChangeFilamentScreen::getExtruder() {
void ChangeFilamentScreen::doPurge() { void ChangeFilamentScreen::doPurge() {
#if FILAMENT_UNLOAD_PURGE_LENGTH > 0 #if FILAMENT_UNLOAD_PURGE_LENGTH > 0
constexpr float purge_distance_mm = FILAMENT_UNLOAD_PURGE_LENGTH; constexpr float purge_distance_mm = FILAMENT_UNLOAD_PURGE_LENGTH;
if (screen_data.ChangeFilamentScreen.need_purge) { if (screen_data.ChangeFilament.need_purge) {
screen_data.ChangeFilamentScreen.need_purge = false; screen_data.ChangeFilament.need_purge = false;
MoveAxisScreen::setManualFeedrate(getExtruder(), purge_distance_mm); MoveAxisScreen::setManualFeedrate(getExtruder(), purge_distance_mm);
ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(getExtruder()) + purge_distance_mm, getExtruder()); ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(getExtruder()) + purge_distance_mm, getExtruder());
} }
@ -277,23 +277,23 @@ bool ChangeFilamentScreen::onTouchEnd(uint8_t tag) {
case 3: case 3:
case 4: case 4:
// Change temperature // Change temperature
screen_data.ChangeFilamentScreen.t_tag = tag; screen_data.ChangeFilament.t_tag = tag;
setTargetTemp_celsius(getSoftenTemp(), getExtruder()); setTargetTemp_celsius(getSoftenTemp(), getExtruder());
break; break;
case 7: 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; break;
case 8: 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; break;
case 10: case 10:
case 11: case 11:
// Change extruder // Change extruder
screen_data.ChangeFilamentScreen.e_tag = tag; screen_data.ChangeFilament.e_tag = tag;
screen_data.ChangeFilamentScreen.t_tag = 0; screen_data.ChangeFilament.t_tag = 0;
screen_data.ChangeFilamentScreen.repeat_tag = 0; screen_data.ChangeFilament.repeat_tag = 0;
#if FILAMENT_UNLOAD_PURGE_LENGTH > 0 #if FILAMENT_UNLOAD_PURGE_LENGTH > 0
screen_data.ChangeFilamentScreen.need_purge = true; screen_data.ChangeFilament.need_purge = true;
#endif #endif
setActiveTool(getExtruder(), true); setActiveTool(getExtruder(), true);
break; break;
@ -319,7 +319,7 @@ bool ChangeFilamentScreen::onTouchHeld(uint8_t tag) {
void ChangeFilamentScreen::onIdle() { void ChangeFilamentScreen::onIdle() {
reset_menu_timeout(); 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)) { if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) {
onRefresh(); onRefresh();
refresh_timer.start(); refresh_timer.start();

10
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.heading( GET_TEXT_F(MSG_E_MOVE));
w.color(Theme::e_axis); w.color(Theme::e_axis);
#if EXTRUDERS == 1 #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 #elif HAS_MULTI_EXTRUDER
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxisScreen.e_rel[0], canMove(E0)); 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.MoveAxisScreen.e_rel[1], canMove(E1)); w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxis.e_rel[1], canMove(E1));
#if EXTRUDERS > 2 #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 #endif
#if EXTRUDERS > 3 #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
#endif #endif
w.increments(); w.increments();

2
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp

@ -21,7 +21,7 @@
#include "../config.h" #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 "screens.h"

6
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp

@ -21,7 +21,7 @@
#include "../config.h" #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 "screens.h"
#include "screen_data.h" #include "screen_data.h"
@ -54,7 +54,7 @@ void PreheatTimerScreen::draw_message(draw_mode_t what) {
} }
uint16_t PreheatTimerScreen::secondsRemaining() { 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; 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() { void PreheatTimerScreen::onEntry() {
screen_data.PreheatTimerScreen.start_ms = millis(); screen_data.PreheatTimer.start_ms = millis();
} }
void PreheatTimerScreen::onRedraw(draw_mode_t what) { void PreheatTimerScreen::onRedraw(draw_mode_t what) {

4
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) { const char *ConfirmStartPrintDialogBox::getFilename(bool longName) {
FileList files; FileList files;
files.seek(screen_data.ConfirmStartPrintDialogBox.file_index, true); files.seek(screen_data.ConfirmStartPrintDialog.file_index, true);
return longName ? files.longFilename() : files.shortFilename(); return longName ? files.longFilename() : files.shortFilename();
} }
void ConfirmStartPrintDialogBox::show(uint8_t file_index) { void ConfirmStartPrintDialogBox::show(uint8_t file_index) {
screen_data.ConfirmStartPrintDialogBox.file_index = file_index; screen_data.ConfirmStartPrintDialog.file_index = file_index;
GOTO_SCREEN(ConfirmStartPrintDialogBox); GOTO_SCREEN(ConfirmStartPrintDialogBox);
} }

3
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) { void ConfirmUserRequestAlertBox::show(const char* msg) {
drawMessage(msg); drawMessage(msg);
storeBackground(); storeBackground();
screen_data.AlertDialogBox.isError = false; screen_data.AlertDialog.isError = false;
GOTO_SCREEN(ConfirmUserRequestAlertBox); GOTO_SCREEN(ConfirmUserRequestAlertBox);
} }
@ -55,4 +55,5 @@ void ConfirmUserRequestAlertBox::hide() {
if (AT_SCREEN(ConfirmUserRequestAlertBox)) if (AT_SCREEN(ConfirmUserRequestAlertBox))
GOTO_PREVIOUS(); GOTO_PREVIOUS();
} }
#endif // TOUCH_UI_FTDI_EVE #endif // TOUCH_UI_FTDI_EVE

60
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp

@ -32,8 +32,8 @@ using namespace ExtUI;
using namespace Theme; using namespace Theme;
void FilesScreen::onEntry() { void FilesScreen::onEntry() {
screen_data.FilesScreen.cur_page = 0; screen_data.Files.cur_page = 0;
screen_data.FilesScreen.selected_tag = 0xFF; screen_data.Files.selected_tag = 0xFF;
#if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
CLCD::mem_write_32(CLCD::REG::MACRO_0,DL::NOP); CLCD::mem_write_32(CLCD::REG::MACRO_0,DL::NOP);
#endif #endif
@ -50,21 +50,21 @@ const char *FilesScreen::getSelectedFilename(bool longName) {
void FilesScreen::drawSelectedFile() { void FilesScreen::drawSelectedFile() {
FileList files; FileList files;
files.seek(getSelectedFileIndex(), true); files.seek(getSelectedFileIndex(), true);
screen_data.FilesScreen.flags.is_dir = files.isDir(); screen_data.Files.flags.is_dir = files.isDir();
drawFileButton( drawFileButton(
files.filename(), files.filename(),
screen_data.FilesScreen.selected_tag, screen_data.Files.selected_tag,
screen_data.FilesScreen.flags.is_dir, screen_data.Files.flags.is_dir,
true true
); );
} }
uint16_t FilesScreen::getSelectedFileIndex() { 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) { 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) #if ENABLED(TOUCH_UI_PORTRAIT)
@ -106,15 +106,15 @@ void FilesScreen::drawFileButton(const char* filename, uint8_t tag, bool is_dir,
void FilesScreen::drawFileList() { void FilesScreen::drawFileList() {
FileList files; FileList files;
screen_data.FilesScreen.num_page = max(1,ceil(float(files.count()) / files_per_page)); screen_data.Files.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.Files.cur_page = min(screen_data.Files.cur_page, screen_data.Files.num_page-1);
screen_data.FilesScreen.flags.is_root = files.isAtRootDir(); screen_data.Files.flags.is_root = files.isAtRootDir();
#undef MARGIN_T #undef MARGIN_T
#undef MARGIN_B #undef MARGIN_B
#define MARGIN_T 0 #define MARGIN_T 0
#define MARGIN_B 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++) { for (uint8_t i = 0; i < files_per_page; i++, fileIndex++) {
if (files.seek(fileIndex)) { if (files.seek(fileIndex)) {
drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false); drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false);
@ -126,8 +126,8 @@ void FilesScreen::drawFileList() {
} }
void FilesScreen::drawHeader() { void FilesScreen::drawHeader() {
const bool prev_enabled = screen_data.FilesScreen.cur_page > 0; const bool prev_enabled = screen_data.Files.cur_page > 0;
const bool next_enabled = screen_data.FilesScreen.cur_page < (screen_data.FilesScreen.num_page - 1); const bool next_enabled = screen_data.Files.cur_page < (screen_data.Files.num_page - 1);
#undef MARGIN_T #undef MARGIN_T
#undef MARGIN_B #undef MARGIN_B
@ -136,7 +136,7 @@ void FilesScreen::drawHeader() {
char str[16]; char str[16];
sprintf_P(str, PSTR("Page %d of %d"), 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; CommandProcessor cmd;
cmd.colors(normal_btn) cmd.colors(normal_btn)
@ -158,8 +158,8 @@ void FilesScreen::drawFooter() {
#define MARGIN_T 5 #define MARGIN_T 5
#define MARGIN_B 5 #define MARGIN_B 5
#endif #endif
const bool has_selection = screen_data.FilesScreen.selected_tag != 0xFF; const bool has_selection = screen_data.Files.selected_tag != 0xFF;
const uint8_t back_tag = screen_data.FilesScreen.flags.is_root ? 240 : 245; 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 y = GRID_ROWS - footer_h + 1;
const uint8_t h = footer_h; const uint8_t h = footer_h;
@ -171,7 +171,7 @@ void FilesScreen::drawFooter() {
.enabled(has_selection) .enabled(has_selection)
.colors(has_selection ? action_btn : normal_btn); .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)); cmd.tag(244).button(BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_OPEN));
else else
cmd.tag(243).button(BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_PRINT)); 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) { void FilesScreen::gotoPage(uint8_t page) {
screen_data.FilesScreen.selected_tag = 0xFF; screen_data.Files.selected_tag = 0xFF;
screen_data.FilesScreen.cur_page = page; screen_data.Files.cur_page = page;
CommandProcessor cmd; CommandProcessor cmd;
cmd.cmd(CMD_DLSTART) cmd.cmd(CMD_DLSTART)
.cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR_COLOR_RGB(bg_color))
@ -201,13 +201,13 @@ bool FilesScreen::onTouchEnd(uint8_t tag) {
switch (tag) { switch (tag) {
case 240: GOTO_PREVIOUS(); return true; case 240: GOTO_PREVIOUS(); return true;
case 241: case 241:
if (screen_data.FilesScreen.cur_page > 0) { if (screen_data.Files.cur_page > 0) {
gotoPage(screen_data.FilesScreen.cur_page-1); gotoPage(screen_data.Files.cur_page-1);
} }
break; break;
case 242: case 242:
if (screen_data.FilesScreen.cur_page < (screen_data.FilesScreen.num_page-1)) { if (screen_data.Files.cur_page < (screen_data.Files.num_page-1)) {
gotoPage(screen_data.FilesScreen.cur_page+1); gotoPage(screen_data.Files.cur_page+1);
} }
break; break;
case 243: case 243:
@ -229,18 +229,18 @@ bool FilesScreen::onTouchEnd(uint8_t tag) {
break; break;
default: default:
if (tag < 240) { 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 ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
if (FTDI::ftdi_chip >= 810) { if (FTDI::ftdi_chip >= 810) {
const char *longFilename = getSelectedLongFilename(); const char *longFilename = getSelectedLongFilename();
if (longFilename[0]) { if (longFilename[0]) {
CommandProcessor cmd; CommandProcessor cmd;
uint16_t text_width = cmd.font(font_medium).text_width(longFilename); 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) 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 else
screen_data.FilesScreen.scroll_max = 0; screen_data.Files.scroll_max = 0;
} }
} }
#endif #endif
@ -254,9 +254,9 @@ void FilesScreen::onIdle() {
#if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
if (FTDI::ftdi_chip >= 810) { if (FTDI::ftdi_chip >= 810) {
CLCD::mem_write_32(CLCD::REG::MACRO_0, CLCD::mem_write_32(CLCD::REG::MACRO_0,
VERTEX_TRANSLATE_X(-int32_t(screen_data.FilesScreen.scroll_pos))); VERTEX_TRANSLATE_X(-int32_t(screen_data.Files.scroll_pos)));
if (screen_data.FilesScreen.scroll_pos < screen_data.FilesScreen.scroll_max * 16) if (screen_data.Files.scroll_pos < screen_data.Files.scroll_max * 16)
screen_data.FilesScreen.scroll_pos++; screen_data.Files.scroll_pos++;
} }
#endif #endif
} }

16
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp

@ -47,8 +47,8 @@ void InterfaceSettingsScreen::onStartup() {
} }
void InterfaceSettingsScreen::onEntry() { void InterfaceSettingsScreen::onEntry() {
screen_data.InterfaceSettingsScreen.brightness = CLCD::get_brightness(); screen_data.InterfaceSettings.brightness = CLCD::get_brightness();
screen_data.InterfaceSettingsScreen.volume = SoundPlayer::get_volume(); screen_data.InterfaceSettings.volume = SoundPlayer::get_volume();
BaseScreen::onEntry(); BaseScreen::onEntry();
} }
@ -96,9 +96,9 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) {
#define EDGE_R 30 #define EDGE_R 30
.colors(ui_slider) .colors(ui_slider)
#if DISABLED(LCD_FYSETC_TFT81050) #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 #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) .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()) .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) #if DISABLED(TOUCH_UI_NO_BOOTSCREEN)
@ -161,13 +161,13 @@ void InterfaceSettingsScreen::onIdle() {
CommandProcessor cmd; CommandProcessor cmd;
switch (cmd.track_tag(value)) { switch (cmd.track_tag(value)) {
case 2: case 2:
screen_data.InterfaceSettingsScreen.brightness = max(11, (value * 128UL) / 0xFFFF); screen_data.InterfaceSettings.brightness = max(11, (value * 128UL) / 0xFFFF);
CLCD::set_brightness(screen_data.InterfaceSettingsScreen.brightness); CLCD::set_brightness(screen_data.InterfaceSettings.brightness);
SaveSettingsDialogBox::settingsChanged(); SaveSettingsDialogBox::settingsChanged();
break; break;
case 3: case 3:
screen_data.InterfaceSettingsScreen.volume = value >> 8; screen_data.InterfaceSettings.volume = value >> 8;
SoundPlayer::set_volume(screen_data.InterfaceSettingsScreen.volume); SoundPlayer::set_volume(screen_data.InterfaceSettings.volume);
SaveSettingsDialogBox::settingsChanged(); SaveSettingsDialogBox::settingsChanged();
break; break;
default: default:

8
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) cmd.font(font_medium)
.colors(ui_slider) .colors(ui_slider)
#define EDGE_R 30 #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) .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(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 #undef EDGE_R
@ -108,7 +108,7 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) {
} }
void InterfaceSoundsScreen::onEntry() { void InterfaceSoundsScreen::onEntry() {
screen_data.InterfaceSettingsScreen.volume = SoundPlayer::get_volume(); screen_data.InterfaceSettings.volume = SoundPlayer::get_volume();
BaseScreen::onEntry(); BaseScreen::onEntry();
} }
@ -145,8 +145,8 @@ void InterfaceSoundsScreen::onIdle() {
CommandProcessor cmd; CommandProcessor cmd;
switch (cmd.track_tag(value)) { switch (cmd.track_tag(value)) {
case 2: case 2:
screen_data.InterfaceSettingsScreen.volume = value >> 8; screen_data.InterfaceSettings.volume = value >> 8;
SoundPlayer::set_volume(screen_data.InterfaceSettingsScreen.volume); SoundPlayer::set_volume(screen_data.InterfaceSettings.volume);
SaveSettingsDialogBox::settingsChanged(); SaveSettingsDialogBox::settingsChanged();
break; break;
default: default:

20
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; uint16_t LockScreen::passcode = 0;
void LockScreen::onEntry() { void LockScreen::onEntry() {
const uint8_t siz = sizeof(screen_data.LockScreen.passcode); const uint8_t siz = sizeof(screen_data.Lock.passcode);
memset(screen_data.LockScreen.passcode, '_', siz-1); memset(screen_data.Lock.passcode, '_', siz-1);
screen_data.LockScreen.passcode[siz-1] = '\0'; screen_data.Lock.passcode[siz-1] = '\0';
BaseScreen::onEntry(); BaseScreen::onEntry();
} }
@ -84,11 +84,11 @@ void LockScreen::onRedraw(draw_mode_t what) {
#if ENABLED(TOUCH_UI_PORTRAIT) #if ENABLED(TOUCH_UI_PORTRAIT)
.text(BTN_POS(1,2), BTN_SIZE(1,1), message) .text(BTN_POS(1,2), BTN_SIZE(1,1), message)
.font(font_xlarge) .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 #else
.text(BTN_POS(1,1), BTN_SIZE(1,1), message) .text(BTN_POS(1,1), BTN_SIZE(1,1), message)
.font(font_xlarge) .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 #endif
.font(font_large) .font(font_large)
.colors(normal_btn) .colors(normal_btn)
@ -117,8 +117,8 @@ void LockScreen::onRedraw(draw_mode_t what) {
char &LockScreen::message_style() { char &LockScreen::message_style() {
// We use the last byte of the passcode string as a flag to indicate, // We use the last byte of the passcode string as a flag to indicate,
// which message to show. // which message to show.
constexpr uint8_t last_char = sizeof(screen_data.LockScreen.passcode)-1; constexpr uint8_t last_char = sizeof(screen_data.Lock.passcode)-1;
return screen_data.LockScreen.passcode[last_char]; return screen_data.Lock.passcode[last_char];
} }
void LockScreen::onPasscodeEntered() { void LockScreen::onPasscodeEntered() {
@ -145,10 +145,10 @@ void LockScreen::onPasscodeEntered() {
} }
bool LockScreen::onTouchEnd(uint8_t tag) { bool LockScreen::onTouchEnd(uint8_t tag) {
char *c = strchr(screen_data.LockScreen.passcode,'_'); char *c = strchr(screen_data.Lock.passcode,'_');
if (c) { if (c) {
if (tag == '<') { if (tag == '<') {
if (c != screen_data.LockScreen.passcode) { if (c != screen_data.Lock.passcode) {
// Backspace deletes previous entered characters. // Backspace deletes previous entered characters.
*--c = '_'; *--c = '_';
} }
@ -167,7 +167,7 @@ bool LockScreen::onTouchEnd(uint8_t tag) {
uint16_t LockScreen::compute_checksum() { uint16_t LockScreen::compute_checksum() {
uint16_t checksum = 0; uint16_t checksum = 0;
const char* c = screen_data.LockScreen.passcode; const char* c = screen_data.Lock.passcode;
while (*c) { while (*c) {
checksum = (checksum << 2) ^ *c++; checksum = (checksum << 2) ^ *c++;
} }

28
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp

@ -37,7 +37,7 @@ void BaseMoveAxisScreen::onEntry() {
// screen is entered. // screen is entered.
LOOP_L_N(i, ExtUI::extruderCount) { LOOP_L_N(i, ExtUI::extruderCount) {
screen_data.MoveAxisScreen.e_rel[i] = 0; screen_data.MoveAxis.e_rel[i] = 0;
} }
BaseNumericAdjustmentScreen::onEntry(); BaseNumericAdjustmentScreen::onEntry();
} }
@ -54,15 +54,15 @@ void MoveAxisScreen::onRedraw(draw_mode_t what) {
w.color(Theme::e_axis); w.color(Theme::e_axis);
#if EXTRUDERS == 1 #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 #elif HAS_MULTI_EXTRUDER
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxisScreen.e_rel[0], canMove(E0)); 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.MoveAxisScreen.e_rel[1], canMove(E1)); w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxis.e_rel[1], canMove(E1));
#if EXTRUDERS > 2 #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 #endif
#if EXTRUDERS > 3 #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
#endif #endif
w.increments(); w.increments();
@ -80,19 +80,19 @@ bool BaseMoveAxisScreen::onTouchHeld(uint8_t tag) {
case 6: UI_DECREMENT_AXIS(Z); break; case 6: UI_DECREMENT_AXIS(Z); break;
case 7: UI_INCREMENT_AXIS(Z); break; case 7: UI_INCREMENT_AXIS(Z); break;
// For extruders, also update relative distances. // For extruders, also update relative distances.
case 8: UI_DECREMENT_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.MoveAxisScreen.e_rel[0] += increment; break; case 9: UI_INCREMENT_AXIS(E0); screen_data.MoveAxis.e_rel[0] += increment; break;
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
case 10: UI_DECREMENT_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.MoveAxisScreen.e_rel[1] += increment; break; case 11: UI_INCREMENT_AXIS(E1); screen_data.MoveAxis.e_rel[1] += increment; break;
#endif #endif
#if EXTRUDERS > 2 #if EXTRUDERS > 2
case 12: UI_DECREMENT_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.MoveAxisScreen.e_rel[2] += increment; break; case 13: UI_INCREMENT_AXIS(E2); screen_data.MoveAxis.e_rel[2] += increment; break;
#endif #endif
#if EXTRUDERS > 3 #if EXTRUDERS > 3
case 14: UI_DECREMENT_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.MoveAxisScreen.e_rel[3] += increment; break; case 15: UI_INCREMENT_AXIS(E3); screen_data.MoveAxis.e_rel[3] += increment; break;
#endif #endif
case 20: SpinnerDialogBox::enqueueAndWait_P(F("G28 X")); break; case 20: SpinnerDialogBox::enqueueAndWait_P(F("G28 X")); break;
case 21: SpinnerDialogBox::enqueueAndWait_P(F("G28 Y")); break; case 21: SpinnerDialogBox::enqueueAndWait_P(F("G28 Y")); break;

36
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp

@ -32,11 +32,11 @@ using namespace Theme;
using namespace ExtUI; using namespace ExtUI;
void NudgeNozzleScreen::onEntry() { void NudgeNozzleScreen::onEntry() {
screen_data.NudgeNozzleScreen.show_offsets = false; screen_data.NudgeNozzle.show_offsets = false;
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
screen_data.NudgeNozzleScreen.link_nozzles = true; screen_data.NudgeNozzle.link_nozzles = true;
#endif #endif
screen_data.NudgeNozzleScreen.rel.reset(); screen_data.NudgeNozzle.rel.reset();
BaseNumericAdjustmentScreen::onEntry(); BaseNumericAdjustmentScreen::onEntry();
} }
@ -47,19 +47,19 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) {
w.heading(GET_TEXT_F(MSG_NUDGE_NOZZLE)); w.heading(GET_TEXT_F(MSG_NUDGE_NOZZLE));
#if ENABLED(BABYSTEP_XY) #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(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.NudgeNozzleScreen.rel.y / getAxisSteps_per_mm(Y)); w.color(y_axis).adjuster(4, GET_TEXT_F(MSG_AXIS_Y), screen_data.NudgeNozzle.rel.y / getAxisSteps_per_mm(Y));
#endif #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(); w.increments();
#if HAS_MULTI_EXTRUDER #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 #endif
#if HAS_MULTI_EXTRUDER || HAS_BED_PROBE #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]; char str[19];
w.draw_mode(BOTH); w.draw_mode(BOTH);
@ -83,22 +83,22 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) {
bool NudgeNozzleScreen::onTouchHeld(uint8_t tag) { bool NudgeNozzleScreen::onTouchHeld(uint8_t tag) {
const float inc = getIncrement(); const float inc = getIncrement();
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
const bool link = screen_data.NudgeNozzleScreen.link_nozzles; const bool link = screen_data.NudgeNozzle.link_nozzles;
#else #else
constexpr bool link = true; constexpr bool link = true;
#endif #endif
int16_t steps; int16_t steps;
switch (tag) { switch (tag) {
case 2: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps(-steps, X, link); screen_data.NudgeNozzleScreen.rel.x -= 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.NudgeNozzleScreen.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.NudgeNozzleScreen.rel.y -= 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.NudgeNozzleScreen.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.NudgeNozzleScreen.rel.z -= 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.NudgeNozzleScreen.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 #if HAS_MULTI_EXTRUDER
case 8: screen_data.NudgeNozzleScreen.link_nozzles = !link; break; case 8: screen_data.NudgeNozzle.link_nozzles = !link; break;
#endif #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; default: return false;
} }
#if HAS_MULTI_EXTRUDER || HAS_BED_PROBE #if HAS_MULTI_EXTRUDER || HAS_BED_PROBE

26
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;}; struct base_numeric_adjustment_t {uint8_t increment;};
union screen_data_t { union screen_data_t {
struct base_numeric_adjustment_t BaseNumericAdjustmentScreen; struct base_numeric_adjustment_t BaseNumericAdjustment;
struct {uint8_t volume; uint8_t brightness;} InterfaceSettingsScreen; struct {uint8_t volume; uint8_t brightness;} InterfaceSettings;
struct {char passcode[5];} LockScreen; struct {char passcode[5];} Lock;
struct {bool isError;} AlertDialogBox; struct {bool isError;} AlertDialog;
struct {bool auto_hide;} SpinnerDialogBox; struct {bool auto_hide;} SpinnerDialog;
struct {uint8_t file_index;} ConfirmStartPrintDialogBox; struct {uint8_t file_index;} ConfirmStartPrintDialog;
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;
#if FILAMENT_UNLOAD_PURGE_LENGTH > 0 #if FILAMENT_UNLOAD_PURGE_LENGTH > 0
bool need_purge; bool need_purge;
#endif #endif
} ChangeFilamentScreen; } ChangeFilament;
struct { struct {
struct { struct {
uint8_t is_dir : 1; uint8_t is_dir : 1;
@ -55,11 +55,11 @@ union screen_data_t {
uint16_t scroll_pos; uint16_t scroll_pos;
uint16_t scroll_max; uint16_t scroll_max;
#endif #endif
} FilesScreen; } Files;
struct { struct {
struct base_numeric_adjustment_t placeholder; struct base_numeric_adjustment_t placeholder;
float e_rel[ExtUI::extruderCount]; float e_rel[ExtUI::extruderCount];
} MoveAxisScreen; } MoveAxis;
#if HAS_MESH #if HAS_MESH
struct { struct {
enum : uint8_t { enum : uint8_t {
@ -69,18 +69,18 @@ union screen_data_t {
} message; } message;
uint8_t count; uint8_t count;
uint8_t highlightedTag; uint8_t highlightedTag;
} BedMeshScreen; } BedMesh;
#endif #endif
#if ENABLED(TOUCH_UI_DEVELOPER_MENU) #if ENABLED(TOUCH_UI_DEVELOPER_MENU)
struct { struct {
uint32_t next_watchdog_trigger; uint32_t next_watchdog_trigger;
const char* message; const char* message;
} StressTestScreen; } StressTest;
#endif #endif
#if ENABLED(TOUCH_UI_COCOA_PRESS) #if ENABLED(TOUCH_UI_COCOA_PRESS)
struct { struct {
uint32_t start_ms; uint32_t start_ms;
} PreheatTimerScreen; } PreheatTimer;
#endif #endif
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
struct { struct {
@ -90,7 +90,7 @@ union screen_data_t {
bool link_nozzles; bool link_nozzles;
#endif #endif
bool show_offsets; bool show_offsets;
} NudgeNozzleScreen; } NudgeNozzle;
#endif #endif
}; };

8
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); drawMessage(message);
drawSpinner(); drawSpinner();
storeBackground(); storeBackground();
screen_data.SpinnerDialogBox.auto_hide = false; screen_data.SpinnerDialog.auto_hide = false;
} }
void SpinnerDialogBox::hide() { void SpinnerDialogBox::hide() {
@ -53,13 +53,13 @@ void SpinnerDialogBox::enqueueAndWait_P(const progmem_str message, const progmem
show(message); show(message);
GOTO_SCREEN(SpinnerDialogBox); GOTO_SCREEN(SpinnerDialogBox);
ExtUI::injectCommands_P((const char*)commands); ExtUI::injectCommands_P((const char*)commands);
screen_data.SpinnerDialogBox.auto_hide = true; screen_data.SpinnerDialog.auto_hide = true;
} }
void SpinnerDialogBox::onIdle() { void SpinnerDialogBox::onIdle() {
reset_menu_timeout(); reset_menu_timeout();
if (screen_data.SpinnerDialogBox.auto_hide && !commandsInQueue()) { if (screen_data.SpinnerDialog.auto_hide && !commandsInQueue()) {
screen_data.SpinnerDialogBox.auto_hide = false; screen_data.SpinnerDialog.auto_hide = false;
hide(); hide();
GOTO_PREVIOUS(); GOTO_PREVIOUS();
} }

14
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() { bool StressTestScreen::watchDogTestNow() {
return screen_data.StressTestScreen.next_watchdog_trigger && return screen_data.StressTest.next_watchdog_trigger &&
ELAPSED(millis(), screen_data.StressTestScreen.next_watchdog_trigger); ELAPSED(millis(), screen_data.StressTest.next_watchdog_trigger);
} }
void StressTestScreen::onRedraw(draw_mode_t) { void StressTestScreen::onRedraw(draw_mode_t) {
@ -58,7 +58,7 @@ void StressTestScreen::onRedraw(draw_mode_t) {
.cmd(CLEAR(true,true,true)) .cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled)) .cmd(COLOR_RGB(bg_text_enabled))
.font(font_medium) .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)); drawDots(BTN_POS(1,3), BTN_SIZE(4,4));
@ -92,8 +92,8 @@ void StressTestScreen::startupCheck() {
} }
void StressTestScreen::onEntry() { void StressTestScreen::onEntry() {
screen_data.StressTestScreen.next_watchdog_trigger = millis() + 10000 + random(40000); screen_data.StressTest.next_watchdog_trigger = millis() + 10000 + random(40000);
screen_data.StressTestScreen.message = PSTR("Test 1: Stress testing..."); screen_data.StressTest.message = PSTR("Test 1: Stress testing...");
// Turn off heaters. // Turn off heaters.
setTargetTemp_celsius(0, E0); setTargetTemp_celsius(0, E0);
@ -104,13 +104,13 @@ void StressTestScreen::onEntry() {
} }
void StressTestScreen::recursiveLockup() { 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(); current_screen.onRefresh();
recursiveLockup(); recursiveLockup();
} }
void StressTestScreen::iterativeLockup() { 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(); for (;;) current_screen.onRefresh();
} }

Loading…
Cancel
Save