Fix testing of runaway options in temperature.cpp

This commit is contained in:
Scott Lahteine 2015-05-10 23:03:24 -07:00
parent 2b92b01afc
commit 8332a15899

View file

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