From e47029199e0aaba93451c01307582a29e4ebcad1 Mon Sep 17 00:00:00 2001 From: Thomas Moore Date: Mon, 12 Jun 2017 00:22:31 -0500 Subject: [PATCH] Remove ADVANCED_PAUSE_FEATURE requirement for PROBING_HEATERS_OFF (#7000) * Remove ADVANCED_PAUSE_FEATURE requirement for PROBING_HEATERS_OFF * Add HEATER_IDLE_HANDLER conditional --- Marlin/Conditionals_post.h | 1 + Marlin/SanityCheck.h | 7 ------- Marlin/temperature.cpp | 18 +++++++++--------- Marlin/temperature.h | 4 ++-- Marlin/ultralcd_impl_DOGM.h | 2 +- Marlin/ultralcd_impl_HD44780.h | 2 +- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 040885fc2f..4f7272f938 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -653,6 +653,7 @@ #undef PROBING_FANS_OFF #endif #define QUIET_PROBING (HAS_BED_PROBE && (ENABLED(PROBING_HEATERS_OFF) || ENABLED(PROBING_FANS_OFF))) + #define HEATER_IDLE_HANDLER (ENABLED(ADVANCED_PAUSE_FEATURE) || ENABLED(PROBING_HEATERS_OFF)) /** * Servos and probes diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 7260c0e5b2..f975733361 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -577,13 +577,6 @@ static_assert(1 >= 0 #error "Probes need Z_CLEARANCE_BETWEEN_PROBES >= 0." #endif - /** - * Advanced Pause is required in order to turn the heaters off during probing - */ - #if (ENABLED(PROBING_HEATERS_OFF) && DISABLED(ADVANCED_PAUSE_FEATURE)) - #error "PROBING_HEATERS_OFF requires ADVANCED_PAUSE_FEATURE" - #endif - #else /** diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index f62e5a94db..56be635da2 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -203,7 +203,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS], bool Temperature::paused; #endif -#if ENABLED(ADVANCED_PAUSE_FEATURE) +#if HEATER_IDLE_HANDLER millis_t Temperature::heater_idle_timeout_ms[HOTENDS] = { 0 }; bool Temperature::heater_idle_timeout_exceeded[HOTENDS] = { false }; #if HAS_TEMP_BED @@ -558,7 +558,7 @@ float Temperature::get_pid_output(int e) { pid_error[HOTEND_INDEX] = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX]; dTerm[HOTEND_INDEX] = K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + K1 * dTerm[HOTEND_INDEX]; temp_dState[HOTEND_INDEX] = current_temperature[HOTEND_INDEX]; - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER if (heater_idle_timeout_exceeded[HOTEND_INDEX]) { pid_output = 0; pid_reset[HOTEND_INDEX] = true; @@ -570,7 +570,7 @@ float Temperature::get_pid_output(int e) { pid_reset[HOTEND_INDEX] = true; } else if (pid_error[HOTEND_INDEX] < -(PID_FUNCTIONAL_RANGE) || target_temperature[HOTEND_INDEX] == 0 - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER || heater_idle_timeout_exceeded[HOTEND_INDEX] #endif ) { @@ -633,7 +633,7 @@ float Temperature::get_pid_output(int e) { #endif // PID_DEBUG #else /* PID off */ - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER if (heater_idle_timeout_exceeded[HOTEND_INDEX]) pid_output = 0; else @@ -719,13 +719,13 @@ void Temperature::manage_heater() { if (current_temperature[0] < max(HEATER_0_MINTEMP, MAX6675_TMIN + .01)) min_temp_error(0); #endif - #if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || ENABLED(ADVANCED_PAUSE_FEATURE) + #if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER millis_t ms = millis(); #endif HOTEND_LOOP() { - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER if (!heater_idle_timeout_exceeded[e] && heater_idle_timeout_ms[e] && ELAPSED(ms, heater_idle_timeout_ms[e])) heater_idle_timeout_exceeded[e] = true; #endif @@ -793,7 +793,7 @@ void Temperature::manage_heater() { #if HAS_TEMP_BED - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER if (!bed_idle_timeout_exceeded && bed_idle_timeout_ms && ELAPSED(ms, bed_idle_timeout_ms)) bed_idle_timeout_exceeded = true; #endif @@ -802,7 +802,7 @@ void Temperature::manage_heater() { thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS); #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER if (bed_idle_timeout_exceeded) { soft_pwm_amount_bed = 0; @@ -1294,7 +1294,7 @@ void Temperature::init() { int heater_index = heater_id >= 0 ? heater_id : HOTENDS; - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER // If the heater idle timeout expires, restart if (heater_id >= 0 && heater_idle_timeout_exceeded[heater_id]) { *state = TRInactive; diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 18717dea21..2eff176198 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -262,7 +262,7 @@ class Temperature { static bool paused; #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER static millis_t heater_idle_timeout_ms[HOTENDS]; static bool heater_idle_timeout_exceeded[HOTENDS]; #if HAS_TEMP_BED @@ -476,7 +476,7 @@ class Temperature { static bool is_paused() { return paused; } #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER static void start_heater_idle_timer(uint8_t e, millis_t timeout_ms) { #if HOTENDS == 1 UNUSED(e); diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index bfd103a7d3..29445262c3 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -357,7 +357,7 @@ FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, cons #endif if (PAGE_UNDER(7)) { - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) : #if HAS_TEMP_BED thermalManager.is_bed_idle() diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index ef5301b7f2..7bc901854e 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -600,7 +600,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co lcd.print(itostr3(t1 + 0.5)); lcd.print('/'); - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if HEATER_IDLE_HANDLER const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) : #if HAS_TEMP_BED thermalManager.is_bed_idle()