1
0
Fork 0

Disallow automatic startup

If the start/stop switch is set before air pressure is present, do not
automatically start the process.  To start from such a situation, the
start/stop switch first needs to be turned off, then turned on again.
This commit is contained in:
rahix 2024-05-31 22:23:35 +02:00
parent b53b37845d
commit fa2d012fd3

View file

@ -41,13 +41,17 @@ pi::process_image! {
pub running: (X, 200, 0),
pub faulted: (X, 200, 1),
pub state: (X, 200, 2),
pub pressure_ok: (X, 200, 3),
}
}
fn program(inp: Pii, mut out: PiqMut, now: profirust::time::Instant) {
let now = u64::try_from(now.total_millis()).unwrap();
let running = inp.want_run() && (*out.running() || inp.bpb1());
let pressure_ok = inp.bpb1() && (*out.pressure_ok() || !inp.want_run());
*out.pressure_ok() = pressure_ok;
let running = inp.want_run() && (*out.running() || *out.pressure_ok());
let mut faulted = *out.faulted() && running;
*out.pza1_orange() = faulted;
*out.pza1_blue() = !running && !faulted;