Browse Source

🎨 Refactor Host Actions as singleton

vanilla_fb_2.0.x
Scott Lahteine 3 years ago
committed by Scott Lahteine
parent
commit
f80bcdcc5c
  1. 4
      Marlin/src/MarlinCore.cpp
  2. 2
      Marlin/src/feature/e_parser.h
  3. 111
      Marlin/src/feature/host_actions.cpp
  4. 118
      Marlin/src/feature/host_actions.h
  5. 2
      Marlin/src/feature/mmu/mmu2.cpp
  6. 28
      Marlin/src/feature/pause.cpp
  7. 9
      Marlin/src/feature/runout.cpp
  8. 2
      Marlin/src/gcode/config/M43.cpp
  9. 2
      Marlin/src/gcode/control/M111.cpp
  10. 10
      Marlin/src/gcode/gcode.cpp
  11. 2
      Marlin/src/gcode/host/M876.cpp
  12. 2
      Marlin/src/gcode/lcd/M0_M1.cpp
  13. 2
      Marlin/src/gcode/sd/M1001.cpp
  14. 8
      Marlin/src/gcode/sd/M24_M25.cpp
  15. 2
      Marlin/src/gcode/stats/M75-M78.cpp
  16. 2
      Marlin/src/lcd/e3v2/creality/dwin.cpp
  17. 2
      Marlin/src/lcd/e3v2/enhanced/dwin.cpp
  18. 6
      Marlin/src/lcd/e3v2/jyersui/dwin.cpp
  19. 4
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp
  20. 2
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/confirm_abort_print_dialog_box.cpp
  21. 4
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp
  22. 2
      Marlin/src/lcd/extui/ui_api.cpp
  23. 20
      Marlin/src/lcd/marlinui.cpp
  24. 4
      Marlin/src/lcd/menu/menu_delta_calibrate.cpp
  25. 2
      Marlin/src/lcd/menu/menu_main.cpp
  26. 4
      Marlin/src/module/probe.cpp

4
Marlin/src/MarlinCore.cpp

