Browse Source

Set the initial state based on target temperature

Scott Lahteine 8 years ago
parent
commit
9b92bb8f31
1 changed files with 5 additions and 6 deletions
  1. 5
    6
      Marlin/temperature.cpp

+ 5
- 6
Marlin/temperature.cpp View File

@@ -1047,15 +1047,14 @@ void Temperature::init() {
1047 1047
     int heater_index = heater_id >= 0 ? heater_id : EXTRUDERS;
1048 1048
 
1049 1049
     // If the target temperature changes, restart
1050
-    if (tr_target_temperature[heater_index] != target_temperature)
1051
-      *state = TRInactive;
1050
+    if (tr_target_temperature[heater_index] != target_temperature) {
1051
+      tr_target_temperature[heater_index] = target_temperature;
1052
+      *state = target_temperature > 0 ? TRFirstHeating : TRInactive;
1053
+    }
1052 1054
 
1053 1055
     switch (*state) {
1054 1056
       // Inactive state waits for a target temperature to be set
1055
-      case TRInactive:
1056
-        if (target_temperature <= 0) break;
1057
-        tr_target_temperature[heater_index] = target_temperature;
1058
-        *state = TRFirstHeating;
1057
+      case TRInactive: break;
1059 1058
       // When first heating, wait for the temperature to be reached then go to Stable state
1060 1059
       case TRFirstHeating:
1061 1060
         if (temperature < tr_target_temperature[heater_index]) break;

Loading…
Cancel
Save