From 35b9e9b4a5628252b22d78dc0657531ccbb3d8e8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 19 Oct 2020 00:25:51 -0500 Subject: [PATCH] Tweak a host prompt call --- Marlin/src/feature/host_actions.cpp | 12 ++++++++++-- Marlin/src/feature/host_actions.h | 1 + Marlin/src/feature/pause.cpp | 7 ++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index 3012639220..a8b2b51dfc 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -113,12 +113,20 @@ void host_action(PGM_P const pstr, const bool eol) { void host_action_prompt_button(PGM_P const pstr) { host_action_prompt_plus(PSTR("button"), pstr); } void host_action_prompt_end() { host_action_prompt(PSTR("end")); } void host_action_prompt_show() { host_action_prompt(PSTR("show")); } - void host_prompt_do(const PromptReason reason, PGM_P const pstr, PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) { - host_action_prompt_begin(reason, pstr); + + void _host_prompt_show(PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) { if (btn1) host_action_prompt_button(btn1); if (btn2) host_action_prompt_button(btn2); host_action_prompt_show(); } + void host_prompt_do(const PromptReason reason, PGM_P const pstr, PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) { + host_action_prompt_begin(reason, pstr); + _host_prompt_show(btn1, btn2); + } + void host_prompt_do(const PromptReason reason, PGM_P const pstr, const char extra_char, PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) { + host_action_prompt_begin(reason, pstr, extra_char); + _host_prompt_show(btn1, btn2); + } void filament_load_host_prompt() { const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out); diff --git a/Marlin/src/feature/host_actions.h b/Marlin/src/feature/host_actions.h index 09eeed23e2..065b59d755 100644 --- a/Marlin/src/feature/host_actions.h +++ b/Marlin/src/feature/host_actions.h @@ -71,6 +71,7 @@ void host_action(PGM_P const pstr, const bool eol=true); void host_action_prompt_end(); void host_action_prompt_show(); void host_prompt_do(const PromptReason reason, PGM_P const pstr, PGM_P const btn1=nullptr, PGM_P const btn2=nullptr); + void host_prompt_do(const PromptReason reason, PGM_P const pstr, const char extra_char, PGM_P const btn1=nullptr, PGM_P const btn2=nullptr); inline void host_prompt_open(const PromptReason reason, PGM_P const pstr, PGM_P const btn1=nullptr, PGM_P const btn2=nullptr) { if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, btn1, btn2); } diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 6f970d1a4c..0a3609b3a1 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -199,17 +199,18 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l first_impatient_beep(max_beep_count); KEEPALIVE_STATE(PAUSED_FOR_USER); + #if ENABLED(HOST_PROMPT_SUPPORT) const char tool = '0' #if NUM_RUNOUT_SENSORS > 1 + active_extruder #endif ; - host_action_prompt_begin(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool); - host_action_prompt_button(CONTINUE_STR); - host_action_prompt_show(); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR); #endif + TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament"))); + while (wait_for_user) { impatient_beep(max_beep_count); idle_no_sleep();