Add extra max-temp safety checks (#13756)

This commit is contained in:
Marcio Teixeira 2019-04-19 20:37:12 -06:00 committed by Scott Lahteine
parent 4ac28ba6b3
commit d0c1eee53b
2 changed files with 18 additions and 7 deletions

View File

@ -930,6 +930,9 @@
#ifndef MSG_HEATING_FAILED_LCD_BED
#define MSG_HEATING_FAILED_LCD_BED _UxGT("Bed heating failed")
#endif
#ifndef MSG_HEATING_FAILED_LCD_CHAMBER
#define MSG_HEATING_FAILED_LCD_CHAMBER _UxGT("Chamber heating fail")
#endif
#ifndef MSG_ERR_REDUNDANT_TEMP
#define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: REDUNDANT TEMP")
#endif
@ -939,6 +942,9 @@
#ifndef MSG_THERMAL_RUNAWAY_BED
#define MSG_THERMAL_RUNAWAY_BED _UxGT("BED THERMAL RUNAWAY")
#endif
#ifndef MSG_THERMAL_RUNAWAY_CHAMBER
#define MSG_THERMAL_RUNAWAY_CHAMBER _UxGT("CHAMBER T. RUNAWAY")
#endif
#ifndef MSG_ERR_MAXTEMP
#define MSG_ERR_MAXTEMP _UxGT("Err: MAXTEMP")
#endif

View File

@ -86,17 +86,17 @@ Temperature thermalManager;
*/
#if HAS_HEATED_BED
#define _BED_PSTR(E) (E) == -1 ? PSTR(MSG ## _BED) :
#define _BED_PSTR(M,E) (E) == -1 ? PSTR(M ## _BED) :
#else
#define _BED_PSTR(E)
#define _BED_PSTR(M,E)
#endif
#if HAS_HEATED_CHAMBER
#define _CHAMBER_PSTR(E) (E) == -2 ? PSTR(MSG ## _CHAMBER) :
#define _CHAMBER_PSTR(M,E) (E) == -2 ? PSTR(M ## _CHAMBER) :
#else
#define _CHAMBER_PSTR(E)
#define _CHAMBER_PSTR(M,E)
#endif
#define _E_PSTR(M,E,N) (HOTENDS >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) :
#define TEMP_ERR_PSTR(M,E) _BED_PSTR(E) _CHAMBER_PSTR(E) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) _E_PSTR(M,E,6) PSTR(MSG_E1 " " M)
#define _E_PSTR(M,E,N) ((HOTENDS) >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) :
#define TEMP_ERR_PSTR(M,E) _BED_PSTR(M,E) _CHAMBER_PSTR(M,E) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) _E_PSTR(M,E,6) PSTR(MSG_E1 " " M)
// public:
@ -949,6 +949,8 @@ void Temperature::manage_heater() {
#endif
HOTEND_LOOP() {
if (degHotend(e) > temp_range[e].maxtemp)
temp_error(e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e));
#if HEATER_IDLE_HANDLER
hotend_idle[e].update(ms);
@ -1001,6 +1003,9 @@ void Temperature::manage_heater() {
#if HAS_HEATED_BED
if (degBed() > BED_MAXTEMP)
temp_error(-1, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -1));
#if WATCH_BED
// Make sure temperature is increasing
if (watch_bed.elapsed(ms)) { // Time to check the bed?
@ -2647,7 +2652,7 @@ void Temperature::isr() {
void Temperature::set_heating_message(const uint8_t e) {
const bool heating = isHeatingHotend(e);
#if HOTENDS > 1
ui.status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), int(e + 1));
ui.status_printf_P(0, heating ? PSTR("E%c " MSG_HEATING) : PSTR("E%c " MSG_COOLING), '1' + e);
#else
ui.set_status_P(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING));
#endif