Fix thermal error protection, reporting (#20655)

This commit is contained in:
Marcio T 2021-01-03 20:39:15 -07:00 committed by Scott Lahteine
parent c6c5cc7246
commit d3d8fd6d9b
3 changed files with 21 additions and 15 deletions

View File

@ -75,9 +75,7 @@ namespace FTDI {
while (has_more_notes()) { while (has_more_notes()) {
onIdle(); onIdle();
#ifdef EXTENSIBLE_UI TERN_(TOUCH_UI_FTDI_EVE, ExtUI::yield());
ExtUI::yield();
#endif
} }
} }

View File

@ -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) { inline void loud_kill(PGM_P const lcd_msg, const heater_id_t heater_id) {
marlin_state = MF_KILLED; marlin_state = MF_KILLED;
#if USE_BEEPER #if USE_BEEPER
thermalManager.disable_all_heaters();
for (uint8_t i = 20; i--;) { for (uint8_t i = 20; i--;) {
WRITE(BEEPER_PIN, HIGH); delay(25); WRITE(BEEPER_PIN, HIGH);
WRITE(BEEPER_PIN, LOW); delay(80); delay(25);
watchdog_refresh();
WRITE(BEEPER_PIN, LOW);
delay(40);
watchdog_refresh();
delay(40);
watchdog_refresh();
} }
WRITE(BEEPER_PIN, HIGH); WRITE(BEEPER_PIN, HIGH);
#endif #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) disable_all_heaters(); // always disable (even for bogus temp)
watchdog_refresh();
#if BOGUS_TEMPERATURE_GRACE_PERIOD #if BOGUS_TEMPERATURE_GRACE_PERIOD
const millis_t ms = millis(); const millis_t ms = millis();
@ -923,8 +931,8 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
} }
#endif // PID_EXTRUSION_SCALING #endif // PID_EXTRUSION_SCALING
#if ENABLED(PID_FAN_SCALING) #if ENABLED(PID_FAN_SCALING)
if (thermalManager.fan_speed[active_extruder] > PID_FAN_SCALING_MIN_SPEED) { if (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]; 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].Kf;
} }
//pid_output -= work_pid[ee].Ki; //pid_output -= work_pid[ee].Ki;
@ -1243,7 +1251,7 @@ void Temperature::manage_heater() {
fan_chamber_pwm += (CHAMBER_FAN_FACTOR) * 2; fan_chamber_pwm += (CHAMBER_FAN_FACTOR) * 2;
#endif #endif
NOMORE(fan_chamber_pwm, 225); 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 #endif
#if ENABLED(CHAMBER_VENT) #if ENABLED(CHAMBER_VENT)
@ -1274,7 +1282,7 @@ void Temperature::manage_heater() {
else if (!flag_chamber_off) { else if (!flag_chamber_off) {
#if ENABLED(CHAMBER_FAN) #if ENABLED(CHAMBER_FAN)
flag_chamber_off = true; flag_chamber_off = true;
thermalManager.set_fan_speed(2, 0); set_fan_speed(2, 0);
#endif #endif
#if ENABLED(CHAMBER_VENT) #if ENABLED(CHAMBER_VENT)
flag_chamber_excess_heat = false; 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() user_thermistor_t Temperature::user_thermistor[USER_THERMISTORS]; // Initialized by settings.load()
void Temperature::reset_user_thermistors() { 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 #if HEATER_0_USER_THERMISTOR
{ true, 0, 0, HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS, 0, 0, HOTEND0_BETA, 0 }, { true, 0, 0, HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS, 0, 0, HOTEND0_BETA, 0 },
#endif #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 } { true, 0, 0, CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS, 0, 0, CHAMBER_BETA, 0 }
#endif #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*/) { 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 #endif // HAS_HOTEND
#if HAS_HEATED_BED #if ENABLED(THERMAL_PROTECTION_BED)
#if TEMPDIR(BED) < 0 #if TEMPDIR(BED) < 0
#define BEDCMP(A,B) ((A)<(B)) #define BEDCMP(A,B) ((A)<(B))
#else #else
@ -2434,7 +2442,7 @@ void Temperature::readings_ready() {
if (bed_on && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(H_BED); if (bed_on && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(H_BED);
#endif #endif
#if HAS_HEATED_CHAMBER #if BOTH(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER)
#if TEMPDIR(CHAMBER) < 0 #if TEMPDIR(CHAMBER) < 0
#define CHAMBERCMP(A,B) ((A)<(B)) #define CHAMBERCMP(A,B) ((A)<(B))
#else #else

View File

@ -696,7 +696,7 @@ class Temperature {
static bool wait_for_chamber(const bool no_wait_for_cooling=true); static bool wait_for_chamber(const bool no_wait_for_cooling=true);
#endif #endif
#endif // HAS_TEMP_CHAMBER #endif
#if WATCH_CHAMBER #if WATCH_CHAMBER
static void start_watching_chamber(); static void start_watching_chamber();
@ -715,7 +715,7 @@ class Temperature {
; ;
start_watching_chamber(); start_watching_chamber();
} }
#endif // HAS_HEATED_CHAMBER #endif
/** /**
* The software PWM power for a heater * The software PWM power for a heater