New Touch UI buttons (#19465)

This commit is contained in:
Marcio T 2020-09-22 20:01:01 -06:00 committed by Scott Lahteine
parent f34ea44d73
commit 1978a29678
2 changed files with 38 additions and 24 deletions

View File

@ -35,27 +35,29 @@ using namespace ExtUI;
using namespace Theme; using namespace Theme;
#ifdef TOUCH_UI_PORTRAIT #ifdef TOUCH_UI_PORTRAIT
#define GRID_ROWS 9 #define GRID_ROWS 10
#define GRID_COLS 2 #define GRID_COLS 2
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
#define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1) #define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1)
#define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1) #define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1)
#define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1) #define Z_AUTO_ALIGN_POS BTN_POS(1,4), BTN_SIZE(2,1)
#define SHOW_MESH_POS BTN_POS(1,5), BTN_SIZE(2,1)
#define BLTOUCH_TITLE_POS BTN_POS(1,7), BTN_SIZE(2,1)
#define BLTOUCH_RESET_POS BTN_POS(1,8), BTN_SIZE(1,1)
#define BLTOUCH_TEST_POS BTN_POS(2,8), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(1,10), BTN_SIZE(2,1)
#else
#define GRID_ROWS 8
#define GRID_COLS 2
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
#define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1)
#define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1)
#define Z_AUTO_ALIGN_POS BTN_POS(1,4), BTN_SIZE(2,1)
#define SHOW_MESH_POS BTN_POS(1,5), BTN_SIZE(2,1)
#define BLTOUCH_TITLE_POS BTN_POS(1,6), BTN_SIZE(2,1) #define BLTOUCH_TITLE_POS BTN_POS(1,6), BTN_SIZE(2,1)
#define BLTOUCH_RESET_POS BTN_POS(1,7), BTN_SIZE(1,1) #define BLTOUCH_RESET_POS BTN_POS(1,7), BTN_SIZE(1,1)
#define BLTOUCH_TEST_POS BTN_POS(2,7), BTN_SIZE(1,1) #define BLTOUCH_TEST_POS BTN_POS(2,7), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1) #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
#else
#define GRID_ROWS 7
#define GRID_COLS 2
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
#define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1)
#define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1)
#define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1)
#define BLTOUCH_TITLE_POS BTN_POS(1,5), BTN_SIZE(2,1)
#define BLTOUCH_RESET_POS BTN_POS(1,6), BTN_SIZE(1,1)
#define BLTOUCH_TEST_POS BTN_POS(2,6), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(1,7), BTN_SIZE(2,1)
#endif #endif
void LevelingMenu::onRedraw(draw_mode_t what) { void LevelingMenu::onRedraw(draw_mode_t what) {
@ -78,12 +80,14 @@ void LevelingMenu::onRedraw(draw_mode_t what) {
#endif #endif
) )
.tag(3).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS)) .tag(3).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS))
.enabled(ENABLED(Z_STEPPER_AUTO_ALIGN))
.tag(4).button(Z_AUTO_ALIGN_POS, GET_TEXT_F(MSG_AUTO_Z_ALIGN))
.enabled(ENABLED(HAS_MESH)) .enabled(ENABLED(HAS_MESH))
.tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH)); .tag(5).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH));
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
cmd.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH)) cmd.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH))
.tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET)) .tag(6).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET))
.tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST)); .tag(7).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST));
#endif #endif
cmd.colors(action_btn) cmd.colors(action_btn)
.tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
@ -103,12 +107,15 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) {
#ifdef AXIS_LEVELING_COMMANDS #ifdef AXIS_LEVELING_COMMANDS
case 3: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break; case 3: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break;
#endif #endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
case 4: SpinnerDialogBox::enqueueAndWait_P(F("G34")); break;
#endif
#if HAS_MESH #if HAS_MESH
case 4: GOTO_SCREEN(BedMeshScreen); break; case 5: GOTO_SCREEN(BedMeshScreen); break;
#endif #endif
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
case 5: injectCommands_P(PSTR("M280 P0 S60")); break; case 6: injectCommands_P(PSTR("M280 P0 S60")); break;
case 6: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break; case 7: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
#endif #endif
default: return false; default: return false;
} }

