Просмотр исходного кода

Add extra max-temp safety checks (#13756)

Marcio Teixeira 6 лет назад
Родитель
Сommit
d0c1eee53b
2 измененных файлов: 18 добавлений и 7 удалений
  1. 6
    0
      Marlin/src/lcd/language/language_en.h
  2. 12
    7
      Marlin/src/module/temperature.cpp

+ 6
- 0
Marlin/src/lcd/language/language_en.h Просмотреть файл

@@ -930,6 +930,9 @@
930 930
 #ifndef MSG_HEATING_FAILED_LCD_BED
931 931
   #define MSG_HEATING_FAILED_LCD_BED          _UxGT("Bed heating failed")
932 932
 #endif
933
+#ifndef MSG_HEATING_FAILED_LCD_CHAMBER
934
+  #define MSG_HEATING_FAILED_LCD_CHAMBER      _UxGT("Chamber heating fail")
935
+#endif
933 936
 #ifndef MSG_ERR_REDUNDANT_TEMP
934 937
   #define MSG_ERR_REDUNDANT_TEMP              _UxGT("Err: REDUNDANT TEMP")
935 938
 #endif
@@ -939,6 +942,9 @@
939 942
 #ifndef MSG_THERMAL_RUNAWAY_BED
940 943
   #define MSG_THERMAL_RUNAWAY_BED             _UxGT("BED THERMAL RUNAWAY")
941 944
 #endif
945
+#ifndef MSG_THERMAL_RUNAWAY_CHAMBER
946
+  #define MSG_THERMAL_RUNAWAY_CHAMBER         _UxGT("CHAMBER T. RUNAWAY")
947
+#endif
942 948
 #ifndef MSG_ERR_MAXTEMP
943 949
   #define MSG_ERR_MAXTEMP                     _UxGT("Err: MAXTEMP")
944 950
 #endif

+ 12
- 7
Marlin/src/module/temperature.cpp Просмотреть файл

@@ -86,17 +86,17 @@ Temperature thermalManager;
86 86
  */
87 87
 
88 88
 #if HAS_HEATED_BED
89
-  #define _BED_PSTR(E) (E) == -1 ? PSTR(MSG ## _BED) :
89
+  #define _BED_PSTR(M,E) (E) == -1 ? PSTR(M ## _BED) :
90 90
 #else
91
-  #define _BED_PSTR(E)
91
+  #define _BED_PSTR(M,E)
92 92
 #endif
93 93
 #if HAS_HEATED_CHAMBER
94
-  #define _CHAMBER_PSTR(E) (E) == -2 ? PSTR(MSG ## _CHAMBER) :
94
+  #define _CHAMBER_PSTR(M,E) (E) == -2 ? PSTR(M ## _CHAMBER) :
95 95
 #else
96
-  #define _CHAMBER_PSTR(E)
96
+  #define _CHAMBER_PSTR(M,E)
97 97
 #endif
98
-#define _E_PSTR(M,E,N) (HOTENDS >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) :
99
-#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)
98
+#define _E_PSTR(M,E,N) ((HOTENDS) >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) :
99
+#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)
100 100
 
101 101
 // public:
102 102
 
@@ -949,6 +949,8 @@ void Temperature::manage_heater() {
949 949
   #endif
950 950
 
951 951
   HOTEND_LOOP() {
952
+    if (degHotend(e) > temp_range[e].maxtemp)
953
+      temp_error(e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e));
952 954
 
953 955
     #if HEATER_IDLE_HANDLER
954 956
       hotend_idle[e].update(ms);
@@ -1001,6 +1003,9 @@ void Temperature::manage_heater() {
1001 1003
 
1002 1004
   #if HAS_HEATED_BED
1003 1005
 
1006
+    if (degBed() > BED_MAXTEMP)
1007
+      temp_error(-1, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -1));
1008
+
1004 1009
     #if WATCH_BED
1005 1010
       // Make sure temperature is increasing
1006 1011
       if (watch_bed.elapsed(ms)) {        // Time to check the bed?
@@ -2647,7 +2652,7 @@ void Temperature::isr() {
2647 2652
     void Temperature::set_heating_message(const uint8_t e) {
2648 2653
       const bool heating = isHeatingHotend(e);
2649 2654
       #if HOTENDS > 1
2650
-        ui.status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), int(e + 1));
2655
+        ui.status_printf_P(0, heating ? PSTR("E%c " MSG_HEATING) : PSTR("E%c " MSG_COOLING), '1' + e);
2651 2656
       #else
2652 2657
         ui.set_status_P(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING));
2653 2658
       #endif

Загрузка…
Отмена
Сохранить