Fix Pause Print message and behavior (#13394)

This commit is contained in:
Scott Lahteine
2019-03-14 02:26:07 -05:00
committed by GitHub
parent f5bcc00570
commit 9a515cbd32
18 changed files with 174 additions and 154 deletions

View File

@ -66,10 +66,10 @@ void FWRetract::reset() {
settings.retract_length = RETRACT_LENGTH;
settings.retract_feedrate_mm_s = RETRACT_FEEDRATE;
settings.retract_zraise = RETRACT_ZRAISE;
settings.retract_recover_length = RETRACT_RECOVER_LENGTH;
settings.retract_recover_extra = RETRACT_RECOVER_LENGTH;
settings.retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE;
settings.swap_retract_length = RETRACT_LENGTH_SWAP;
settings.swap_retract_recover_length = RETRACT_RECOVER_LENGTH_SWAP;
settings.swap_retract_recover_extra = RETRACT_RECOVER_LENGTH_SWAP;
settings.swap_retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE_SWAP;
current_hop = 0.0;
@ -175,7 +175,7 @@ void FWRetract::retract(const bool retracting
planner.synchronize(); // Wait for move to complete
}
const float extra_recover = swapping ? settings.swap_retract_recover_length : settings.retract_recover_length;
const float extra_recover = swapping ? settings.swap_retract_recover_extra : settings.retract_recover_extra;
if (extra_recover != 0.0) {
current_position[E_AXIS] -= extra_recover; // Adjust the current E position by the extra amount to recover
sync_plan_position_e(); // Sync the planner position so the extra amount is recovered

View File

@ -32,11 +32,11 @@
typedef struct {
float retract_length, // M207 S - G10 Retract length
retract_feedrate_mm_s, // M207 F - G10 Retract feedrate
retract_zraise, // M207 Z - G10 Retract hop size
retract_recover_length, // M208 S - G11 Recover length
retract_zraise, // M207 Z - G10 Retract hop size
retract_recover_extra, // M208 S - G11 Recover length
retract_recover_feedrate_mm_s, // M208 F - G11 Recover feedrate
swap_retract_length, // M207 W - G10 Swap Retract length
swap_retract_recover_length, // M208 W - G11 Swap Recover length
swap_retract_recover_extra, // M208 W - G11 Swap Recover length
swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate
} fwretract_settings_t;

View File

@ -110,7 +110,7 @@ void host_action(const char * const pstr, const bool eol) {
case PROMPT_FILAMENT_RUNOUT:
msg = PSTR("FILAMENT_RUNOUT");
if (response == 0) {
advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE;
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE;
host_action_prompt_end(); // Close current prompt
host_action_prompt_begin(PSTR("Paused"));
host_action_prompt_button(PSTR("Purge More"));
@ -133,7 +133,7 @@ void host_action(const char * const pstr, const bool eol) {
runout.reset();
}
#endif
advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_RESUME_PRINT;
pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT;
}
break;
case PROMPT_USER_CONTINUE:

View File

@ -58,7 +58,9 @@
static float resume_position[XYZE];
AdvancedPauseMenuResponse advanced_pause_menu_response;
PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT;
PauseMenuResponse pause_menu_response;
fil_change_settings_t fc_settings[EXTRUDERS];
@ -68,6 +70,7 @@ 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;
static millis_t next_buzz = 0;
static int8_t runout_beep = 0;
@ -93,7 +96,7 @@ fil_change_settings_t fc_settings[EXTRUDERS];
*
* Returns 'true' if heating was completed, 'false' for abort
*/
static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_SAME) {
static bool ensure_safe_temperature(const PauseMode mode=PAUSE_MODE_SAME) {
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) {
@ -103,7 +106,7 @@ static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_
#endif
#if HAS_LCD_MENU
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_HEATING, mode);
lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode);
#else
UNUSED(mode);
#endif
@ -134,7 +137,7 @@ void do_pause_e_move(const float &length, const float &fr_mm_s) {
*/
bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=0*/, const int8_t max_beep_count/*=0*/,
const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/,
const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
DXC_ARGS
) {
#if !HAS_LCD_MENU
@ -143,14 +146,14 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
if (!ensure_safe_temperature(mode)) {
#if HAS_LCD_MENU
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS, mode);
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS, mode);
#endif
return false;
}
if (pause_for_user) {
#if HAS_LCD_MENU
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode);
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_INSERT, mode);
#endif
SERIAL_ECHO_MSG(MSG_FILAMENT_CHANGE_INSERT);
@ -186,7 +189,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
}
#if HAS_LCD_MENU
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode);
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_LOAD, mode);
#endif
#if ENABLED(DUAL_X_CARRIAGE)
@ -222,7 +225,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
#if HAS_LCD_MENU
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE);
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE);
#endif
wait_for_user = true;
@ -239,7 +242,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
if (purge_length > 0) {
// "Wait for filament purge"
#if HAS_LCD_MENU
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE);
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE);
#endif
// Extrude filament to get into hotend
@ -269,8 +272,8 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
if (show_lcd) {
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = false;
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_OPTION);
while (advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_WAIT_FOR) idle(true);
lcd_pause_show_message(PAUSE_MESSAGE_OPTION);
while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle(true);
KEEPALIVE_STATE(IN_HANDLER);
}
#endif
@ -278,7 +281,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
// Keep looping if "Purge More" was selected
} while (false
#if HAS_LCD_MENU
|| (show_lcd && advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE)
|| (show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE)
#endif
);
@ -298,7 +301,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
* Returns 'true' if unload was completed, 'false' for abort
*/
bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/
const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/
) {
#if !HAS_LCD_MENU
UNUSED(show_lcd);
@ -306,14 +309,14 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
if (!ensure_safe_temperature(mode)) {
#if HAS_LCD_MENU
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
#endif
return false;
}
#if HAS_LCD_MENU
if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, mode);
if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, mode);
#endif
// Retract filament
@ -387,7 +390,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
#if HAS_LCD_MENU
if (show_lcd) { // Show status screen
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
LCD_MESSAGEPGM(MSG_M600_TOO_COLD);
}
#endif
@ -464,7 +467,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
void show_continue_prompt(const bool is_reload) {
#if HAS_LCD_MENU
lcd_advanced_pause_show_message(is_reload ? ADVANCED_PAUSE_MESSAGE_INSERT : ADVANCED_PAUSE_MESSAGE_WAITING);
lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
#endif
SERIAL_ECHO_START();
serialprintPGM(is_reload ? PSTR(_PMSG(MSG_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(MSG_FILAMENT_CHANGE_WAIT) "\n"));
@ -510,7 +513,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
// re-heat the nozzle, re-show the continue prompt, restart idle timers, start over
if (nozzle_timed_out) {
#if HAS_LCD_MENU
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_HEAT);
lcd_pause_show_message(PAUSE_MESSAGE_HEAT);
#endif
SERIAL_ECHO_MSG(_PMSG(MSG_FILAMENT_CHANGE_HEAT));
@ -597,10 +600,10 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
}
if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament
load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PASS);
load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, PAUSE_MODE_PAUSE_PRINT DXC_PASS);
#if HAS_LCD_MENU
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME);
lcd_pause_show_message(PAUSE_MESSAGE_RESUME);
#endif
// Intelligent resuming
@ -628,7 +631,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = resume_position[E_AXIS]));
#if HAS_LCD_MENU
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
#endif
#ifdef ACTION_ON_RESUMED

