From 6b13c430ae587c87f3d94485dbb7a16f905196f2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 8 May 2016 17:01:46 -0700 Subject: [PATCH] The TRReset state is not needed with fall-through --- Marlin/temperature.cpp | 5 +---- Marlin/temperature.h | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index a8f9c916f..8879b4737 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1048,12 +1048,9 @@ void Temperature::init() { // If the target temperature changes, restart if (tr_target_temperature[heater_index] != target_temperature) - *state = TRReset; + *state = TRInactive; switch (*state) { - case TRReset: - *timer = 0; - *state = TRInactive; // Inactive state waits for a target temperature to be set case TRInactive: if (target_temperature <= 0) break; diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 41e4ac16f..a178f1fed 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -358,17 +358,17 @@ class Temperature { #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED - typedef enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway } TRstate; + typedef enum TRState { TRInactive, TRFirstHeating, TRStable, TRRunaway } TRstate; 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) - TRState thermal_runaway_state_machine[EXTRUDERS] = { TRReset }; + TRState thermal_runaway_state_machine[EXTRUDERS] = { TRInactive }; millis_t thermal_runaway_timer[EXTRUDERS] = { 0 }; #endif #if HAS_THERMALLY_PROTECTED_BED - TRState thermal_runaway_bed_state_machine = TRReset; + TRState thermal_runaway_bed_state_machine = TRInactive; millis_t thermal_runaway_bed_timer; #endif