From 9b92bb8f31217cf785979a7f24ea74f6b574942e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 8 May 2016 17:07:45 -0700 Subject: [PATCH] Set the initial state based on target temperature --- Marlin/temperature.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 8879b4737f..19e66c6742 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1047,15 +1047,14 @@ void Temperature::init() { int heater_index = heater_id >= 0 ? heater_id : EXTRUDERS; // If the target temperature changes, restart - if (tr_target_temperature[heater_index] != target_temperature) - *state = TRInactive; + if (tr_target_temperature[heater_index] != target_temperature) { + tr_target_temperature[heater_index] = target_temperature; + *state = target_temperature > 0 ? TRFirstHeating : TRInactive; + } switch (*state) { // Inactive state waits for a target temperature to be set - case TRInactive: - if (target_temperature <= 0) break; - tr_target_temperature[heater_index] = target_temperature; - *state = TRFirstHeating; + case TRInactive: break; // When first heating, wait for the temperature to be reached then go to Stable state case TRFirstHeating: if (temperature < tr_target_temperature[heater_index]) break;