Add idle_no_sleep

This commit is contained in:
Scott Lahteine 2020-02-27 06:34:48 -06:00
parent e5d39063a2
commit 77b82d300a
3 changed files with 18 additions and 31 deletions

View File

@ -40,10 +40,18 @@ void stop();
void idle( void idle(
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
bool no_stepper_sleep = false // pass true to keep steppers from disabling on timeout bool no_stepper_sleep=false // Pass true to keep steppers from timing out
#endif #endif
); );
inline void idle_no_sleep() {
idle(
#if ENABLED(ADVANCED_PAUSE_FEATURE)
true
#endif
);
}
#if ENABLED(EXPERIMENTAL_I2CBUS) #if ENABLED(EXPERIMENTAL_I2CBUS)
#include "feature/twibus.h" #include "feature/twibus.h"
extern TWIBus i2c; extern TWIBus i2c;

View File

@ -202,7 +202,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
#if HAS_BUZZER #if HAS_BUZZER
filament_change_beep(max_beep_count); filament_change_beep(max_beep_count);
#endif #endif
idle(true); idle_no_sleep();
} }
} }
@ -280,7 +280,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = false; wait_for_user = false;
lcd_pause_show_message(PAUSE_MESSAGE_OPTION); lcd_pause_show_message(PAUSE_MESSAGE_OPTION);
while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle(true); while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle_no_sleep();
} }
#endif #endif
@ -541,7 +541,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
#endif #endif
// Wait for LCD click or M108 // Wait for LCD click or M108
while (wait_for_user) idle(true); while (wait_for_user) idle_no_sleep();
#if ENABLED(HOST_PROMPT_SUPPORT) #if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_INFO, PSTR("Reheating")); host_prompt_do(PROMPT_INFO, PSTR("Reheating"));
@ -576,8 +576,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
filament_change_beep(max_beep_count, true); filament_change_beep(max_beep_count, true);
#endif #endif
} }
idle_no_sleep();
idle(true);
} }
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
active_extruder = saved_ext; active_extruder = saved_ext;

View File

@ -137,11 +137,7 @@ void GcodeSuite::G76() {
while (thermalManager.degBed() > target_bed while (thermalManager.degBed() > target_bed
|| thermalManager.degProbe() > target_probe || thermalManager.degProbe() > target_probe
) { ) {
idle( idle_no_sleep();
#if ENABLED(ADVANCED_PAUSE_FEATURE)
true
#endif
);
const millis_t ms = millis(); const millis_t ms = millis();
if (ELAPSED(ms, next_temp_report)) { if (ELAPSED(ms, next_temp_report)) {
thermalManager.print_heater_states(active_extruder); thermalManager.print_heater_states(active_extruder);
@ -167,11 +163,7 @@ void GcodeSuite::G76() {
SERIAL_ECHOLNPGM("Waiting for bed and probe to reach target temp."); SERIAL_ECHOLNPGM("Waiting for bed and probe to reach target temp.");
const millis_t probe_timeout_ms = millis() + 900UL * 1000UL; const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1 || thermalManager.degProbe() > target_probe) { while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1 || thermalManager.degProbe() > target_probe) {
idle( idle_no_sleep();
#if ENABLED(ADVANCED_PAUSE_FEATURE)
true
#endif
);
const millis_t ms = millis(); const millis_t ms = millis();
if (ELAPSED(ms, next_temp_report)) { if (ELAPSED(ms, next_temp_report)) {
thermalManager.print_heater_states(active_extruder); thermalManager.print_heater_states(active_extruder);
@ -191,11 +183,7 @@ void GcodeSuite::G76() {
do_blocking_move_to(destination); do_blocking_move_to(destination);
SERIAL_ECHOLNPGM("Waiting for probe heating."); SERIAL_ECHOLNPGM("Waiting for probe heating.");
while (thermalManager.degProbe() < target_probe) { while (thermalManager.degProbe() < target_probe) {
idle( idle_no_sleep();
#if ENABLED(ADVANCED_PAUSE_FEATURE)
true
#endif
);
const millis_t ms = millis(); const millis_t ms = millis();
if (ELAPSED(ms, next_temp_report)) { if (ELAPSED(ms, next_temp_report)) {
thermalManager.print_heater_states(active_extruder); thermalManager.print_heater_states(active_extruder);
@ -262,11 +250,7 @@ void GcodeSuite::G76() {
while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1f while (fabs(thermalManager.degBed() - float(target_bed)) > 0.1f
|| thermalManager.degProbe() > target_probe || thermalManager.degProbe() > target_probe
) { ) {
idle( idle_no_sleep();
#if ENABLED(ADVANCED_PAUSE_FEATURE)
true
#endif
);
const millis_t ms = millis(); const millis_t ms = millis();
if (ELAPSED(ms, next_temp_report)) { if (ELAPSED(ms, next_temp_report)) {
thermalManager.print_heater_states(active_extruder); thermalManager.print_heater_states(active_extruder);
@ -293,11 +277,7 @@ void GcodeSuite::G76() {
const millis_t probe_timeout_ms = millis() + 900UL * 1000UL; const millis_t probe_timeout_ms = millis() + 900UL * 1000UL;
while (thermalManager.degProbe() < target_probe) { while (thermalManager.degProbe() < target_probe) {
idle( idle_no_sleep();
#if ENABLED(ADVANCED_PAUSE_FEATURE)
true
#endif
);
const millis_t ms = millis(); const millis_t ms = millis();
if (ELAPSED(ms, next_temp_report)) { if (ELAPSED(ms, next_temp_report)) {
thermalManager.print_heater_states(active_extruder); thermalManager.print_heater_states(active_extruder);