Clean up host actions code (#16856)

This commit is contained in:
Scott Lahteine
2020-02-13 23:39:27 -06:00
committed by GitHub
parent ff0c931e47
commit 00ba053c90
6 changed files with 86 additions and 88 deletions

View File

@@ -67,9 +67,10 @@
static xyze_pos_t resume_position;
PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;
PauseMenuResponse pause_menu_response;
#if HAS_LCD_MENU
PauseMenuResponse pause_menu_response;
PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;
#endif
fil_change_settings_t fc_settings[EXTRUDERS];
@@ -85,7 +86,11 @@ fil_change_settings_t fc_settings[EXTRUDERS];
#if HAS_BUZZER
static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
if (pause_mode == PAUSE_MODE_PAUSE_PRINT) return;
#if HAS_LCD_MENU
if (pause_mode == PAUSE_MODE_PAUSE_PRINT) return;
#endif
static millis_t next_buzz = 0;
static int8_t runout_beep = 0;
@@ -186,11 +191,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
+ active_extruder
#endif
;
host_prompt_reason = PROMPT_USER_CONTINUE;
host_action_prompt_end();
host_action_prompt_begin(PSTR("Load Filament T"), false);
SERIAL_CHAR(tool);
SERIAL_EOL();
host_action_prompt_begin(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool);
host_action_prompt_button(CONTINUE_STR);
host_action_prompt_show();
#endif
@@ -247,10 +248,10 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
wait_for_user = true;
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purge Running..."), CONTINUE_STR);
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR);
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired_P(PSTR("Filament Purge Running..."));
ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging..."));
#endif
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
@@ -269,27 +270,13 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
do_pause_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
}
// Show "Purge More" / "Resume" menu and wait for reply
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
host_action_prompt_end(); // Close current prompt
host_action_prompt_begin(PSTR("Paused"));
host_action_prompt_button(PSTR("PurgeMore"));
if (false
#if HAS_FILAMENT_SENSOR
|| runout.filament_ran_out
#endif
)
host_action_prompt_button(PSTR("DisableRunout"));
else {
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
host_action_prompt_button(CONTINUE_STR);
}
host_action_prompt_show();
filament_load_host_prompt(); // Initiate another host prompt. (NOTE: host_response_handler may also do this!)
#endif
#if HAS_LCD_MENU
if (show_lcd) {
// Show "Purge More" / "Resume" menu and wait for reply
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = false;
lcd_pause_show_message(PAUSE_MESSAGE_OPTION);