Set the initial state based on target temperature
This commit is contained in:
parent
6b13c430ae
commit
9b92bb8f31
@ -1047,15 +1047,14 @@ void Temperature::init() {
|
|||||||
int heater_index = heater_id >= 0 ? heater_id : EXTRUDERS;
|
int heater_index = heater_id >= 0 ? heater_id : EXTRUDERS;
|
||||||
|
|
||||||
// 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 = TRInactive;
|
tr_target_temperature[heater_index] = target_temperature;
|
||||||
|
*state = target_temperature > 0 ? TRFirstHeating : TRInactive;
|
||||||
|
}
|
||||||
|
|
||||||
switch (*state) {
|
switch (*state) {
|
||||||
// Inactive state waits for a target temperature to be set
|
// Inactive state waits for a target temperature to be set
|
||||||
case TRInactive:
|
case TRInactive: break;
|
||||||
if (target_temperature <= 0) break;
|
|
||||||
tr_target_temperature[heater_index] = target_temperature;
|
|
||||||
*state = TRFirstHeating;
|
|
||||||
// When first heating, wait for the temperature to be reached then go to Stable state
|
// When first heating, wait for the temperature to be reached then go to Stable state
|
||||||
case TRFirstHeating:
|
case TRFirstHeating:
|
||||||
if (temperature < tr_target_temperature[heater_index]) break;
|
if (temperature < tr_target_temperature[heater_index]) break;
|
||||||
|
Loading…
Reference in New Issue
Block a user