From fa2d012fd3924318e4f1f713919bfdc0b964efe7 Mon Sep 17 00:00:00 2001 From: Rahix Date: Fri, 31 May 2024 22:23:35 +0200 Subject: [PATCH] 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. --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index a10dfe8..5817cd6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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;