Add HOST_PROMPT_SUPPORT (#13039)

This commit is contained in:
InsanityAutomation
2019-02-12 16:55:47 -05:00
committed by Scott Lahteine
parent 0feeef2604
commit 7f1b69b0c8
189 changed files with 2076 additions and 3479 deletions

View File

@@ -45,6 +45,10 @@
#include "runout.h"
#endif
#if ENABLED(HOST_ACTION_COMMANDS)
#include "host_actions.h"
#endif
#include "../lcd/ultralcd.h"
#include "../libs/buzzer.h"
#include "../libs/nozzle.h"
@@ -154,6 +158,20 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true; // LCD click or M108 will clear this
#if ENABLED(HOST_PROMPT_SUPPORT)
const char tool = '0'
#if NUM_RUNOUT_SENSORS > 1
+ 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_button(PSTR("Continue"));
host_action_prompt_show();
#endif
while (wait_for_user) {
#if HAS_BUZZER
filament_change_beep(max_beep_count);
@@ -206,6 +224,9 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
#endif
wait_for_user = true;
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Continuous Purge Running..."), PSTR("Continue"));
#endif
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
wait_for_user = false;
@@ -224,6 +245,24 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
}
// 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 ENABLED(FILAMENT_RUNOUT_SENSOR)
|| runout.filament_ran_out
#endif
)
host_action_prompt_button(PSTR("DisableRunout"));
else {
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
host_action_prompt_button(PSTR("Continue"));
}
host_action_prompt_show();
#endif
#if HAS_LCD_MENU
if (show_lcd) {
KEEPALIVE_STATE(PAUSED_FOR_USER);
@@ -324,10 +363,15 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
if (did_pause_print) return false; // already paused
#ifdef ACTION_ON_PAUSED
host_action_paused();
#elif defined(ACTION_ON_PAUSE)
host_action_pause();
#if ENABLED(HOST_ACTION_COMMANDS)
#ifdef ACTION_ON_PAUSED
host_action_paused();
#elif defined(ACTION_ON_PAUSE)
host_action_pause();
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_INFO, PSTR("Pause"));
#endif
#endif
if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) {
@@ -445,7 +489,9 @@ 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);
wait_for_user = true; // LCD click or M108 will clear this
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Nozzle Parked"), PSTR("Continue"));
#endif
while (wait_for_user) {
#if HAS_BUZZER
filament_change_beep(max_beep_count);
@@ -463,9 +509,17 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
#endif
SERIAL_ECHO_MSG(_PMSG(MSG_FILAMENT_CHANGE_HEAT));
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("HeaterTimeout"), PSTR("Reheat"));
#endif
// Wait for LCD click or M108
while (wait_for_user) idle(true);
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheating"));
#endif
// Re-enable the heaters if they timed out
HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e);
@@ -480,7 +534,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
HOTEND_LOOP()
thermalManager.start_heater_idle_timer(e, nozzle_timeout);
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), PSTR("Continue"));
#endif
wait_for_user = true;
nozzle_timed_out = false;
@@ -578,6 +634,10 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
--did_pause_print;
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_open(PROMPT_INFO, PSTR("Resume"));
#endif
#if ENABLED(SDSUPPORT)
if (did_pause_print) {
card.startFileprint();