View File

@ -36,34 +36,36 @@ typedef struct {
#include "../libs/nozzle.h"
enum AdvancedPauseMode : char {
ADVANCED_PAUSE_MODE_SAME,
ADVANCED_PAUSE_MODE_PAUSE_PRINT,
ADVANCED_PAUSE_MODE_LOAD_FILAMENT,
ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT
enum PauseMode : char {
PAUSE_MODE_SAME,
PAUSE_MODE_PAUSE_PRINT,
PAUSE_MODE_LOAD_FILAMENT,
PAUSE_MODE_UNLOAD_FILAMENT
};
enum AdvancedPauseMessage : char {
ADVANCED_PAUSE_MESSAGE_INIT,
ADVANCED_PAUSE_MESSAGE_WAITING,
ADVANCED_PAUSE_MESSAGE_UNLOAD,
ADVANCED_PAUSE_MESSAGE_INSERT,
ADVANCED_PAUSE_MESSAGE_LOAD,
ADVANCED_PAUSE_MESSAGE_PURGE,
ADVANCED_PAUSE_MESSAGE_OPTION,
ADVANCED_PAUSE_MESSAGE_RESUME,
ADVANCED_PAUSE_MESSAGE_STATUS,
ADVANCED_PAUSE_MESSAGE_HEAT,
ADVANCED_PAUSE_MESSAGE_HEATING
enum PauseMessage : char {
PAUSE_MESSAGE_PAUSING,
PAUSE_MESSAGE_CHANGING,
PAUSE_MESSAGE_WAITING,
PAUSE_MESSAGE_UNLOAD,
PAUSE_MESSAGE_INSERT,
PAUSE_MESSAGE_LOAD,
PAUSE_MESSAGE_PURGE,
PAUSE_MESSAGE_OPTION,
PAUSE_MESSAGE_RESUME,
PAUSE_MESSAGE_STATUS,
PAUSE_MESSAGE_HEAT,
PAUSE_MESSAGE_HEATING
};
enum AdvancedPauseMenuResponse : char {
ADVANCED_PAUSE_RESPONSE_WAIT_FOR,
ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE,
ADVANCED_PAUSE_RESPONSE_RESUME_PRINT
enum PauseMenuResponse : char {
PAUSE_RESPONSE_WAIT_FOR,
PAUSE_RESPONSE_EXTRUDE_MORE,
PAUSE_RESPONSE_RESUME_PRINT
};
extern AdvancedPauseMenuResponse advanced_pause_menu_response;
extern PauseMode pause_mode;
extern PauseMenuResponse pause_menu_response;
extern fil_change_settings_t fc_settings[EXTRUDERS];
@ -88,8 +90,8 @@ void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_cou
void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, const int8_t max_beep_count=0 DXC_PARAMS);
bool load_filament(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=0, const int8_t max_beep_count=0, const bool show_lcd=false,
const bool pause_for_user=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);
const bool pause_for_user=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);
bool unload_filament(const float &unload_length, const bool show_lcd=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT);
bool unload_filament(const float &unload_length, const bool show_lcd=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT);
#endif // ADVANCED_PAUSE_FEATURE