1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-18 08:17:18 +00:00

Improve BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE (#13740)

This commit is contained in:
Scott Lahteine 2019-07-09 21:35:07 -05:00 committed by GitHub
parent 3ae3bf5d33
commit 5519054f50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 65 additions and 45 deletions

View File

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

View File

@ -35,8 +35,8 @@
// Enable I2C_EEPROM for testing // Enable I2C_EEPROM for testing
#define I2C_EEPROM #define I2C_EEPROM
// Ignore temp readings during develpment. // Ignore temp readings during development.
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// //
// Steppers // Steppers

View File

@ -31,8 +31,8 @@
// Release PB3/PB4 (E0 STP/DIR) from JTAG pins // Release PB3/PB4 (E0 STP/DIR) from JTAG pins
#define DISABLE_JTAG #define DISABLE_JTAG
// Ignore temp readings during develpment. // Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// //
// Servos // Servos

View File

@ -32,8 +32,8 @@
//#define DISABLE_DEBUG //#define DISABLE_DEBUG
#define DISABLE_JTAG #define DISABLE_JTAG
// Ignore temp readings during develpment. // Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// //
// Limit Switches // Limit Switches

View File

@ -29,8 +29,8 @@
#define BOARD_NAME "BIGTREE SKR V1.3" #define BOARD_NAME "BIGTREE SKR V1.3"
#endif #endif
// Ignore temp readings during develpment. // Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// //
// Servos // Servos

View File

@ -35,8 +35,8 @@
// Enable I2C_EEPROM for testing // Enable I2C_EEPROM for testing
//#define I2C_EEPROM //#define I2C_EEPROM
// Ignore temp readings during develpment. // Ignore temp readings during development.
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// //
// Steppers // Steppers

View File

@ -30,8 +30,8 @@
#define pins_v2_20190128 // geo-f:add for new pins define #define pins_v2_20190128 // geo-f:add for new pins define
// Ignore temp readings during develpment. // Ignore temp readings during development.
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// //
// Limit Switches // Limit Switches

View File

@ -30,8 +30,8 @@
#define BOARD_NAME "FYSETC Cheetah" #define BOARD_NAME "FYSETC Cheetah"
#define BOARD_WEBSITE_URL "https://fysetc.com" #define BOARD_WEBSITE_URL "https://fysetc.com"
// Ignore temp readings during develpment. // Ignore temp readings during development.
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// //
// Servos // Servos

View File

@ -130,7 +130,7 @@
// All these generations of Gen7 supply thermistor power // All these generations of Gen7 supply thermistor power
// via PS_ON, so ignore bad thermistor readings // via PS_ON, so ignore bad thermistor readings
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
#define DEBUG_PIN 0 #define DEBUG_PIN 0

View File

@ -49,7 +49,7 @@
//#define DISABLE_JTAGSWD //#define DISABLE_JTAGSWD
// Ignore temp readings during development. // Ignore temp readings during development.
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// Enable EEPROM Emulation for this board as it doesn't have EEPROM // Enable EEPROM Emulation for this board as it doesn't have EEPROM
#define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION

View File

@ -115,7 +115,7 @@
// All these generations of Gen7 supply thermistor power // All these generations of Gen7 supply thermistor power
// via PS_ON, so ignore bad thermistor readings // via PS_ON, so ignore bad thermistor readings
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// our pin for debugging. // our pin for debugging.
#define DEBUG_PIN 0 #define DEBUG_PIN 0

View File

@ -32,8 +32,8 @@
#define BOARD_NAME "Misc. STM32F1R" #define BOARD_NAME "Misc. STM32F1R"
#define DEFAULT_MACHINE_NAME "STM32F103RET6" #define DEFAULT_MACHINE_NAME "STM32F103RET6"
// Ignore temp readings during develpment. // Ignore temp readings during development.
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// //
// Limit Switches // Limit Switches

View File

@ -32,8 +32,8 @@
#define E2END 0xFFF // 4KB #define E2END 0xFFF // 4KB
// Ignore temp readings during develpment. // Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
#if HOTENDS > 2 || E_STEPPERS > 2 #if HOTENDS > 2 || E_STEPPERS > 2
#error "STM32F4 supports up to 2 hotends / E-steppers." #error "STM32F4 supports up to 2 hotends / E-steppers."

View File

@ -35,8 +35,8 @@
// Enable I2C_EEPROM for testing // Enable I2C_EEPROM for testing
#define I2C_EEPROM #define I2C_EEPROM
// Ignore temp readings during develpment. // Ignore temp readings during development.
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
// //
// Limit Switches // Limit Switches

View File

@ -30,8 +30,8 @@
#define E2END 0xFFF // EEPROM end address #define E2END 0xFFF // EEPROM end address
// Ignore temp readings during develpment. // Ignore temp readings during development.
#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
#if HOTENDS > 3 || E_STEPPERS > 3 #if HOTENDS > 3 || E_STEPPERS > 3
#error "The-Borg supports up to 3 hotends / E-steppers." #error "The-Borg supports up to 3 hotends / E-steppers."