Skip to content

Commit b57d80f

Browse files
marciotvgadreau
authored andcommitted
New Touch UI buttons (MarlinFirmware#19465)
1 parent 15b3135 commit b57d80f

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp

+25-18
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,29 @@ using namespace ExtUI;
3535
using namespace Theme;
3636

3737
#ifdef TOUCH_UI_PORTRAIT
38-
#define GRID_ROWS 9
38+
#define GRID_ROWS 10
3939
#define GRID_COLS 2
4040
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
4141
#define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1)
4242
#define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1)
43-
#define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1)
44-
#define BLTOUCH_TITLE_POS BTN_POS(1,6), BTN_SIZE(2,1)
45-
#define BLTOUCH_RESET_POS BTN_POS(1,7), BTN_SIZE(1,1)
46-
#define BLTOUCH_TEST_POS BTN_POS(2,7), BTN_SIZE(1,1)
47-
#define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1)
43+
#define Z_AUTO_ALIGN_POS BTN_POS(1,4), BTN_SIZE(2,1)
44+
#define SHOW_MESH_POS BTN_POS(1,5), BTN_SIZE(2,1)
45+
#define BLTOUCH_TITLE_POS BTN_POS(1,7), BTN_SIZE(2,1)
46+
#define BLTOUCH_RESET_POS BTN_POS(1,8), BTN_SIZE(1,1)
47+
#define BLTOUCH_TEST_POS BTN_POS(2,8), BTN_SIZE(1,1)
48+
#define BACK_POS BTN_POS(1,10), BTN_SIZE(2,1)
4849
#else
49-
#define GRID_ROWS 7
50+
#define GRID_ROWS 8
5051
#define GRID_COLS 2
5152
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
5253
#define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1)
5354
#define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1)
54-
#define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1)
55-
#define BLTOUCH_TITLE_POS BTN_POS(1,5), BTN_SIZE(2,1)
56-
#define BLTOUCH_RESET_POS BTN_POS(1,6), BTN_SIZE(1,1)
57-
#define BLTOUCH_TEST_POS BTN_POS(2,6), BTN_SIZE(1,1)
58-
#define BACK_POS BTN_POS(1,7), BTN_SIZE(2,1)
55+
#define Z_AUTO_ALIGN_POS BTN_POS(1,4), BTN_SIZE(2,1)
56+
#define SHOW_MESH_POS BTN_POS(1,5), BTN_SIZE(2,1)
57+
#define BLTOUCH_TITLE_POS BTN_POS(1,6), BTN_SIZE(2,1)
58+
#define BLTOUCH_RESET_POS BTN_POS(1,7), BTN_SIZE(1,1)
59+
#define BLTOUCH_TEST_POS BTN_POS(2,7), BTN_SIZE(1,1)
60+
#define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
5961
#endif
6062

6163
void LevelingMenu::onRedraw(draw_mode_t what) {
@@ -78,12 +80,14 @@ void LevelingMenu::onRedraw(draw_mode_t what) {
7880
#endif
7981
)
8082
.tag(3).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS))
83+
.enabled(ENABLED(Z_STEPPER_AUTO_ALIGN))
84+
.tag(4).button(Z_AUTO_ALIGN_POS, GET_TEXT_F(MSG_AUTO_Z_ALIGN))
8185
.enabled(ENABLED(HAS_MESH))
82-
.tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH));
86+
.tag(5).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH));
8387
#if ENABLED(BLTOUCH)
8488
cmd.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH))
85-
.tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET))
86-
.tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST));
89+
.tag(6).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET))
90+
.tag(7).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST));
8791
#endif
8892
cmd.colors(action_btn)
8993
.tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
@@ -103,12 +107,15 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) {
103107
#ifdef AXIS_LEVELING_COMMANDS
104108
case 3: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break;
105109
#endif
110+
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
111+
case 4: SpinnerDialogBox::enqueueAndWait_P(F("G34")); break;
112+
#endif
106113
#if HAS_MESH
107-
case 4: GOTO_SCREEN(BedMeshScreen); break;
114+
case 5: GOTO_SCREEN(BedMeshScreen); break;
108115
#endif
109116
#if ENABLED(BLTOUCH)
110-
case 5: injectCommands_P(PSTR("M280 P0 S60")); break;
111-
case 6: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
117+
case 6: injectCommands_P(PSTR("M280 P0 S60")); break;
118+
case 7: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
112119
#endif
113120
default: return false;
114121
}

Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void TuneMenu::onRedraw(draw_mode_t what) {
3737
}
3838

3939
#ifdef TOUCH_UI_PORTRAIT
40-
#define GRID_ROWS 8
40+
#define GRID_ROWS 9
4141
#define GRID_COLS 2
4242
#define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(2,1)
4343
#define FIL_CHANGE_POS BTN_POS(1,2), BTN_SIZE(2,1)
@@ -46,9 +46,10 @@ void TuneMenu::onRedraw(draw_mode_t what) {
4646
#define SPEED_POS BTN_POS(1,5), BTN_SIZE(2,1)
4747
#define PAUSE_POS BTN_POS(1,6), BTN_SIZE(2,1)
4848
#define STOP_POS BTN_POS(1,7), BTN_SIZE(2,1)
49-
#define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
49+
#define CASE_LIGHT_POS BTN_POS(1,8), BTN_SIZE(2,1)
50+
#define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1)
5051
#else
51-
#define GRID_ROWS 4
52+
#define GRID_ROWS 5
5253
#define GRID_COLS 2
5354
#define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(1,1)
5455
#define NUDGE_NOZ_POS BTN_POS(2,1), BTN_SIZE(1,1)
@@ -57,7 +58,8 @@ void TuneMenu::onRedraw(draw_mode_t what) {
5758
#define PAUSE_POS BTN_POS(1,3), BTN_SIZE(1,1)
5859
#define STOP_POS BTN_POS(2,3), BTN_SIZE(1,1)
5960
#define FILAMENT_POS BTN_POS(1,4), BTN_SIZE(1,1)
60-
#define BACK_POS BTN_POS(2,4), BTN_SIZE(1,1)
61+
#define CASE_LIGHT_POS BTN_POS(2,4), BTN_SIZE(1,1)
62+
#define BACK_POS BTN_POS(1,5), BTN_SIZE(2,1)
6163
#endif
6264

6365
if (what & FOREGROUND) {
@@ -79,6 +81,8 @@ void TuneMenu::onRedraw(draw_mode_t what) {
7981
.button( PAUSE_POS, isPrintingFromMediaPaused() ? GET_TEXT_F(MSG_RESUME_PRINT) : GET_TEXT_F(MSG_PAUSE_PRINT))
8082
.enabled(TERN0(SDSUPPORT, isPrintingFromMedia()))
8183
.tag(8).button( STOP_POS, GET_TEXT_F(MSG_STOP_PRINT))
84+
.enabled(ENABLED(CASE_LIGHT_ENABLE))
85+
.tag(10).button( CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT))
8286
.tag(1).colors(action_btn)
8387
.button( BACK_POS, GET_TEXT_F(MSG_BACK));
8488
}
@@ -111,6 +115,9 @@ bool TuneMenu::onTouchEnd(uint8_t tag) {
111115
#if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
112116
case 9: GOTO_SCREEN(FilamentMenu); break;
113117
#endif
118+
#if ENABLED(CASE_LIGHT_ENABLE)
119+
case 10: GOTO_SCREEN(CaseLightScreen); break;
120+
#endif
114121
default:
115122
return false;
116123
}

0 commit comments

Comments
 (0)