Pārlūkot izejas kodu

Set the initial state based on target temperature

Scott Lahteine 8 gadus atpakaļ
vecāks
revīzija
9b92bb8f31
1 mainītis faili ar 5 papildinājumiem un 6 dzēšanām
  1. 5
    6
      Marlin/temperature.cpp

+ 5
- 6
Marlin/temperature.cpp Parādīt failu

@@ -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;

Notiek ielāde…
Atcelt
Saglabāt