|
|
@ -73,14 +73,14 @@ unsigned char soft_pwm_bed; |
|
|
|
int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED |
|
|
|
#if defined(THERMAL_PROTECTION_HOTENDS) || defined(THERMAL_PROTECTION_BED) |
|
|
|
enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway }; |
|
|
|
void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); |
|
|
|
#if THERMAL_PROTECTION_HOTENDS |
|
|
|
#ifdef THERMAL_PROTECTION_HOTENDS |
|
|
|
static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset }; |
|
|
|
static millis_t thermal_runaway_timer[4]; // = {0,0,0,0};
|
|
|
|
#endif |
|
|
|
#if THERMAL_PROTECTION_BED |
|
|
|
#ifdef THERMAL_PROTECTION_BED |
|
|
|
static TRState thermal_runaway_bed_state_machine = TRReset; |
|
|
|
static millis_t thermal_runaway_bed_timer; |
|
|
|
#endif |
|
|
@ -609,7 +609,7 @@ void manage_heater() { |
|
|
|
// Loop through all extruders
|
|
|
|
for (int e = 0; e < EXTRUDERS; e++) { |
|
|
|
|
|
|
|
#if THERMAL_PROTECTION_HOTENDS |
|
|
|
#ifdef THERMAL_PROTECTION_HOTENDS |
|
|
|
thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS); |
|
|
|
#endif |
|
|
|
|
|
|
@ -673,7 +673,7 @@ void manage_heater() { |
|
|
|
|
|
|
|
#if TEMP_SENSOR_BED != 0 |
|
|
|
|
|
|
|
#if THERMAL_PROTECTION_BED |
|
|
|
#ifdef THERMAL_PROTECTION_BED |
|
|
|
thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS); |
|
|
|
#endif |
|
|
|
|
|
|
@ -1014,7 +1014,7 @@ void tp_init() { |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED |
|
|
|
#if defined(THERMAL_PROTECTION_HOTENDS) || defined(THERMAL_PROTECTION_BED) |
|
|
|
|
|
|
|
void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) { |
|
|
|
|
|
|
|