Skip to content

Commit 3f19cee

Browse files
thinkyheadSMHRambo
authored andcommitted
πŸ§‘β€πŸ’» HostUI::continue_prompt method
1 parent 3d18b05 commit 3f19cee

File tree

8 files changed

+16
-13
lines changed

8 files changed

+16
-13
lines changed

β€ŽMarlin/src/feature/host_actions.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
PROMPT_INFO
3636
};
3737

38+
extern const char CONTINUE_STR[], DISMISS_STR[];
39+
3840
#endif
3941

4042
class HostUI {
@@ -111,6 +113,9 @@ class HostUI {
111113
static void prompt_do(const PromptReason reason, FSTR_P const pstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
112114
static void prompt_do(const PromptReason reason, const char * const cstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
113115

116+
static void continue_prompt(FSTR_P const fstr) { prompt_do(PROMPT_USER_CONTINUE, fstr, FPSTR(CONTINUE_STR)); }
117+
static void continue_prompt(const char * const cstr) { prompt_do(PROMPT_USER_CONTINUE, cstr, FPSTR(CONTINUE_STR)); }
118+
114119
static void prompt_open(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) {
115120
if (host_prompt_reason == PROMPT_NOT_DEFINED) prompt_do(reason, pstr, btn1, btn2);
116121
}
@@ -124,5 +129,3 @@ class HostUI {
124129
};
125130

126131
extern HostUI hostui;
127-
128-
extern const char CONTINUE_STR[], DISMISS_STR[];

β€ŽMarlin/src/feature/mmu/mmu2.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
981981
if (recover) {
982982
LCD_MESSAGE(MSG_MMU2_REMOVE_AND_CLICK);
983983
mmu2_attn_buzz();
984-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_MMU2_EJECT_RECOVER), FPSTR(CONTINUE_STR)));
984+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_MMU2_EJECT_RECOVER)));
985985
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_MMU2_EJECT_RECOVER)));
986986
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
987987
mmu2_attn_buzz(true);

β€ŽMarlin/src/feature/pause.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
260260
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
261261

262262
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)));
263-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR)));
263+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)));
264264
wait_for_user = true; // A click or M108 breaks the purge_length loop
265265
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
266266
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
@@ -525,7 +525,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
525525

526526
// Wait for filament insert by user and press button
527527
KEEPALIVE_STATE(PAUSED_FOR_USER);
528-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_NOZZLE_PARKED), FPSTR(CONTINUE_STR)));
528+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_NOZZLE_PARKED)));
529529
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_NOZZLE_PARKED)));
530530
wait_for_user = true; // LCD click or M108 will clear this
531531
while (wait_for_user) {
@@ -565,7 +565,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
565565

566566
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
567567

568-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR)));
568+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_REHEATDONE)));
569569
#if ENABLED(EXTENSIBLE_UI)
570570
ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE));
571571
#else

β€ŽMarlin/src/gcode/config/M43.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ void GcodeSuite::M43() {
370370
#if HAS_RESUME_CONTINUE
371371
KEEPALIVE_STATE(PAUSED_FOR_USER);
372372
wait_for_user = true;
373-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("M43 Waiting..."), FPSTR(CONTINUE_STR)));
373+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(F("M43 Waiting...")));
374374
#if ENABLED(EXTENSIBLE_UI)
375375
ExtUI::onUserConfirmRequired(F("M43 Waiting..."));
376376
#else

β€ŽMarlin/src/gcode/lcd/M0_M1.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ void GcodeSuite::M0_M1() {
8787

8888
#if ENABLED(HOST_PROMPT_SUPPORT)
8989
if (parser.string_arg)
90-
hostui.prompt_do(PROMPT_USER_CONTINUE, parser.string_arg, FPSTR(CONTINUE_STR));
90+
hostui.continue_prompt(parser.string_arg);
9191
else
92-
hostui.prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? F("M1 Stop") : F("M0 Stop"), FPSTR(CONTINUE_STR));
92+
hostui.continue_prompt(parser.codenum ? F("M1 Stop") : F("M0 Stop"));
9393
#endif
9494

9595
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(ms));

β€ŽMarlin/src/gcode/sd/M1001.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void GcodeSuite::M1001() {
9797
if (long_print) {
9898
printerEventLEDs.onPrintCompleted();
9999
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PRINT_DONE)));
100-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_PRINT_DONE), FPSTR(CONTINUE_STR)));
100+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_PRINT_DONE)));
101101
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(SEC_TO_MS(TERN(HAS_MARLINUI_MENU, PE_LEDS_COMPLETED_TIME, 30))));
102102
printerEventLEDs.onResumeAfterWait();
103103
}

β€ŽMarlin/src/lcd/menu/menu_delta_calibrate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
6868
float lcd_probe_pt(const xy_pos_t &xy) {
6969
_man_probe_pt(xy);
7070
ui.defer_status_screen();
71-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_DELTA_CALIBRATION_IN_PROGRESS), FPSTR(CONTINUE_STR)));
71+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_DELTA_CALIBRATION_IN_PROGRESS)));
7272
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_DELTA_CALIBRATION_IN_PROGRESS)));
7373
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
7474
ui.goto_previous_screen_no_defer();

β€ŽMarlin/src/module/probe.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
168168
LCD_MESSAGE(MSG_MANUAL_DEPLOY_TOUCHMI);
169169
ui.return_to_status();
170170

171-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("Deploy TouchMI"), FPSTR(CONTINUE_STR)));
171+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(F("Deploy TouchMI")));
172172
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
173173
ui.reset_status();
174174
ui.goto_screen(prev_screen);
@@ -373,7 +373,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
373373
ui.set_status(ds_str, 99);
374374
SERIAL_ECHOLNF(deploy ? GET_EN_TEXT_F(MSG_MANUAL_DEPLOY) : GET_EN_TEXT_F(MSG_MANUAL_STOW));
375375

376-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, ds_str, FPSTR(CONTINUE_STR)));
376+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(ds_str));
377377
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_str));
378378
TERN_(DWIN_LCD_PROUI, DWIN_Popup_Confirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR)));
379379
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());

0 commit comments

Comments
Β (0)