Turn off LED L3 only when all channels have no PID

Change the behaviour of LED L3 to turn off only when all channels have
PID disengaged, as opposed to when any channel disengages PID.

This makes LED L3 better reflect the status of the Thermostat as a
whole, as it now indicates PID engagement on any channel.
This commit is contained in:
atse 2023-08-07 13:28:51 +08:00
parent cd680dd6cd
commit 0aa1d43a13
1 changed files with 4 additions and 1 deletions

View File

@ -187,7 +187,10 @@ impl Handler {
match pin {
PwmPin::ISet => {
channels.channel_state(channel).pid_engaged = false;
leds.g3.off();
// Only turn off LED when PID is disengaged on all channels
if !channels.channel_state(channel ^ 1).pid_engaged {
leds.g3.off();
}
let current = ElectricCurrent::new::<ampere>(value);
channels.set_i(channel, current);
channels.power_up(channel);