@ -872,7 +872,7 @@ void kill(FSTR_P const lcd_error/*=nullptr*/, FSTR_P const lcd_component/*=nullp
SERIAL_ERROR_MSG(STR_ERR_KILLED);
#ifdef ACTION_ON_KILL
host_action_kill();
hostui.kill();
#endif
minkill(steppers_off);
@ -1525,7 +1525,7 @@ void setup() {
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
SETUP_RUN(host_action_prompt_end());
SETUP_RUN(hostui.prompt_end());
#endif
#if HAS_TRINAMIC_CONFIG && DISABLED(PSU_DEFAULT_OFF)

2
Marlin/src/feature/e_parser.h

@ -199,7 +199,7 @@ public:
case EP_M112: killed_by_M112 = true; break;
case EP_M410: quickstop_by_M410 = true; break;
#if ENABLED(HOST_PROMPT_SUPPORT)
case EP_M876SN: host_response_handler(M876_reason); break;
case EP_M876SN: hostui.handle_response(M876_reason); break;
#endif
#if ENABLED(REALTIME_REPORTING_COMMANDS)
case EP_GRBL_STATUS: report_current_position_moving(); break;

111
Marlin/src/feature/host_actions.cpp

@ -24,10 +24,10 @@
#if ENABLED(HOST_ACTION_COMMANDS)
#include "host_actions.h"
//#define DEBUG_HOST_ACTIONS
#include "host_actions.h"
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#include "pause.h"
#include "../gcode/queue.h"
@ -37,7 +37,12 @@
#include "runout.h"
#endif
void host_action(FSTR_P const fstr, const bool eol) {
HostUI hostui;
flag_t HostUI::flag;
void HostUI::action(FSTR_P const fstr, const bool eol) {
if (!flag.bits) return;
PORT_REDIRECT(SerialMask::All);
SERIAL_ECHOPGM("//action:");
SERIAL_ECHOF(fstr);
@ -45,29 +50,40 @@ void host_action(FSTR_P const fstr, const bool eol) {
}
#ifdef ACTION_ON_KILL
void host_action_kill() { host_action(F(ACTION_ON_KILL)); }
void HostUI::kill() { action(F(ACTION_ON_KILL)); }
#endif
#ifdef ACTION_ON_PAUSE
void host_action_pause(const bool eol/*=true*/) { host_action(F(ACTION_ON_PAUSE), eol); }
void HostUI::pause(const bool eol/*=true*/) { action(F(ACTION_ON_PAUSE), eol); }
#endif
#ifdef ACTION_ON_PAUSED
void host_action_paused(const bool eol/*=true*/) { host_action(F(ACTION_ON_PAUSED), eol); }
void HostUI::paused(const bool eol/*=true*/) { action(F(ACTION_ON_PAUSED), eol); }
#endif
#ifdef ACTION_ON_RESUME
void host_action_resume() { host_action(F(ACTION_ON_RESUME)); }
void HostUI::resume() { action(F(ACTION_ON_RESUME)); }
#endif
#ifdef ACTION_ON_RESUMED
void host_action_resumed() { host_action(F(ACTION_ON_RESUMED)); }
void HostUI::resumed() { action(F(ACTION_ON_RESUMED)); }
#endif
#ifdef ACTION_ON_CANCEL
void host_action_cancel() { host_action(F(ACTION_ON_CANCEL)); }
void HostUI::cancel() { action(F(ACTION_ON_CANCEL)); }
#endif
#ifdef ACTION_ON_START
void host_action_start() { host_action(F(ACTION_ON_START)); }
void HostUI::start() { action(F(ACTION_ON_START)); }
#endif
#if ENABLED(G29_RETRY_AND_RECOVER)
#ifdef ACTION_ON_G29_RECOVER
void HostUI::g29_recover() { action(F(ACTION_ON_G29_RECOVER)); }
#endif
#ifdef ACTION_ON_G29_FAILURE
void HostUI::g29_failure() { action(F(ACTION_ON_G29_FAILURE)); }
#endif
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
PromptReason HostUI::host_prompt_reason = PROMPT_NOT_DEFINED;
PGMSTR(CONTINUE_STR, "Continue");
PGMSTR(DISMISS_STR, "Dismiss");
@ -75,64 +91,69 @@ void host_action(FSTR_P const fstr, const bool eol) {
extern bool wait_for_user;
#endif
PromptReason host_prompt_reason = PROMPT_NOT_DEFINED;
void host_action_notify(const char * const cstr) {
void HostUI::notify(const char * const cstr) {
if (!flag.bits) return;
PORT_REDIRECT(SerialMask::All);
host_action(F("notification "), false);
action(F("notification "), false);
SERIAL_ECHOLN(cstr);
}
void host_action_notify(FSTR_P const fstr) {
void HostUI::notify_P(PGM_P const pstr) {
if (!flag.bits) return;
PORT_REDIRECT(SerialMask::All);
host_action(F("notification "), false);
SERIAL_ECHOLNF(fstr);
action(F("notification "), false);
SERIAL_ECHOLNPGM_P(pstr);
}
void host_action_prompt(FSTR_P const ptype, const bool eol=true) {
void HostUI::prompt(FSTR_P const ptype, const bool eol/*=true*/) {
if (!flag.bits) return;
PORT_REDIRECT(SerialMask::All);
host_action(F("prompt_"), false);
action(F("prompt_"), false);
SERIAL_ECHOF(ptype);
if (eol) SERIAL_EOL();
}
void host_action_prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0') {
host_action_prompt(ptype, false);
void HostUI::prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char/*='\0'*/) {
if (!flag.bits) return;
prompt(ptype, false);
PORT_REDIRECT(SerialMask::All);
SERIAL_CHAR(' ');
SERIAL_ECHOF(fstr);
if (extra_char != '\0') SERIAL_CHAR(extra_char);
SERIAL_EOL();
}
void host_action_prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) {
host_action_prompt_end();
void HostUI::prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) {
if (!flag.bits) return;
prompt_end();
host_prompt_reason = reason;
host_action_prompt_plus(F("begin"), fstr, extra_char);
prompt_plus(F("begin"), fstr, extra_char);
}
void host_action_prompt_button(FSTR_P const fstr) { host_action_prompt_plus(F("button"), fstr); }
void host_action_prompt_end() { host_action_prompt(F("end")); }
void host_action_prompt_show() { host_action_prompt(F("show")); }
void _host_prompt_show(FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
if (btn1) host_action_prompt_button(btn1);
if (btn2) host_action_prompt_button(btn2);
host_action_prompt_show();
void HostUI::prompt_button(FSTR_P const fstr) { prompt_plus(F("button"), fstr); }
void HostUI::prompt_end() { prompt(F("end")); }
void HostUI::prompt_show() { prompt(F("show")); }
void HostUI::_prompt_show(FSTR_P const btn1, FSTR_P const btn2) {
if (btn1) prompt_button(btn1);
if (btn2) prompt_button(btn2);
prompt_show();
}
void host_prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
host_action_prompt_begin(reason, fstr);
_host_prompt_show(btn1, btn2);
void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
prompt_begin(reason, fstr);
_prompt_show(btn1, btn2);
}
void host_prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
host_action_prompt_begin(reason, fstr, extra_char);
_host_prompt_show(btn1, btn2);
void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
prompt_begin(reason, fstr, extra_char);
_prompt_show(btn1, btn2);
}
void filament_load_host_prompt() {
const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out);
host_prompt_do(PROMPT_FILAMENT_RUNOUT, F("Paused"), F("PurgeMore"),
disable_to_continue ? F("DisableRunout") : FPSTR(CONTINUE_STR)
);
}
#if ENABLED(ADVANCED_PAUSE_FEATURE)
void HostUI::filament_load_prompt() {
const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out);
prompt_do(PROMPT_FILAMENT_RUNOUT, F("Paused"), F("PurgeMore"),
disable_to_continue ? F("DisableRunout") : FPSTR(CONTINUE_STR)
);
}
#endif
//
// Handle responses from the host, such as:
@ -141,7 +162,7 @@ void host_action(FSTR_P const fstr, const bool eol) {
// - Resume Print response
// - Dismissal of info
//
void host_response_handler(const uint8_t response) {
void HostUI::handle_response(const uint8_t response) {
const PromptReason hpr = host_prompt_reason;
host_prompt_reason = PROMPT_NOT_DEFINED; // Reset now ahead of logic
switch (hpr) {

118
Marlin/src/feature/host_actions.h

@ -24,34 +24,13 @@
#include "../inc/MarlinConfigPre.h"
#include "../HAL/shared/Marduino.h"
void host_action(FSTR_P const fstr, const bool eol=true);
#ifdef ACTION_ON_KILL
void host_action_kill();
#endif
#ifdef ACTION_ON_PAUSE
void host_action_pause(const bool eol=true);
#endif
#ifdef ACTION_ON_PAUSED
void host_action_paused(const bool eol=true);
#endif
#ifdef ACTION_ON_RESUME
void host_action_resume();
#endif
#ifdef ACTION_ON_RESUMED
void host_action_resumed();
#endif
#ifdef ACTION_ON_CANCEL
void host_action_cancel();
#endif
#ifdef ACTION_ON_START
void host_action_start();
#endif
typedef union {
uint8_t bits;
struct { bool info:1, errors:1, debug:1; };
} flag_t;
#if ENABLED(HOST_PROMPT_SUPPORT)
extern const char CONTINUE_STR[], DISMISS_STR[];
enum PromptReason : uint8_t {
PROMPT_NOT_DEFINED,
PROMPT_FILAMENT_RUNOUT,
@ -61,21 +40,80 @@ void host_action(FSTR_P const fstr, const bool eol=true);
PROMPT_INFO
};
extern PromptReason host_prompt_reason;
#endif
void host_response_handler(const uint8_t response);
void host_action_notify(const char * const cstr);
void host_action_notify(FSTR_P const fstr);
void host_action_prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char='\0');
void host_action_prompt_button(FSTR_P const fstr);
void host_action_prompt_end();
void host_action_prompt_show();
void host_prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
void host_prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
inline void host_prompt_open(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) {
if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, fstr, btn1, btn2);
}
class HostUI {
public:
void filament_load_host_prompt();
static flag_t flag;
HostUI() { flag.bits = 0xFF; }
#endif
static void action(FSTR_P const fstr, const bool eol=true);
#ifdef ACTION_ON_KILL
static void kill();
#endif
#ifdef ACTION_ON_PAUSE
static void pause(const bool eol=true);
#endif
#ifdef ACTION_ON_PAUSED
static void paused(const bool eol=true);
#endif
#ifdef ACTION_ON_RESUME
static void resume();
#endif
#ifdef ACTION_ON_RESUMED
static void resumed();
#endif
#ifdef ACTION_ON_CANCEL
static void cancel();
#endif
#ifdef ACTION_ON_START
static void start();
#endif
#if ENABLED(G29_RETRY_AND_RECOVER)
#ifdef ACTION_ON_G29_RECOVER
static void g29_recover();
#endif
#ifdef ACTION_ON_G29_FAILURE
static void g29_failure();
#endif
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
private:
static void prompt(FSTR_P const ptype, const bool eol=true);
static void prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0');
static void prompt_show();
static void _prompt_show(FSTR_P const btn1, FSTR_P const btn2);
public:
static PromptReason host_prompt_reason;
static void handle_response(const uint8_t response);
static void notify_P(PGM_P const message);
static inline void notify(FSTR_P const fmsg) { notify_P(FTOP(fmsg)); }
static void notify(const char * const message);
static void prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char='\0');
static void prompt_button(FSTR_P const fstr);
static void prompt_end();
static void prompt_do(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
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);
static inline void prompt_open(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) {
if (host_prompt_reason == PROMPT_NOT_DEFINED) prompt_do(reason, pstr, btn1, btn2);
}
#if ENABLED(ADVANCED_PAUSE_FEATURE)
static void filament_load_prompt();
#endif
#endif
};
extern HostUI hostui;
extern const char CONTINUE_STR[], DISMISS_STR[];

2
Marlin/src/feature/mmu/mmu2.cpp

@ -962,7 +962,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
if (recover) {
LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
BUZZ(200, 404);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
BUZZ(200, 404);

28
Marlin/src/feature/pause.cpp

@ -198,7 +198,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
#if ENABLED(HOST_PROMPT_SUPPORT)
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
host_prompt_do(PROMPT_USER_CONTINUE, F("Load Filament T"), tool, FPSTR(CONTINUE_STR));
hostui.prompt_do(PROMPT_USER_CONTINUE, F("Load Filament T"), tool, FPSTR(CONTINUE_STR));
#endif
while (wait_for_user) {
@ -253,7 +253,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)));
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR)));
wait_for_user = true; // A click or M108 breaks the purge_length loop
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
@ -271,7 +271,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
}
TERN_(HOST_PROMPT_SUPPORT, filament_load_host_prompt()); // Initiate another host prompt.
TERN_(HOST_PROMPT_SUPPORT, hostui.filament_load_prompt()); // Initiate another host prompt.
#if M600_PURGE_MORE_RESUMABLE
if (show_lcd) {
@ -291,7 +291,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
} while (TERN0(M600_PURGE_MORE_RESUMABLE, pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE));
#endif
TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_end());
return true;
}
@ -397,13 +397,13 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
#if ENABLED(HOST_ACTION_COMMANDS)
#ifdef ACTION_ON_PAUSED
host_action_paused();
hostui.paused();
#elif defined(ACTION_ON_PAUSE)
host_action_pause();
hostui.pause();
#endif
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
// Indicate that the printer is paused
++did_pause_print;
@ -512,7 +512,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
// Wait for filament insert by user and press button
KEEPALIVE_STATE(PAUSED_FOR_USER);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_NOZZLE_PARKED), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_NOZZLE_PARKED), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_NOZZLE_PARKED)));
wait_for_user = true; // LCD click or M108 will clear this
while (wait_for_user) {
@ -528,13 +528,13 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
ui.pause_show_message(PAUSE_MESSAGE_HEAT);
SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_HEAT));
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_REHEAT)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_REHEAT)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_HEATER_TIMEOUT)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(0, true)); // Wait for LCD click or M108
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, GET_TEXT_F(MSG_REHEATING)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_INFO, GET_TEXT_F(MSG_REHEATING)));
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(GET_TEXT_F(MSG_REHEATING)));
@ -554,7 +554,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE)));
TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATDONE));
@ -664,14 +664,14 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
ui.pause_show_message(PAUSE_MESSAGE_STATUS);
#ifdef ACTION_ON_RESUMED
host_action_resumed();
hostui.resumed();
#elif defined(ACTION_ON_RESUME)
host_action_resume();
hostui.resume();
#endif
--did_pause_print;
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, F("Resuming"), FPSTR(DISMISS_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Resuming"), FPSTR(DISMISS_STR)));
// Resume the print job timer if it was running
if (print_job_timer.isPaused()) print_job_timer.start();

9
Marlin/src/feature/runout.cpp

@ -96,8 +96,7 @@ void event_filament_runout(const uint8_t extruder) {
//action:out_of_filament
#if ENABLED(HOST_PROMPT_SUPPORT)
host_action_prompt_begin(PROMPT_FILAMENT_RUNOUT, F("FilamentRunout T"), tool);
host_action_prompt_show();
hostui.prompt_do(PROMPT_FILAMENT_RUNOUT, F("FilamentRunout T"), tool); //action:out_of_filament
#endif
const bool run_runout_script = !runout.host_handling;
@ -109,18 +108,18 @@ void event_filament_runout(const uint8_t extruder) {
|| TERN0(ADVANCED_PAUSE_FEATURE, strstr(FILAMENT_RUNOUT_SCRIPT, "M25"))
)
) {
host_action_paused(false);
hostui.paused(false);
}
else {
// Legacy Repetier command for use until newer version supports standard dialog
// To be removed later when pause command also triggers dialog
#ifdef ACTION_ON_FILAMENT_RUNOUT
host_action(F(ACTION_ON_FILAMENT_RUNOUT " T"), false);
hostui.action(F(ACTION_ON_FILAMENT_RUNOUT " T"), false);
SERIAL_CHAR(tool);
SERIAL_EOL();
#endif
host_action_pause(false);
hostui.pause(false);
}
SERIAL_ECHOPGM(" " ACTION_REASON_ON_FILAMENT_RUNOUT " ");
SERIAL_CHAR(tool);

2
Marlin/src/gcode/config/M43.cpp

@ -344,7 +344,7 @@ void GcodeSuite::M43() {
#if HAS_RESUME_CONTINUE
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true;
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("M43 Wait Called"), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("M43 Wait Called"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("M43 Wait Called")));
#endif

2
Marlin/src/gcode/control/M111.cpp

@ -26,7 +26,7 @@
* M111: Set the debug level
*/
void GcodeSuite::M111() {
if (parser.seen('S')) marlin_debug_flags = parser.byteval('S');
if (parser.seenval('S')) marlin_debug_flags = parser.value_byte();
static PGMSTR(str_debug_1, STR_DEBUG_ECHO);
static PGMSTR(str_debug_2, STR_DEBUG_INFO);

10
Marlin/src/gcode/gcode.cpp

@ -238,9 +238,9 @@ void GcodeSuite::dwell(millis_t time) {
#if ENABLED(G29_RETRY_AND_RECOVER)
void GcodeSuite::event_probe_recover() {
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, F("G29 Retrying"), FPSTR(DISMISS_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_INFO, F("G29 Retrying"), FPSTR(DISMISS_STR)));
#ifdef ACTION_ON_G29_RECOVER
host_action(F(ACTION_ON_G29_RECOVER));
hostui.g29_recover();
#endif
#ifdef G29_RECOVER_COMMANDS
process_subcommands_now(F(G29_RECOVER_COMMANDS));
@ -253,14 +253,14 @@ void GcodeSuite::dwell(millis_t time) {
void GcodeSuite::event_probe_failure() {
#ifdef ACTION_ON_G29_FAILURE
host_action(F(ACTION_ON_G29_FAILURE));
hostui.g29_failure();
#endif
#ifdef G29_FAILURE_COMMANDS
process_subcommands_now(F(G29_FAILURE_COMMANDS));
#endif
#if ENABLED(G29_HALT_ON_FAILURE)
#ifdef ACTION_ON_CANCEL
host_action_cancel();
hostui.cancel();
#endif
kill(GET_TEXT_F(MSG_LCD_PROBING_FAILED));
#endif
@ -283,7 +283,7 @@ void GcodeSuite::dwell(millis_t time) {
}
}
TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_end());
#ifdef G29_SUCCESS_COMMANDS
process_subcommands_now(F(G29_SUCCESS_COMMANDS));

2
Marlin/src/gcode/host/M876.cpp

@ -33,7 +33,7 @@
*/
void GcodeSuite::M876() {
if (parser.seenval('S')) host_response_handler((uint8_t)parser.value_int());
if (parser.seenval('S')) hostui.handle_response((uint8_t)parser.value_int());
}

2
Marlin/src/gcode/lcd/M0_M1.cpp

@ -84,7 +84,7 @@ void GcodeSuite::M0_M1() {
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? F("M1 Stop") : F("M0 Stop"), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? F("M1 Stop") : F("M0 Stop"), FPSTR(CONTINUE_STR)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(ms));

2
Marlin/src/gcode/sd/M1001.cpp

@ -97,7 +97,7 @@ void GcodeSuite::M1001() {
if (long_print) {
printerEventLEDs.onPrintCompleted();
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PRINT_DONE)));
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_PRINT_DONE), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_PRINT_DONE), FPSTR(CONTINUE_STR)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(SEC_TO_MS(TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30))));
printerEventLEDs.onResumeAfterWait();
}

