The TRReset state is not needed with fall-through
This commit is contained in:
		| @@ -1048,12 +1048,9 @@ void Temperature::init() { | |||||||
|  |  | ||||||
|     // If the target temperature changes, restart |     // If the target temperature changes, restart | ||||||
|     if (tr_target_temperature[heater_index] != target_temperature) |     if (tr_target_temperature[heater_index] != target_temperature) | ||||||
|       *state = TRReset; |       *state = TRInactive; | ||||||
|  |  | ||||||
|     switch (*state) { |     switch (*state) { | ||||||
|       case TRReset: |  | ||||||
|         *timer = 0; |  | ||||||
|         *state = TRInactive; |  | ||||||
|       // Inactive state waits for a target temperature to be set |       // Inactive state waits for a target temperature to be set | ||||||
|       case TRInactive: |       case TRInactive: | ||||||
|         if (target_temperature <= 0) break; |         if (target_temperature <= 0) break; | ||||||
|   | |||||||
| @@ -358,17 +358,17 @@ class Temperature { | |||||||
|  |  | ||||||
|     #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED |     #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); |       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) |       #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 }; |         millis_t thermal_runaway_timer[EXTRUDERS] = { 0 }; | ||||||
|       #endif |       #endif | ||||||
|  |  | ||||||
|       #if HAS_THERMALLY_PROTECTED_BED |       #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; |         millis_t thermal_runaway_bed_timer; | ||||||
|       #endif |       #endif | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user