🚸 Stop button for Touch UI (#25379)

This commit is contained in:
alexgrach
2023-02-15 09:40:26 +03:00
committed by GitHub
parent fc20533583
commit 196f403dd6
5 changed files with 23 additions and 6 deletions

View File

@@ -233,6 +233,13 @@ void Touch::touch(touch_control_t *control) {
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
#endif
break;
case STOP:
ui.goto_screen([]{
MenuItem_confirm::select_screen(GET_TEXT_F(MSG_BUTTON_STOP),
GET_TEXT_F(MSG_BACK), ui.abort_print, ui.goto_previous_screen,
GET_TEXT_F(MSG_STOP_PRINT), FSTR_P(nullptr), FPSTR("?"));
});
break;
#if ENABLED(AUTO_BED_LEVELING_UBL)
case UBL: hold(control, UBL_REPEAT_DELAY); ui.encoderPosition += control->data; break;

View File

@@ -65,6 +65,7 @@ enum TouchControlType : uint16_t {
FLOWRATE,
UBL,
MOVE_AXIS,
STOP,
BUTTON,
};

View File

@@ -328,7 +328,10 @@ void MarlinUI::draw_status_screen() {
add_control(900, y, menu_main, imgSettings);
#if ENABLED(SDSUPPORT)
const bool cm = card.isMounted(), pa = printingIsActive();
add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED);
if (cm && pa)
add_control(12, y, STOP, imgCancel, true, COLOR_CONTROL_CANCEL);
else
add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, COLOR_CONTROL_DISABLED);
#endif
#endif

View File

@@ -450,9 +450,12 @@ void MarlinUI::draw_status_screen() {
);
#if ENABLED(SDSUPPORT)
const bool cm = card.isMounted(), pa = printingIsActive();
add_control(0, TERN(TFT_COLOR_UI_PORTRAIT, 210, 130), menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED);
if (cm && pa)
add_control(0, TERN(TFT_COLOR_UI_PORTRAIT, 210, 130), STOP, imgCancel, true, COLOR_CONTROL_CANCEL);
else
add_control(0, TERN(TFT_COLOR_UI_PORTRAIT, 210, 130), menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, COLOR_CONTROL_DISABLED);
#endif
} // (sublime)
}
#endif // TOUCH_SCREEN
}
@@ -549,8 +552,8 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con
tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
}
#if ENABLED(TOUCH_SCREEN)
if (no) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 32, 48), TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
if (yes) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 172, 208), TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
if (no) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 16, 48), TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
if (yes) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 160, 208), TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
#endif
}

View File

@@ -322,7 +322,10 @@ void MarlinUI::draw_status_screen() {
add_control(404, y, menu_main, imgSettings);
#if ENABLED(SDSUPPORT)
const bool cm = card.isMounted(), pa = printingIsActive();
add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED);
if (cm && pa)
add_control(12, y, STOP, imgCancel, true, COLOR_CONTROL_CANCEL);
else
add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, COLOR_CONTROL_DISABLED);
#endif
#endif