浏览代码

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 年前
父节点
当前提交
959da98d8e
共有 1 个文件被更改,包括 9 次插入11 次删除
  1. 9
    11
      Marlin/temperature.cpp

+ 9
- 11
Marlin/temperature.cpp 查看文件

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

正在加载...
取消
保存