Browse Source

Tweak a host prompt call

Scott Lahteine 4 years ago
parent
commit
35b9e9b4a5

+ 10
- 2
Marlin/src/feature/host_actions.cpp View File

@@ -113,12 +113,20 @@ void host_action(PGM_P const pstr, const bool eol) {
113 113
   void host_action_prompt_button(PGM_P const pstr) { host_action_prompt_plus(PSTR("button"), pstr); }
114 114
   void host_action_prompt_end() { host_action_prompt(PSTR("end")); }
115 115
   void host_action_prompt_show() { host_action_prompt(PSTR("show")); }
116
-  void host_prompt_do(const PromptReason reason, PGM_P const pstr, PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) {
117
-    host_action_prompt_begin(reason, pstr);
116
+
117
+  void _host_prompt_show(PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) {
118 118
     if (btn1) host_action_prompt_button(btn1);
119 119
     if (btn2) host_action_prompt_button(btn2);
120 120
     host_action_prompt_show();
121 121
   }
122
+  void host_prompt_do(const PromptReason reason, PGM_P const pstr, PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) {
123
+    host_action_prompt_begin(reason, pstr);
124
+    _host_prompt_show(btn1, btn2);
125
+  }
126
+  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*/) {
127
+    host_action_prompt_begin(reason, pstr, extra_char);
128
+    _host_prompt_show(btn1, btn2);
129
+  }
122 130
 
123 131
   void filament_load_host_prompt() {
124 132
     const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out);

+ 1
- 0
Marlin/src/feature/host_actions.h View File

@@ -71,6 +71,7 @@ void host_action(PGM_P const pstr, const bool eol=true);
71 71
   void host_action_prompt_end();
72 72
   void host_action_prompt_show();
73 73
   void host_prompt_do(const PromptReason reason, PGM_P const pstr, PGM_P const btn1=nullptr, PGM_P const btn2=nullptr);
74
+  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);
74 75
   inline void host_prompt_open(const PromptReason reason, PGM_P const pstr, PGM_P const btn1=nullptr, PGM_P const btn2=nullptr) {
75 76
     if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, btn1, btn2);
76 77
   }

+ 4
- 3
Marlin/src/feature/pause.cpp View File

@@ -199,17 +199,18 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
199 199
     first_impatient_beep(max_beep_count);
200 200
 
201 201
     KEEPALIVE_STATE(PAUSED_FOR_USER);
202
+
202 203
     #if ENABLED(HOST_PROMPT_SUPPORT)
203 204
       const char tool = '0'
204 205
         #if NUM_RUNOUT_SENSORS > 1
205 206
           + active_extruder
206 207
         #endif
207 208
       ;
208
-      host_action_prompt_begin(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool);
209
-      host_action_prompt_button(CONTINUE_STR);
210
-      host_action_prompt_show();
209
+      host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
211 210
     #endif
211
+
212 212
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
213
+
213 214
     while (wait_for_user) {
214 215
       impatient_beep(max_beep_count);
215 216
       idle_no_sleep();

Loading…
Cancel
Save