M600 R<resume temperature> (#17919)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
chestwood96 2020-05-11 09:06:31 +02:00 committed by GitHub
parent 4680aa659c
commit 1475fd312a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 13 deletions

View File

@ -84,26 +84,30 @@ fil_change_settings_t fc_settings[EXTRUDERS];
#endif #endif
#if HAS_BUZZER #if HAS_BUZZER
static void filament_change_beep(const int8_t max_beep_count, const bool init=false) { static void impatient_beep(const int8_t max_beep_count, const bool restart=false) {
if (TERN0(HAS_LCD_MENU, pause_mode == PAUSE_MODE_PAUSE_PRINT)) return; if (TERN0(HAS_LCD_MENU, pause_mode == PAUSE_MODE_PAUSE_PRINT)) return;
static millis_t next_buzz = 0; static millis_t next_buzz = 0;
static int8_t runout_beep = 0; static int8_t runout_beep = 0;
if (init) next_buzz = runout_beep = 0; if (restart) next_buzz = runout_beep = 0;
const bool always = max_beep_count < 0;
const millis_t ms = millis(); const millis_t ms = millis();
if (ELAPSED(ms, next_buzz)) { if (ELAPSED(ms, next_buzz)) {
if (max_beep_count < 0 || runout_beep < max_beep_count + 5) { // Only beep as long as we're supposed to if (always || runout_beep < max_beep_count + 5) { // Only beep as long as we're supposed to
next_buzz = ms + ((max_beep_count < 0 || runout_beep < max_beep_count) ? 1000 : 500); next_buzz = ms + ((always || runout_beep < max_beep_count) ? 1000 : 500);
BUZZ(50, 880 - (runout_beep & 1) * 220); BUZZ(50, 880 - (runout_beep & 1) * 220);
runout_beep++; runout_beep++;
} }
} }
} }
inline void first_impatient_beep(const int8_t max_beep_count) { impatient_beep(max_beep_count, true); }
#else #else
inline void filament_change_beep(const int8_t, const bool=false) {} inline void impatient_beep(const int8_t, const bool=false) {}
inline void first_impatient_beep(const int8_t) {}
#endif #endif
/** /**
@ -165,7 +169,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
#endif #endif
SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT)); SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT));
filament_change_beep(max_beep_count, true); first_impatient_beep(max_beep_count);
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
#if ENABLED(HOST_PROMPT_SUPPORT) #if ENABLED(HOST_PROMPT_SUPPORT)
@ -180,7 +184,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
#endif #endif
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament"))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
while (wait_for_user) { while (wait_for_user) {
filament_change_beep(max_beep_count); impatient_beep(max_beep_count);
idle_no_sleep(); idle_no_sleep();
} }
} }
@ -448,7 +452,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
show_continue_prompt(is_reload); show_continue_prompt(is_reload);
filament_change_beep(max_beep_count, true); first_impatient_beep(max_beep_count);
// Start the heater idle timers // Start the heater idle timers
const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT); const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT);
@ -468,7 +472,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_NOZZLE_PARKED)));
wait_for_user = true; // LCD click or M108 will clear this wait_for_user = true; // LCD click or M108 will clear this
while (wait_for_user) { while (wait_for_user) {
filament_change_beep(max_beep_count); impatient_beep(max_beep_count);
// If the nozzle has timed out... // If the nozzle has timed out...
if (!nozzle_timed_out) if (!nozzle_timed_out)
@ -508,7 +512,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
wait_for_user = true; wait_for_user = true;
nozzle_timed_out = false; nozzle_timed_out = false;
filament_change_beep(max_beep_count, true); first_impatient_beep(max_beep_count);
} }
idle_no_sleep(); idle_no_sleep();
} }
@ -539,7 +543,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
* - Send host action for resume, if configured * - Send host action for resume, if configured
* - Resume the current SD print job, if any * - Resume the current SD print job, if any
*/ */
void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) { void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/, int16_t targetTemp/*=0*/ DXC_ARGS) {
/* /*
SERIAL_ECHOLNPAIR( SERIAL_ECHOLNPAIR(
"start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode, "start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode,
@ -558,9 +562,17 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
thermalManager.reset_hotend_idle_timer(e); thermalManager.reset_hotend_idle_timer(e);
} }
if (targetTemp > thermalManager.degTargetHotend(active_extruder))
thermalManager.setTargetHotend(targetTemp, active_extruder);
if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament 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, PAUSE_MODE_SAME DXC_PASS); load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, PAUSE_MODE_SAME DXC_PASS);
if (targetTemp > 0) {
thermalManager.setTargetHotend(targetTemp, active_extruder);
thermalManager.wait_for_hotend(active_extruder, false);
}
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_RESUME)); TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_RESUME));
// Retract to prevent oozing // Retract to prevent oozing

View File

@ -87,7 +87,7 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_count=0 DXC_PARAMS); void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_count=0 DXC_PARAMS);
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); 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, int16_t targetTemp=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, 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 PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS); const bool pause_for_user=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS);

View File

@ -56,6 +56,7 @@
* L[distance] - Extrude distance for insertion (manual reload) * L[distance] - Extrude distance for insertion (manual reload)
* B[count] - Number of times to beep, -1 for indefinite (if equipped with a buzzer) * B[count] - Number of times to beep, -1 for indefinite (if equipped with a buzzer)
* T[toolhead] - Select extruder for filament change * T[toolhead] - Select extruder for filament change
* R[temp] - Resume temperature (in current units)
* *
* Default values are used for omitted arguments. * Default values are used for omitted arguments.
*/ */
@ -153,7 +154,8 @@ void GcodeSuite::M600() {
resume_print(slow_load_length, fast_load_length, 0, beep_count DXC_PASS); resume_print(slow_load_length, fast_load_length, 0, beep_count DXC_PASS);
#else #else
wait_for_confirmation(true, beep_count DXC_PASS); wait_for_confirmation(true, beep_count DXC_PASS);
resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, beep_count DXC_PASS); resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH,
beep_count, (parser.seenval('R') ? parser.value_celsius() : 0) DXC_PASS);
#endif #endif
} }