Browse Source

Call kill() only once when triggered by a temperature error

to avoid stack overflow when called from interrupt.

Some clean up for calls of disable_all_heaters().
'disable_all_heaters()' is called in kill() and again when 'killed' is already set inside _temp_error().
AnHardt 10 years ago
parent
commit
959da98d8e
1 changed files with 9 additions and 11 deletions
  1. 9
    11
      Marlin/temperature.cpp

+ 9
- 11
Marlin/temperature.cpp View File

448
 // Temperature Error Handlers
448
 // Temperature Error Handlers
449
 //
449
 //
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
+  static bool killed = false;
451
   if (IsRunning()) {
452
   if (IsRunning()) {
452
     SERIAL_ERROR_START;
453
     SERIAL_ERROR_START;
453
     serialprintPGM(serial_msg);
454
     serialprintPGM(serial_msg);
455
     if (e >= 0) SERIAL_ERRORLN((int)e); else SERIAL_ERRORLNPGM(MSG_HEATER_BED);
456
     if (e >= 0) SERIAL_ERRORLN((int)e); else SERIAL_ERRORLNPGM(MSG_HEATER_BED);
456
   }
457
   }
457
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
458
   #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
458
-    kill(lcd_msg);
459
+    if (!killed) {
460
+      Running = false;
461
+      killed = true;
462
+      kill(lcd_msg);
463
+    }
464
+    else
465
+      disable_all_heaters(); // paranoia
459
   #endif
466
   #endif
460
 }
467
 }
461
 
468
 
462
 void max_temp_error(uint8_t e) {
469
 void max_temp_error(uint8_t e) {
463
-  disable_all_heaters();
464
   _temp_error(e, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP));
470
   _temp_error(e, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP));
465
 }
471
 }
466
 void min_temp_error(uint8_t e) {
472
 void min_temp_error(uint8_t e) {
467
-  disable_all_heaters();
468
   _temp_error(e, PSTR(MSG_T_MINTEMP), PSTR(MSG_ERR_MINTEMP));
473
   _temp_error(e, PSTR(MSG_T_MINTEMP), PSTR(MSG_ERR_MINTEMP));
469
 }
474
 }
470
 void bed_max_temp_error(void) {
475
 void bed_max_temp_error(void) {
471
-  #if HAS_HEATER_BED
472
-    WRITE_HEATER_BED(0);
473
-  #endif
474
   _temp_error(-1, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP_BED));
476
   _temp_error(-1, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP_BED));
475
 }
477
 }
476
 
478
 
637
 
639
 
638
     #ifdef TEMP_SENSOR_1_AS_REDUNDANT
640
     #ifdef TEMP_SENSOR_1_AS_REDUNDANT
639
       if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
641
       if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
640
-        disable_all_heaters();
641
         _temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP));
642
         _temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP));
642
       }
643
       }
643
     #endif
644
     #endif
1580
       #else
1581
       #else
1581
         #define GEBED >=
1582
         #define GEBED >=
1582
       #endif
1583
       #endif
1583
-      if (current_temperature_bed_raw GEBED bed_maxttemp_raw) {
1584
-        target_temperature_bed = 0;
1585
-        bed_max_temp_error();
1586
-      }
1584
+      if (current_temperature_bed_raw GEBED bed_maxttemp_raw) bed_max_temp_error();
1587
     #endif
1585
     #endif
1588
 
1586
 
1589
   } // temp_count >= OVERSAMPLENR
1587
   } // temp_count >= OVERSAMPLENR

Loading…
Cancel
Save