From 2d88bcb67e558f508f37b16b2789fd3e2b1755e9 Mon Sep 17 00:00:00 2001 From: Marcio T Date: Sun, 3 Jan 2021 20:39:15 -0700 Subject: [PATCH] Fix thermal error protection, reporting (#20655) --- .../ftdi_eve_lib/extended/sound_player.cpp | 4 +-- Marlin/src/module/temperature.cpp | 28 ++++++++++++------- Marlin/src/module/temperature.h | 4 +-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/sound_player.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/sound_player.cpp index f9869320b..07d1ff562 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/sound_player.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/sound_player.cpp @@ -75,9 +75,7 @@ namespace FTDI { while (has_more_notes()) { onIdle(); - #ifdef EXTENSIBLE_UI - ExtUI::yield(); - #endif + TERN_(TOUCH_UI_FTDI_EVE, ExtUI::yield()); } } diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 6f02f3b90..327f43dc0 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -793,9 +793,16 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { inline void loud_kill(PGM_P const lcd_msg, const heater_id_t heater_id) { marlin_state = MF_KILLED; #if USE_BEEPER + thermalManager.disable_all_heaters(); for (uint8_t i = 20; i--;) { - WRITE(BEEPER_PIN, HIGH); delay(25); - WRITE(BEEPER_PIN, LOW); delay(80); + WRITE(BEEPER_PIN, HIGH); + delay(25); + watchdog_refresh(); + WRITE(BEEPER_PIN, LOW); + delay(40); + watchdog_refresh(); + delay(40); + watchdog_refresh(); } WRITE(BEEPER_PIN, HIGH); #endif @@ -820,6 +827,7 @@ void Temperature::_temp_error(const heater_id_t heater_id, PGM_P const serial_ms } disable_all_heaters(); // always disable (even for bogus temp) + watchdog_refresh(); #if BOGUS_TEMPERATURE_GRACE_PERIOD const millis_t ms = millis(); @@ -923,8 +931,8 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { } #endif // PID_EXTRUSION_SCALING #if ENABLED(PID_FAN_SCALING) - if (thermalManager.fan_speed[active_extruder] > PID_FAN_SCALING_MIN_SPEED) { - work_pid[ee].Kf = PID_PARAM(Kf, ee) + (PID_FAN_SCALING_LIN_FACTOR) * thermalManager.fan_speed[active_extruder]; + if (fan_speed[active_extruder] > PID_FAN_SCALING_MIN_SPEED) { + work_pid[ee].Kf = PID_PARAM(Kf, ee) + (PID_FAN_SCALING_LIN_FACTOR) * fan_speed[active_extruder]; pid_output += work_pid[ee].Kf; } //pid_output -= work_pid[ee].Ki; @@ -1243,7 +1251,7 @@ void Temperature::manage_heater() { fan_chamber_pwm += (CHAMBER_FAN_FACTOR) * 2; #endif NOMORE(fan_chamber_pwm, 225); - thermalManager.set_fan_speed(2, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan + set_fan_speed(2, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan #endif #if ENABLED(CHAMBER_VENT) @@ -1274,7 +1282,7 @@ void Temperature::manage_heater() { else if (!flag_chamber_off) { #if ENABLED(CHAMBER_FAN) flag_chamber_off = true; - thermalManager.set_fan_speed(2, 0); + set_fan_speed(2, 0); #endif #if ENABLED(CHAMBER_VENT) flag_chamber_excess_heat = false; @@ -1355,7 +1363,7 @@ void Temperature::manage_heater() { user_thermistor_t Temperature::user_thermistor[USER_THERMISTORS]; // Initialized by settings.load() void Temperature::reset_user_thermistors() { - user_thermistor_t user_thermistor[USER_THERMISTORS] = { + user_thermistor_t default_user_thermistor[USER_THERMISTORS] = { #if HEATER_0_USER_THERMISTOR { true, 0, 0, HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS, 0, 0, HOTEND0_BETA, 0 }, #endif @@ -1387,7 +1395,7 @@ void Temperature::manage_heater() { { true, 0, 0, CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS, 0, 0, CHAMBER_BETA, 0 } #endif }; - COPY(thermalManager.user_thermistor, user_thermistor); + COPY(user_thermistor, default_user_thermistor); } void Temperature::log_user_thermistor(const uint8_t t_index, const bool eprom/*=false*/) { @@ -2423,7 +2431,7 @@ void Temperature::readings_ready() { #endif // HAS_HOTEND - #if HAS_HEATED_BED + #if ENABLED(THERMAL_PROTECTION_BED) #if TEMPDIR(BED) < 0 #define BEDCMP(A,B) ((A)<(B)) #else @@ -2434,7 +2442,7 @@ void Temperature::readings_ready() { if (bed_on && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(H_BED); #endif - #if HAS_HEATED_CHAMBER + #if BOTH(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER) #if TEMPDIR(CHAMBER) < 0 #define CHAMBERCMP(A,B) ((A)<(B)) #else diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 33f38c303..aa4f2e763 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -696,7 +696,7 @@ class Temperature { static bool wait_for_chamber(const bool no_wait_for_cooling=true); #endif - #endif // HAS_TEMP_CHAMBER + #endif #if WATCH_CHAMBER static void start_watching_chamber(); @@ -715,7 +715,7 @@ class Temperature { ; start_watching_chamber(); } - #endif // HAS_HEATED_CHAMBER + #endif /** * The software PWM power for a heater