diff --git a/src/duration.rs b/src/duration.rs index f1e5895..e31717b 100644 --- a/src/duration.rs +++ b/src/duration.rs @@ -18,7 +18,7 @@ constants! { LOCKING = DEFAULT_SHORT; MIXING = DEFAULT_LONG; RINSING = DEFAULT_LONG; - SEPARATOR_HOLDING = DEFAULT; + SEPARATOR_HOLDING = DEFAULT_LONG; SEPARATOR_TRANSITION = DEFAULT; SOAK_WATER_PUMPING = DEFAULT_LONG; } diff --git a/src/sketch.rs b/src/sketch.rs index 4a29eae..656b669 100644 --- a/src/sketch.rs +++ b/src/sketch.rs @@ -333,7 +333,30 @@ impl Sketch { self.ready.set_high(); } - _ => { /* TODO */ } + State::Idling if self.start.is_high() => {} + State::Idling => { + transition_to!(Locking); + self.input_hatch_lock_direction.set_low(); + self.input_hatch_lock_enable.set_high(); + } + + State::Locking if self.start.is_high() => { + transition_to!(Unlocking); + self.input_hatch_lock_direction.set_high(); + } + State::Locking if delta_ms < duration::LOCKING => {} + State::Locking => { + transition_to!(SoakWaterPumping); + self.ready.set_low(); + self.input_hatch_lock_enable.set_low(); + self.water_pump.set_high(); + } + + State::Unlocking if delta_ms < duration::LOCKING => {} + State::Unlocking => { + transition_to!(Idling); + self.input_hatch_lock_enable.set_low(); + } } } } diff --git a/src/state.rs b/src/state.rs index e0323ed..ea28ad9 100644 --- a/src/state.rs +++ b/src/state.rs @@ -25,4 +25,5 @@ pub enum State { SetupSeparatorClosing, Idling, Locking, + Unlocking, }