|
@@ -83,15 +83,20 @@ unsigned char soft_pwm_bed;
|
83
|
83
|
#ifdef FILAMENT_SENSOR
|
84
|
84
|
int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only
|
85
|
85
|
#endif
|
86
|
|
-#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
|
87
|
|
-void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
|
88
|
|
-static int thermal_runaway_state_machine[4]; // = {0,0,0,0};
|
89
|
|
-static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0};
|
90
|
|
-static bool thermal_runaway = false;
|
91
|
|
-#if TEMP_SENSOR_BED != 0
|
92
|
|
- static int thermal_runaway_bed_state_machine;
|
93
|
|
- static unsigned long thermal_runaway_bed_timer;
|
94
|
|
-#endif
|
|
86
|
+
|
|
87
|
+#define HAS_HEATER_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0)
|
|
88
|
+#define HAS_BED_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 && TEMP_SENSOR_BED != 0)
|
|
89
|
+#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
|
|
90
|
+ static bool thermal_runaway = false;
|
|
91
|
+ void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
|
|
92
|
+ #if HAS_HEATER_THERMAL_PROTECTION
|
|
93
|
+ static int thermal_runaway_state_machine[4]; // = {0,0,0,0};
|
|
94
|
+ static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0};
|
|
95
|
+ #endif
|
|
96
|
+ #if HAS_BED_THERMAL_PROTECTION
|
|
97
|
+ static int thermal_runaway_bed_state_machine;
|
|
98
|
+ static unsigned long thermal_runaway_bed_timer;
|
|
99
|
+ #endif
|
95
|
100
|
#endif
|
96
|
101
|
|
97
|
102
|
//===========================================================================
|
|
@@ -650,7 +655,7 @@ void manage_heater() {
|
650
|
655
|
|
651
|
656
|
#if TEMP_SENSOR_BED != 0
|
652
|
657
|
|
653
|
|
- #if defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0
|
|
658
|
+ #if HAS_BED_THERMAL_PROTECTION
|
654
|
659
|
thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, 9, THERMAL_RUNAWAY_PROTECTION_BED_PERIOD, THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS);
|
655
|
660
|
#endif
|
656
|
661
|
|
|
@@ -1008,7 +1013,7 @@ void setWatch() {
|
1008
|
1013
|
#endif
|
1009
|
1014
|
}
|
1010
|
1015
|
|
1011
|
|
-#if defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
|
|
1016
|
+#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
|
1012
|
1017
|
void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc)
|
1013
|
1018
|
{
|
1014
|
1019
|
/*
|