Update LED L3 for PID status on every cycle #81

Merged
sb10q merged 1 commits from atse/thermostat:update-l3-led-every-cycle into master 2023-08-10 17:00:16 +08:00
2 changed files with 6 additions and 5 deletions

View File

@ -178,7 +178,6 @@ impl Handler {
fn engage_pid (socket: &mut TcpSocket, channels: &mut Channels, leds: &mut Leds, channel: usize) -> Result<Handler, Error> {
channels.channel_state(channel).pid_engaged = true;
leds.g3.on();
send_line(socket, b"{}");
Ok(Handler::Handled)
}
@ -187,10 +186,6 @@ impl Handler {
match pin {
PwmPin::ISet => {
channels.channel_state(channel).pid_engaged = false;
// Only turn off LED when PID is disengaged on all channels
if !channels.pid_engaged() {
leds.g3.off();
}
let current = ElectricCurrent::new::<ampere>(value);
channels.set_i(channel, current);
channels.power_up(channel);

View File

@ -188,6 +188,12 @@ fn main() -> ! {
fan_ctrl.cycle(channels.current_abs_max_tec_i() as f32);
if channels.pid_engaged() {
leds.g3.on();
} else {
leds.g3.off();
}
let instant = Instant::from_millis(i64::from(timer::now()));
cortex_m::interrupt::free(net::clear_pending);
server.poll(instant)