View File

@ -37,7 +37,7 @@ void TuneMenu::onRedraw(draw_mode_t what) {
} }
#ifdef TOUCH_UI_PORTRAIT #ifdef TOUCH_UI_PORTRAIT
#define GRID_ROWS 8 #define GRID_ROWS 9
#define GRID_COLS 2 #define GRID_COLS 2
#define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(2,1) #define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(2,1)
#define FIL_CHANGE_POS BTN_POS(1,2), BTN_SIZE(2,1) #define FIL_CHANGE_POS BTN_POS(1,2), BTN_SIZE(2,1)
@ -46,9 +46,10 @@ void TuneMenu::onRedraw(draw_mode_t what) {
#define SPEED_POS BTN_POS(1,5), BTN_SIZE(2,1) #define SPEED_POS BTN_POS(1,5), BTN_SIZE(2,1)
#define PAUSE_POS BTN_POS(1,6), BTN_SIZE(2,1) #define PAUSE_POS BTN_POS(1,6), BTN_SIZE(2,1)
#define STOP_POS BTN_POS(1,7), BTN_SIZE(2,1) #define STOP_POS BTN_POS(1,7), BTN_SIZE(2,1)
#define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1) #define CASE_LIGHT_POS BTN_POS(1,8), BTN_SIZE(2,1)
#define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1)
#else #else
#define GRID_ROWS 4 #define GRID_ROWS 5
#define GRID_COLS 2 #define GRID_COLS 2
#define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(1,1) #define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(1,1)
#define NUDGE_NOZ_POS BTN_POS(2,1), BTN_SIZE(1,1) #define NUDGE_NOZ_POS BTN_POS(2,1), BTN_SIZE(1,1)
@ -57,7 +58,8 @@ void TuneMenu::onRedraw(draw_mode_t what) {
#define PAUSE_POS BTN_POS(1,3), BTN_SIZE(1,1) #define PAUSE_POS BTN_POS(1,3), BTN_SIZE(1,1)
#define STOP_POS BTN_POS(2,3), BTN_SIZE(1,1) #define STOP_POS BTN_POS(2,3), BTN_SIZE(1,1)
#define FILAMENT_POS BTN_POS(1,4), BTN_SIZE(1,1) #define FILAMENT_POS BTN_POS(1,4), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(2,4), BTN_SIZE(1,1) #define CASE_LIGHT_POS BTN_POS(2,4), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(1,5), BTN_SIZE(2,1)
#endif #endif
if (what & FOREGROUND) { if (what & FOREGROUND) {
@ -79,6 +81,8 @@ void TuneMenu::onRedraw(draw_mode_t what) {
.button( PAUSE_POS, isPrintingFromMediaPaused() ? GET_TEXT_F(MSG_RESUME_PRINT) : GET_TEXT_F(MSG_PAUSE_PRINT)) .button( PAUSE_POS, isPrintingFromMediaPaused() ? GET_TEXT_F(MSG_RESUME_PRINT) : GET_TEXT_F(MSG_PAUSE_PRINT))
.enabled(TERN0(SDSUPPORT, isPrintingFromMedia())) .enabled(TERN0(SDSUPPORT, isPrintingFromMedia()))
.tag(8).button( STOP_POS, GET_TEXT_F(MSG_STOP_PRINT)) .tag(8).button( STOP_POS, GET_TEXT_F(MSG_STOP_PRINT))
.enabled(ENABLED(CASE_LIGHT_ENABLE))
.tag(10).button( CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT))
.tag(1).colors(action_btn) .tag(1).colors(action_btn)
.button( BACK_POS, GET_TEXT_F(MSG_BACK)); .button( BACK_POS, GET_TEXT_F(MSG_BACK));
} }
@ -111,6 +115,9 @@ bool TuneMenu::onTouchEnd(uint8_t tag) {
#if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
case 9: GOTO_SCREEN(FilamentMenu); break; case 9: GOTO_SCREEN(FilamentMenu); break;
#endif #endif
#if ENABLED(CASE_LIGHT_ENABLE)
case 10: GOTO_SCREEN(CaseLightScreen); break;
#endif
default: default:
return false; return false;
} }