|
|
@ -746,9 +746,28 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) { |
|
|
|
//
|
|
|
|
// Temperature Error Handlers
|
|
|
|
//
|
|
|
|
|
|
|
|
inline void loud_kill(PGM_P const lcd_msg) { |
|
|
|
Running = false; |
|
|
|
#if HAS_BUZZER && PIN_EXISTS(BEEPER) |
|
|
|
for (uint8_t i = 20; i--;) { |
|
|
|
WRITE(BEEPER_PIN, HIGH); delay(25); |
|
|
|
WRITE(BEEPER_PIN, LOW); delay(80); |
|
|
|
} |
|
|
|
WRITE(BEEPER_PIN, HIGH); |
|
|
|
#endif |
|
|
|
kill(lcd_msg); |
|
|
|
} |
|
|
|
|
|
|
|
void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg, PGM_P const lcd_msg) { |
|
|
|
static bool killed = false; |
|
|
|
if (IsRunning()) { |
|
|
|
|
|
|
|
static uint8_t killed = 0; |
|
|
|
|
|
|
|
if (IsRunning() |
|
|
|
#if BOGUS_TEMPERATURE_GRACE_PERIOD |
|
|
|
&& killed == 2 |
|
|
|
#endif |
|
|
|
) { |
|
|
|
SERIAL_ERROR_START(); |
|
|
|
serialprintPGM(serial_msg); |
|
|
|
SERIAL_ECHOPGM(MSG_STOPPED_HEATER); |
|
|
@ -760,27 +779,28 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg, |
|
|
|
SERIAL_EOL(); |
|
|
|
} |
|
|
|
|
|
|
|
#if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE) |
|
|
|
if (!killed) { |
|
|
|
Running = false; |
|
|
|
killed = true; |
|
|
|
|
|
|
|
disable_all_heaters(); |
|
|
|
disable_all_heaters(); // always disable (even for bogus temp)
|
|
|
|
|
|
|
|
#if HAS_BUZZER && PIN_EXISTS(BEEPER) |
|
|
|
for (uint8_t i = 20; i--;) { |
|
|
|
WRITE(BEEPER_PIN, HIGH); delay(25); |
|
|
|
WRITE(BEEPER_PIN, LOW); delay(80); |
|
|
|
} |
|
|
|
WRITE(BEEPER_PIN, HIGH); |
|
|
|
#endif |
|
|
|
|
|
|
|
kill(lcd_msg); |
|
|
|
#if BOGUS_TEMPERATURE_GRACE_PERIOD |
|
|
|
const millis_t ms = millis(); |
|
|
|
static millis_t expire_ms; |
|
|
|
switch (killed) { |
|
|
|
case 0: |
|
|
|
expire_ms = ms + BOGUS_TEMPERATURE_GRACE_PERIOD; |
|
|
|
++killed; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
if (ELAPSED(ms, expire_ms)) ++killed; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
loud_kill(lcd_msg); |
|
|
|
++killed; |
|
|
|
break; |
|
|
|
} |
|
|
|
else |
|
|
|
disable_all_heaters(); // paranoia
|
|
|
|
#else |
|
|
|
#elif defined(BOGUS_TEMPERATURE_GRACE_PERIOD) |
|
|
|
UNUSED(killed); |
|
|
|
#else |
|
|
|
if (!killed) { killed = 1; loud_kill(lcd_msg); } |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|