8
Marlin/src/gcode/sd/M24_M25.cpp

@ -77,9 +77,9 @@ void GcodeSuite::M24() {
#if ENABLED(HOST_ACTION_COMMANDS)
#ifdef ACTION_ON_RESUME
host_action_resume();
hostui.resume();
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, F("Resuming SD"), FPSTR(DISMISS_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Resuming SD"), FPSTR(DISMISS_STR)));
#endif
ui.reset_status();
@ -116,9 +116,9 @@ void GcodeSuite::M25() {
IF_DISABLED(DWIN_CREALITY_LCD, ui.reset_status());
#if ENABLED(HOST_ACTION_COMMANDS)
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, F("Pause SD"), F("Resume")));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_PAUSE_RESUME, F("Pause SD"), F("Resume")));
#ifdef ACTION_ON_PAUSE
host_action_pause();
hostui.pause();
#endif
#endif

2
Marlin/src/gcode/stats/M75-M78.cpp

@ -49,7 +49,7 @@ void GcodeSuite::M75() {
*/
void GcodeSuite::M76() {
print_job_timer.pause();
TERN_(HOST_PAUSE_M76, host_action_pause());
TERN_(HOST_PAUSE_M76, hostui.pause());
}
/**

2
Marlin/src/lcd/e3v2/creality/dwin.cpp

@ -2363,7 +2363,7 @@ void HMI_PauseOrStop() {
card.abortFilePrintSoon(); // Let the main loop handle SD abort
dwin_abort_flag = true; // Reset feedrate, return to Home
#ifdef ACTION_ON_CANCEL
host_action_cancel();
hostui.cancel();
#endif
Popup_Window_Home(true);
if (HMI_flag.home_flag) planner.synchronize(); // Wait for planner moves to finish!

2
Marlin/src/lcd/e3v2/enhanced/dwin.cpp

@ -1391,7 +1391,7 @@ void HMI_PauseOrStop() {
card.abortFilePrintSoon(); // Let the main loop handle SD abort
dwin_abort_flag = true; // Reset feedrate, return to Home
#ifdef ACTION_ON_CANCEL
host_action_cancel();
hostui.cancel();
#endif
DWIN_Draw_Popup(ICON_BLTouch, F("Stopping...") , F("Please wait until done."));
}

6
Marlin/src/lcd/e3v2/jyersui/dwin.cpp

@ -4503,7 +4503,7 @@ void CrealityDWINClass::Print_Screen_Control() {
#endif
}
else {
TERN_(HOST_ACTION_COMMANDS, host_action_resume());
TERN_(HOST_ACTION_COMMANDS, hostui.resume());
}
Draw_Print_Screen();
}
@ -4553,7 +4553,7 @@ void CrealityDWINClass::Popup_Control() {
#endif
}
else {
TERN_(HOST_ACTION_COMMANDS, host_action_pause());
TERN_(HOST_ACTION_COMMANDS, hostui.pause());
}
}
Draw_Print_Screen();
@ -4566,7 +4566,7 @@ void CrealityDWINClass::Popup_Control() {
thermalManager.disable_all_heaters();
}
else {
TERN_(HOST_ACTION_COMMANDS, host_action_cancel());
TERN_(HOST_ACTION_COMMANDS, hostui.cancel());
}
}
else

4
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp

@ -242,7 +242,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
if (ExtUI::isPrintingFromMedia())
ExtUI::pausePrint();
#ifdef ACTION_ON_PAUSE
else host_action_pause();
else hostui.pause();
#endif
GOTO_SCREEN(StatusScreen);
break;
@ -251,7 +251,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
if (ExtUI::isPrintingFromMedia())
ExtUI::resumePrint();
#ifdef ACTION_ON_RESUME
else host_action_resume();
else hostui.resume();
#endif
GOTO_SCREEN(StatusScreen);
break;

2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/confirm_abort_print_dialog_box.cpp

@ -41,7 +41,7 @@ bool ConfirmAbortPrintDialogBox::onTouchEnd(uint8_t tag) {
if (ExtUI::isPrintingFromMedia())
ExtUI::stopPrint();
#ifdef ACTION_ON_CANCEL
else host_action_cancel();
else hostui.cancel();
#endif
return true;
default:

4
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp

@ -138,7 +138,7 @@ void TuneMenu::pausePrint() {
if (ExtUI::isPrintingFromMedia())
ExtUI::pausePrint();
#ifdef ACTION_ON_PAUSE
else host_action_pause();
else hostui.pause();
#endif
GOTO_SCREEN(StatusScreen);
}
@ -150,7 +150,7 @@ void TuneMenu::resumePrint() {
else if (ExtUI::isPrintingFromMedia())
ExtUI::resumePrint();
#ifdef ACTION_ON_RESUME
else host_action_resume();
else hostui.resume();
#endif
GOTO_SCREEN(StatusScreen);
}

2
Marlin/src/lcd/extui/ui_api.cpp

@ -918,7 +918,7 @@ namespace ExtUI {
#endif // HAS_LEVELING
#if ENABLED(HOST_PROMPT_SUPPORT)
void setHostResponse(const uint8_t response) { host_response_handler(response); }
void setHostResponse(const uint8_t response) { hostui.handle_response(response); }
#endif
#if ENABLED(PRINTCOUNTER)

20
Marlin/src/lcd/marlinui.cpp

@ -1355,7 +1355,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
void MarlinUI::set_status(const char * const cstr, const bool persist) {
if (alert_level) return;
TERN_(HOST_PROMPT_SUPPORT, host_action_notify(cstr));
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(cstr));
// Here we have a problem. The message is encoded in UTF8, so
// arbitrarily cutting it will be a problem. We MUST be sure
@ -1427,7 +1427,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
if (level < alert_level) return;
alert_level = level;
TERN_(HOST_PROMPT_SUPPORT, host_action_notify(fstr));
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(fstr));
// Since the message is encoded in UTF8 it must
// only be cut on a character boundary.
@ -1533,10 +1533,10 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
card.abortFilePrintSoon();
#endif
#ifdef ACTION_ON_CANCEL
host_action_cancel();
hostui.cancel();
#endif
IF_DISABLED(SDSUPPORT, print_job_timer.stop());
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, F("UI Aborted"), FPSTR(DISMISS_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("UI Aborted"), FPSTR(DISMISS_STR)));
LCD_MESSAGE(MSG_PRINT_ABORTED);
TERN_(HAS_LCD_MENU, return_to_status());
}
@ -1565,7 +1565,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#endif
TERN_(HAS_TOUCH_SLEEP, wakeup_screen());
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, F("UI Pause"), F("Resume")));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_PAUSE_RESUME, F("UI Pause"), F("Resume")));
LCD_MESSAGE(MSG_PRINT_PAUSED);
@ -1575,7 +1575,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#elif ENABLED(SDSUPPORT)
queue.inject(F("M25"));
#elif defined(ACTION_ON_PAUSE)
host_action_pause();
hostui.pause();
#endif
}
@ -1584,7 +1584,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
TERN_(PARK_HEAD_ON_PAUSE, wait_for_heatup = wait_for_user = false);
TERN_(SDSUPPORT, if (IS_SD_PAUSED()) queue.inject_P(M24_STR));
#ifdef ACTION_ON_RESUME
host_action_resume();
hostui.resume();
#endif
print_job_timer.start(); // Also called by M24
}
@ -1639,13 +1639,13 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
// Send the status line as a host notification
//
void MarlinUI::set_status(const char * const cstr, const bool) {
TERN(HOST_PROMPT_SUPPORT, host_action_notify(cstr), UNUSED(cstr));
TERN(HOST_PROMPT_SUPPORT, hostui.notify(cstr), UNUSED(cstr));
}
void MarlinUI::set_status(FSTR_P const fstr, const int8_t) {
TERN(HOST_PROMPT_SUPPORT, host_action_notify(fstr), UNUSED(fstr));
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
}
void MarlinUI::status_printf(const uint8_t, FSTR_P const fstr, ...) {
TERN(HOST_PROMPT_SUPPORT, host_action_notify(fstr), UNUSED(fstr));
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
}
#endif // !HAS_DISPLAY && !HAS_STATUS_MESSAGE

4
Marlin/src/lcd/menu/menu_delta_calibrate.cpp

@ -58,13 +58,13 @@ void _man_probe_pt(const xy_pos_t &xy) {
#include "../../MarlinCore.h" // for wait_for_user_response()
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
#include "../../feature/host_actions.h" // for host_prompt_do
#include "../../feature/host_actions.h" // for hostui.prompt_do
#endif
float lcd_probe_pt(const xy_pos_t &xy) {
_man_probe_pt(xy);
ui.defer_status_screen();
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Delta Calibration in progress"), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("Delta Calibration in progress"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Delta Calibration in progress")));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
ui.goto_previous_screen_no_defer();

2
Marlin/src/lcd/menu/menu_main.cpp

@ -301,7 +301,7 @@ void menu_main() {
ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print);
#if ENABLED(HOST_START_MENU_ITEM) && defined(ACTION_ON_START)
ACTION_ITEM(MSG_HOST_START_PRINT, host_action_start);
ACTION_ITEM(MSG_HOST_START_PRINT, hostui.start);
#endif
#if ENABLED(PREHEAT_SHORTCUT_MENU_ITEM)

4
Marlin/src/module/probe.cpp

@ -140,7 +140,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
LCD_MESSAGE(MSG_MANUAL_DEPLOY_TOUCHMI);
ui.return_to_status();
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Deploy TouchMI"), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("Deploy TouchMI"), FPSTR(CONTINUE_STR)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
ui.reset_status();
ui.goto_screen(prev_screen);
@ -295,7 +295,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
ui.set_status(ds_str, 99);
SERIAL_ECHOLNF(ds_str);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Stow Probe"), FPSTR(CONTINUE_STR)));
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("Stow Probe"), FPSTR(CONTINUE_STR)));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Stow Probe")));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, F("Stow Probe"), FPSTR(CONTINUE_STR)));
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());

Loading…
Cancel
Save