Browse Source

Merge pull request #2115 from AnHardt/_temp_error

Use _temp_error() for all errors thrown by different heater sanity check mechanisms
AnHardt 10 years ago
parent
commit
d6c1285ab5
2 changed files with 17 additions and 29 deletions
  1. 9
    8
      Marlin/language.h
  2. 8
    21
      Marlin/temperature.cpp

+ 9
- 8
Marlin/language.h View File

223
 #define MSG_PID_DEBUG_PTERM                 " pTerm "
223
 #define MSG_PID_DEBUG_PTERM                 " pTerm "
224
 #define MSG_PID_DEBUG_ITERM                 " iTerm "
224
 #define MSG_PID_DEBUG_ITERM                 " iTerm "
225
 #define MSG_PID_DEBUG_DTERM                 " dTerm "
225
 #define MSG_PID_DEBUG_DTERM                 " dTerm "
226
-#define MSG_HEATING_FAILED                  "Heating failed"
227
-#define MSG_EXTRUDER_SWITCHED_OFF           "Extruder switched off. Temperature difference between temp sensors is too high !"
228
-
229
 #define MSG_INVALID_EXTRUDER_NUM            " - Invalid extruder number !"
226
 #define MSG_INVALID_EXTRUDER_NUM            " - Invalid extruder number !"
230
-#define MSG_THERMAL_RUNAWAY_STOP            "Thermal Runaway, system stopped! Heater_ID: "
231
-#define MSG_SWITCHED_OFF_MAX                " switched off. MAXTEMP triggered !!"
232
-#define MSG_MINTEMP_EXTRUDER_OFF            ": Extruder switched off. MINTEMP triggered !"
233
-#define MSG_MAXTEMP_EXTRUDER_OFF            ": Extruder" MSG_SWITCHED_OFF_MAX
234
-#define MSG_MAXTEMP_BED_OFF                 "Heated bed" MSG_SWITCHED_OFF_MAX
227
+
228
+#define MSG_HEATER_BED                      "bed"
229
+#define MSG_STOPPED_HEATER                  ", system stopped! Heater_ID: "
230
+#define MSG_REDUNDANCY                      "Heater switched off. Temperature difference between temp sensors is too high !"
231
+#define MSG_T_HEATING_FAILED                "Heating failed"
232
+#define MSG_T_THERMAL_RUNAWAY               "Thermal Runaway"
233
+#define MSG_T_MAXTEMP                       "MAXTEMP triggered"
234
+#define MSG_T_MINTEMP                       "MINTEMP triggered"
235
+
235
 
236
 
236
 // LCD Menu Messages
237
 // LCD Menu Messages
237
 
238
 

+ 8
- 21
Marlin/temperature.cpp View File

450
 inline void _temp_error(int e, const char *serial_msg, const char *lcd_msg) {
450
 inline void _temp_error(int e, const char *serial_msg, const char *lcd_msg) {
451
   if (IsRunning()) {
451
   if (IsRunning()) {
452
     SERIAL_ERROR_START;
452
     SERIAL_ERROR_START;
453
-    if (e >= 0) SERIAL_ERRORLN((int)e);
454
     serialprintPGM(serial_msg);
453
     serialprintPGM(serial_msg);
455
-    MYSERIAL.write('\n');
456
-    #ifdef ULTRA_LCD
457
-      lcd_setalertstatuspgm(lcd_msg);
458
-    #endif
454
+    SERIAL_ERRORPGM(MSG_STOPPED_HEATER);
455
+    if (e >= 0) SERIAL_ERRORLN((int)e); else SERIAL_ERRORLNPGM(MSG_HEATER_BED);
459
   }
456
   }
460
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
457
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
461
-    Stop();
458
+    kill(lcd_msg);
462
   #endif
459
   #endif
463
 }
460
 }
464
 
461
 
465
 void max_temp_error(uint8_t e) {
462
 void max_temp_error(uint8_t e) {
466
   disable_all_heaters();
463
   disable_all_heaters();
467
-  _temp_error(e, PSTR(MSG_MAXTEMP_EXTRUDER_OFF), PSTR(MSG_ERR_MAXTEMP));
464
+  _temp_error(e, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP));
468
 }
465
 }
469
 void min_temp_error(uint8_t e) {
466
 void min_temp_error(uint8_t e) {
470
   disable_all_heaters();
467
   disable_all_heaters();
471
-  _temp_error(e, PSTR(MSG_MINTEMP_EXTRUDER_OFF), PSTR(MSG_ERR_MINTEMP));
468
+  _temp_error(e, PSTR(MSG_T_MINTEMP), PSTR(MSG_ERR_MINTEMP));
472
 }
469
 }
473
 void bed_max_temp_error(void) {
470
 void bed_max_temp_error(void) {
474
   #if HAS_HEATER_BED
471
   #if HAS_HEATER_BED
475
     WRITE_HEATER_BED(0);
472
     WRITE_HEATER_BED(0);
476
   #endif
473
   #endif
477
-  _temp_error(-1, PSTR(MSG_MAXTEMP_BED_OFF), PSTR(MSG_ERR_MAXTEMP_BED));
474
+  _temp_error(-1, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP_BED));
478
 }
475
 }
479
 
476
 
480
 float get_pid_output(int e) {
477
 float get_pid_output(int e) {
628
         // Has it failed to increase enough?
625
         // Has it failed to increase enough?
629
         if (degHotend(e) < watch_target_temp[e]) {
626
         if (degHotend(e) < watch_target_temp[e]) {
630
           // Stop!
627
           // Stop!
631
-          disable_all_heaters();
632
-          _temp_error(e, PSTR(MSG_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
628
+          _temp_error(e, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
633
         }
629
         }
634
         else {
630
         else {
635
           // Start again if the target is still far off
631
           // Start again if the target is still far off
1071
           *state = TRRunaway;
1067
           *state = TRRunaway;
1072
         break;
1068
         break;
1073
       case TRRunaway:
1069
       case TRRunaway:
1074
-        SERIAL_ERROR_START;
1075
-        SERIAL_ERRORLNPGM(MSG_THERMAL_RUNAWAY_STOP);
1076
-        if (heater_id < 0) SERIAL_ERRORLNPGM("bed"); else SERIAL_ERRORLN(heater_id);
1077
-        LCD_ALERTMESSAGEPGM(MSG_THERMAL_RUNAWAY);
1078
-        disable_all_heaters();
1079
-        disable_all_steppers();
1080
-        for (;;) {
1081
-          manage_heater();
1082
-          lcd_update();
1083
-        }
1070
+        _temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), PSTR(MSG_THERMAL_RUNAWAY));
1084
     }
1071
     }
1085
   }
1072
   }
1086
 
1073
 

Loading…
Cancel
Save