Sfoglia il codice sorgente

Improve BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE (#13740)

Scott Lahteine 5 anni fa
parent
commit
5519054f50
Nessun account collegato all'indirizzo email del committer

+ 40
- 20
Marlin/src/module/temperature.cpp Vedi File

@@ -746,9 +746,28 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
746 746
 //
747 747
 // Temperature Error Handlers
748 748
 //
749
+
750
+inline void loud_kill(PGM_P const lcd_msg) {
751
+  Running = false;
752
+  #if HAS_BUZZER && PIN_EXISTS(BEEPER)
753
+    for (uint8_t i = 20; i--;) {
754
+      WRITE(BEEPER_PIN, HIGH); delay(25);
755
+      WRITE(BEEPER_PIN, LOW); delay(80);
756
+    }
757
+    WRITE(BEEPER_PIN, HIGH);
758
+  #endif
759
+  kill(lcd_msg);
760
+}
761
+
749 762
 void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg, PGM_P const lcd_msg) {
750
-  static bool killed = false;
751
-  if (IsRunning()) {
763
+
764
+  static uint8_t killed = 0;
765
+
766
+  if (IsRunning()
767
+    #if BOGUS_TEMPERATURE_GRACE_PERIOD
768
+      && killed == 2
769
+    #endif
770
+  ) {
752 771
     SERIAL_ERROR_START();
753 772
     serialprintPGM(serial_msg);
754 773
     SERIAL_ECHOPGM(MSG_STOPPED_HEATER);
@@ -760,27 +779,28 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg,
760 779
     SERIAL_EOL();
761 780
   }
762 781
 
763
-  #if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE)
764
-    if (!killed) {
765
-      Running = false;
766
-      killed = true;
767
-
768
-      disable_all_heaters();
782
+  disable_all_heaters(); // always disable (even for bogus temp)
769 783
 
770
-      #if HAS_BUZZER && PIN_EXISTS(BEEPER)
771
-        for (uint8_t i = 20; i--;) {
772
-          WRITE(BEEPER_PIN, HIGH); delay(25);
773
-          WRITE(BEEPER_PIN, LOW); delay(80);
774
-        }
775
-        WRITE(BEEPER_PIN, HIGH);
776
-      #endif
777
-
778
-      kill(lcd_msg);
784
+  #if BOGUS_TEMPERATURE_GRACE_PERIOD
785
+    const millis_t ms = millis();
786
+    static millis_t expire_ms;
787
+    switch (killed) {
788
+      case 0:
789
+        expire_ms = ms + BOGUS_TEMPERATURE_GRACE_PERIOD;
790
+        ++killed;
791
+        break;
792
+      case 1:
793
+        if (ELAPSED(ms, expire_ms)) ++killed;
794
+        break;
795
+      case 2:
796
+        loud_kill(lcd_msg);
797
+        ++killed;
798
+        break;
779 799
     }
780
-    else
781
-      disable_all_heaters(); // paranoia
782
-  #else
800
+  #elif defined(BOGUS_TEMPERATURE_GRACE_PERIOD)
783 801
     UNUSED(killed);
802
+  #else
803
+    if (!killed) { killed = 1; loud_kill(lcd_msg); }
784 804
   #endif
785 805
 }
786 806
 

+ 2
- 2
Marlin/src/pins/pins_BEAST.h Vedi File

@@ -35,8 +35,8 @@
35 35
 // Enable I2C_EEPROM for testing
36 36
 #define I2C_EEPROM
37 37
 
38
-// Ignore temp readings during develpment.
39
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
38
+// Ignore temp readings during development.
39
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
40 40
 
41 41
 //
42 42
 // Steppers

+ 2
- 2
Marlin/src/pins/pins_BIGTREE_SKR_MINI_E3.h Vedi File

@@ -31,8 +31,8 @@
31 31
 // Release PB3/PB4 (E0 STP/DIR) from JTAG pins
32 32
 #define DISABLE_JTAG
33 33
 
34
-// Ignore temp readings during develpment.
35
-//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
34
+// Ignore temp readings during development.
35
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
36 36
 
37 37
 //
38 38
 // Servos

+ 2
- 2
Marlin/src/pins/pins_BIGTREE_SKR_MINI_V1_1.h Vedi File

@@ -32,8 +32,8 @@
32 32
 //#define DISABLE_DEBUG
33 33
 #define DISABLE_JTAG
34 34
 
35
-// Ignore temp readings during develpment.
36
-//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
35
+// Ignore temp readings during development.
36
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
37 37
 
38 38
 //
39 39
 // Limit Switches

+ 2
- 2
Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h Vedi File

@@ -29,8 +29,8 @@
29 29
   #define BOARD_NAME "BIGTREE SKR V1.3"
30 30
 #endif
31 31
 
32
-// Ignore temp readings during develpment.
33
-//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
32
+// Ignore temp readings during development.
33
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
34 34
 
35 35
 //
36 36
 // Servos

+ 2
- 2
Marlin/src/pins/pins_CHITU3D.h Vedi File

@@ -35,8 +35,8 @@
35 35
 // Enable I2C_EEPROM for testing
36 36
 //#define I2C_EEPROM
37 37
 
38
-// Ignore temp readings during develpment.
39
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
38
+// Ignore temp readings during development.
39
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
40 40
 
41 41
 //
42 42
 // Steppers

+ 2
- 2
Marlin/src/pins/pins_FYSETC_AIO_II.h Vedi File

@@ -30,8 +30,8 @@
30 30
 
31 31
 #define pins_v2_20190128   // geo-f:add for new pins define
32 32
 
33
-// Ignore temp readings during develpment.
34
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
33
+// Ignore temp readings during development.
34
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
35 35
 
36 36
 //
37 37
 // Limit Switches

+ 2
- 2
Marlin/src/pins/pins_FYSETC_CHEETAH.h Vedi File

@@ -30,8 +30,8 @@
30 30
 #define BOARD_NAME        "FYSETC Cheetah"
31 31
 #define BOARD_WEBSITE_URL "https://fysetc.com"
32 32
 
33
-// Ignore temp readings during develpment.
34
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
33
+// Ignore temp readings during development.
34
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
35 35
 
36 36
 //
37 37
 // Servos

+ 1
- 1
Marlin/src/pins/pins_GEN7_12.h Vedi File

@@ -130,7 +130,7 @@
130 130
 
131 131
 // All these generations of Gen7 supply thermistor power
132 132
 // via PS_ON, so ignore bad thermistor readings
133
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
133
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
134 134
 
135 135
 #define DEBUG_PIN           0
136 136
 

+ 1
- 1
Marlin/src/pins/pins_GTM32_PRO_VB.h Vedi File

@@ -49,7 +49,7 @@
49 49
 //#define DISABLE_JTAGSWD
50 50
 
51 51
 // Ignore temp readings during development.
52
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
52
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
53 53
 
54 54
 // Enable EEPROM Emulation for this board as it doesn't have EEPROM
55 55
 #define FLASH_EEPROM_EMULATION

+ 1
- 1
Marlin/src/pins/pins_SETHI.h Vedi File

@@ -115,7 +115,7 @@
115 115
 
116 116
 // All these generations of Gen7 supply thermistor power
117 117
 // via PS_ON, so ignore bad thermistor readings
118
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
118
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
119 119
 
120 120
 // our pin for debugging.
121 121
 #define DEBUG_PIN           0

+ 2
- 2
Marlin/src/pins/pins_STM32F1R.h Vedi File

@@ -32,8 +32,8 @@
32 32
 #define BOARD_NAME           "Misc. STM32F1R"
33 33
 #define DEFAULT_MACHINE_NAME "STM32F103RET6"
34 34
 
35
-// Ignore temp readings during develpment.
36
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
35
+// Ignore temp readings during development.
36
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
37 37
 
38 38
 //
39 39
 // Limit Switches

+ 2
- 2
Marlin/src/pins/pins_STM32F4.h Vedi File

@@ -32,8 +32,8 @@
32 32
 
33 33
 #define E2END 0xFFF // 4KB
34 34
 
35
-// Ignore temp readings during develpment.
36
-//#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
35
+// Ignore temp readings during development.
36
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
37 37
 
38 38
 #if HOTENDS > 2 || E_STEPPERS > 2
39 39
   #error "STM32F4 supports up to 2 hotends / E-steppers."

+ 2
- 2
Marlin/src/pins/pins_STM3R_MINI.h Vedi File

@@ -35,8 +35,8 @@
35 35
 // Enable I2C_EEPROM for testing
36 36
 #define I2C_EEPROM
37 37
 
38
-// Ignore temp readings during develpment.
39
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
38
+// Ignore temp readings during development.
39
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
40 40
 
41 41
 //
42 42
 // Limit Switches

+ 2
- 2
Marlin/src/pins/pins_THE_BORG.h Vedi File

@@ -30,8 +30,8 @@
30 30
 
31 31
 #define E2END 0xFFF   // EEPROM end address
32 32
 
33
-// Ignore temp readings during develpment.
34
-#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
33
+// Ignore temp readings during development.
34
+//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
35 35
 
36 36
 #if HOTENDS > 3 || E_STEPPERS > 3
37 37
   #error "The-Borg supports up to 3 hotends / E-steppers."

Loading…
Annulla
Salva