Browse Source

Tweak a host prompt call

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
a90b90e98d
  1. 12
      Marlin/src/feature/host_actions.cpp
  2. 1
      Marlin/src/feature/host_actions.h
  3. 7
      Marlin/src/feature/pause.cpp

12
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_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_end() { host_action_prompt(PSTR("end")); }
void host_action_prompt_show() { host_action_prompt(PSTR("show")); } 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 (btn1) host_action_prompt_button(btn1);
if (btn2) host_action_prompt_button(btn2); if (btn2) host_action_prompt_button(btn2);
host_action_prompt_show(); 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() { void filament_load_host_prompt() {
const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out); const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out);

1
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_end();
void host_action_prompt_show(); 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, 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) { 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); if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, btn1, btn2);
} }

7
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); first_impatient_beep(max_beep_count);
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
#if ENABLED(HOST_PROMPT_SUPPORT) #if ENABLED(HOST_PROMPT_SUPPORT)
const char tool = '0' const char tool = '0'
#if NUM_RUNOUT_SENSORS > 1 #if NUM_RUNOUT_SENSORS > 1
+ active_extruder + active_extruder
#endif #endif
; ;
host_action_prompt_begin(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool); host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
host_action_prompt_button(CONTINUE_STR);
host_action_prompt_show();
#endif #endif
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament"))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
while (wait_for_user) { while (wait_for_user) {
impatient_beep(max_beep_count); impatient_beep(max_beep_count);
idle_no_sleep(); idle_no_sleep();

Loading…
Cancel
Save