Browse Source

Improve BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE (#13740)

Scott Lahteine 5 years ago
parent
commit
5519054f50
No account linked to committer's email address

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

746
 //
746
 //
747
 // Temperature Error Handlers
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
 void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg, PGM_P const lcd_msg) {
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
     SERIAL_ERROR_START();
771
     SERIAL_ERROR_START();
753
     serialprintPGM(serial_msg);
772
     serialprintPGM(serial_msg);
754
     SERIAL_ECHOPGM(MSG_STOPPED_HEATER);
773
     SERIAL_ECHOPGM(MSG_STOPPED_HEATER);
760
     SERIAL_EOL();
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
     UNUSED(killed);
801
     UNUSED(killed);
802
+  #else
803
+    if (!killed) { killed = 1; loud_kill(lcd_msg); }
784
   #endif
804
   #endif
785
 }
805
 }
786
 
806
 

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

35
 // Enable I2C_EEPROM for testing
35
 // Enable I2C_EEPROM for testing
36
 #define I2C_EEPROM
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
 // Steppers
42
 // Steppers

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

31
 // Release PB3/PB4 (E0 STP/DIR) from JTAG pins
31
 // Release PB3/PB4 (E0 STP/DIR) from JTAG pins
32
 #define DISABLE_JTAG
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
 // Servos
38
 // Servos

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

32
 //#define DISABLE_DEBUG
32
 //#define DISABLE_DEBUG
33
 #define DISABLE_JTAG
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
 // Limit Switches
39
 // Limit Switches

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

29
   #define BOARD_NAME "BIGTREE SKR V1.3"
29
   #define BOARD_NAME "BIGTREE SKR V1.3"
30
 #endif
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
 // Servos
36
 // Servos

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

35
 // Enable I2C_EEPROM for testing
35
 // Enable I2C_EEPROM for testing
36
 //#define I2C_EEPROM
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
 // Steppers
42
 // Steppers

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

30
 
30
 
31
 #define pins_v2_20190128   // geo-f:add for new pins define
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
 // Limit Switches
37
 // Limit Switches

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

30
 #define BOARD_NAME        "FYSETC Cheetah"
30
 #define BOARD_NAME        "FYSETC Cheetah"
31
 #define BOARD_WEBSITE_URL "https://fysetc.com"
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
 // Servos
37
 // Servos

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

130
 
130
 
131
 // All these generations of Gen7 supply thermistor power
131
 // All these generations of Gen7 supply thermistor power
132
 // via PS_ON, so ignore bad thermistor readings
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
 #define DEBUG_PIN           0
135
 #define DEBUG_PIN           0
136
 
136
 

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

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

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

115
 
115
 
116
 // All these generations of Gen7 supply thermistor power
116
 // All these generations of Gen7 supply thermistor power
117
 // via PS_ON, so ignore bad thermistor readings
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
 // our pin for debugging.
120
 // our pin for debugging.
121
 #define DEBUG_PIN           0
121
 #define DEBUG_PIN           0

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

32
 #define BOARD_NAME           "Misc. STM32F1R"
32
 #define BOARD_NAME           "Misc. STM32F1R"
33
 #define DEFAULT_MACHINE_NAME "STM32F103RET6"
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
 // Limit Switches
39
 // Limit Switches

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

32
 
32
 
33
 #define E2END 0xFFF // 4KB
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
 #if HOTENDS > 2 || E_STEPPERS > 2
38
 #if HOTENDS > 2 || E_STEPPERS > 2
39
   #error "STM32F4 supports up to 2 hotends / E-steppers."
39
   #error "STM32F4 supports up to 2 hotends / E-steppers."

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

35
 // Enable I2C_EEPROM for testing
35
 // Enable I2C_EEPROM for testing
36
 #define I2C_EEPROM
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
 // Limit Switches
42
 // Limit Switches

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

30
 
30
 
31
 #define E2END 0xFFF   // EEPROM end address
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
 #if HOTENDS > 3 || E_STEPPERS > 3
36
 #if HOTENDS > 3 || E_STEPPERS > 3
37
   #error "The-Borg supports up to 3 hotends / E-steppers."
37
   #error "The-Borg supports up to 3 hotends / E-steppers."

Loading…
Cancel
Save