Skip to content

Commit

Permalink
Implement idling, locking, and unlocking states
Browse files Browse the repository at this point in the history
  • Loading branch information
acodili-jg committed May 13, 2024
1 parent 4162b19 commit 0099ce6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
25 changes: 24 additions & 1 deletion src/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
}
1 change: 1 addition & 0 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ pub enum State {
SetupSeparatorClosing,
Idling,
Locking,
Unlocking,
}

0 comments on commit 0099ce6

Please sign in to comment.