Skip to content

Commit

Permalink
Only use WATCH_*TEMP_PERIOD where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
scalez committed Apr 26, 2016
1 parent 1120eca commit abc3bc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Marlin/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@
*/
#if WATCH_TEMP_PERIOD > 500
#error WATCH_TEMP_PERIOD now uses seconds instead of milliseconds.
#elif (DISABLED(THERMAL_PROTECTION_HOTENDS) || WATCH_TEMP_PERIOD <= 0) && (defined(WATCH_TEMP_PERIOD) || (defined(THERMAL_PROTECTION_PERIOD) && WATCH_TEMP_PERIOD > 0))
#elif DISABLED(THERMAL_PROTECTION_HOTENDS) && (defined(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD))
#error Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS.
#elif (DISABLED(THERMAL_PROTECTION_BED) || WATCH_BED_TEMP_PERIOD <= 0) && (defined(WATCH_BED_TEMP_PERIOD) || (defined(THERMAL_PROTECTION_BED_PERIOD) && WATCH_BED_TEMP_PERIOD > 0))
#elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD)
#error Thermal Runaway Protection for the bed is now enabled with THERMAL_PROTECTION_BED.
#elif ENABLED(COREXZ) && ENABLED(Z_LATE_ENABLE)
#error "Z_LATE_ENABLE can't be used with COREXZ."
Expand Down
12 changes: 6 additions & 6 deletions Marlin/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ unsigned char soft_pwm_bed;
int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only
#endif

#if (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) || (ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0)
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(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 ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
#if ENABLED(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 (ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0) && TEMP_SENSOR_BED != 0
#if ENABLED(THERMAL_PROTECTION_BED) && TEMP_SENSOR_BED != 0
static TRState thermal_runaway_bed_state_machine = TRReset;
static millis_t thermal_runaway_bed_timer;
#endif
Expand Down Expand Up @@ -669,7 +669,7 @@ void manage_heater() {
// Loop through all extruders
for (int e = 0; e < EXTRUDERS; e++) {

#if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
#if ENABLED(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

Expand Down Expand Up @@ -751,7 +751,7 @@ void manage_heater() {

#if TEMP_SENSOR_BED != 0

#if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
#if ENABLED(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

Expand Down Expand Up @@ -1155,7 +1155,7 @@ void tp_init() {
}
#endif

#if (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) || (ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0)
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(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) {

Expand Down

0 comments on commit abc3bc1

Please sign in to comment.