From 0364ae49082428e821d813c80823fea99122a3fe Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Fri, 15 Jan 2021 12:59:27 -0700 Subject: [PATCH] Improve filament runout handling in FTDI EVE Touch UI - On filament runout, take the user to the tune menu where they can initiate a filament change or resume the print. --- .../screens/confirm_user_request_alert_box.cpp | 11 +++++++++-- .../extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp | 4 +++- Marlin/src/lcd/extui/ui_api.cpp | 4 ++++ Marlin/src/lcd/extui/ui_api.h | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) 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 637709e18..59e1c8220 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 @@ -36,8 +36,15 @@ void ConfirmUserRequestAlertBox::onRedraw(draw_mode_t mode) { bool ConfirmUserRequestAlertBox::onTouchEnd(uint8_t tag) { switch (tag) { case 1: - ExtUI::setUserConfirmed(); - GOTO_PREVIOUS(); + if (ExtUI::isPrintingPaused()) { + // The TuneMenu will call ExtUI::setUserConfirmed() + GOTO_SCREEN(TuneMenu); + current_screen.forget(); + } + else { + ExtUI::setUserConfirmed(); + GOTO_PREVIOUS(); + } return true; case 2: GOTO_PREVIOUS(); return true; default: return false; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp index 2fce402cf..5a290109f 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp @@ -143,7 +143,9 @@ void TuneMenu::pausePrint() { void TuneMenu::resumePrint() { sound.play(twinkle, PLAY_ASYNCHRONOUS); - if (ExtUI::isPrintingFromMedia()) + if (ExtUI::awaitingUserConfirm()) + ExtUI::setUserConfirmed(); + else if (ExtUI::isPrintingFromMedia()) ExtUI::resumePrint(); #ifdef ACTION_ON_RESUME else host_action_resume(); diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 7611dbb98..18689fe36 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -943,6 +943,10 @@ namespace ExtUI { feedrate_percentage = constrain(value, 10, 500); } + bool awaitingUserConfirm() { + return wait_for_user; + } + void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); } diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 5322ac69c..478fe6890 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -197,6 +197,7 @@ namespace ExtUI { void setTravelAcceleration_mm_s2(const float); void setFeedrate_percent(const float); void setFlow_percent(const int16_t, const extruder_t); + bool awaitingUserConfirm(); void setUserConfirmed(); #if ENABLED(LIN_ADVANCE)