Skip to content

Commit c0e9cb4

Browse files
thinkyheadTracy Spiva
authored and
Tracy Spiva
committed
πŸ§‘β€πŸ’» HostUI::continue_prompt method
1 parent dc2bf46 commit c0e9cb4

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
@@ -980,7 +980,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
980980
if (recover) {
981981
LCD_MESSAGE(MSG_MMU2_REMOVE_AND_CLICK);
982982
mmu2_attn_buzz();
983-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_MMU2_EJECT_RECOVER), FPSTR(CONTINUE_STR)));
983+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_MMU2_EJECT_RECOVER)));
984984
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_MMU2_EJECT_RECOVER)));
985985
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
986986
mmu2_attn_buzz(true);

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

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

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

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

571571
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
572572

573-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR)));
573+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(GET_TEXT_F(MSG_REHEATDONE)));
574574
#if ENABLED(EXTENSIBLE_UI)
575575
ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE));
576576
#else

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void GcodeSuite::M43() {
362362
#if HAS_RESUME_CONTINUE
363363
KEEPALIVE_STATE(PAUSED_FOR_USER);
364364
wait_for_user = true;
365-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("M43 Waiting..."), FPSTR(CONTINUE_STR)));
365+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(F("M43 Waiting...")));
366366
#if ENABLED(EXTENSIBLE_UI)
367367
ExtUI::onUserConfirmRequired(F("M43 Waiting..."));
368368
#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);
@@ -364,7 +364,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
364364
ui.set_status(ds_str, 99);
365365
SERIAL_ECHOLNF(deploy ? GET_EN_TEXT_F(MSG_MANUAL_DEPLOY) : GET_EN_TEXT_F(MSG_MANUAL_STOW));
366366

367-
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, ds_str, FPSTR(CONTINUE_STR)));
367+
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(ds_str));
368368
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_str));
369369
TERN_(DWIN_LCD_PROUI, DWIN_Popup_Confirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR)));
370370
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());

0 commit comments

Comments
Β (0)