diff --git a/src/duration.rs b/src/duration.rs index 0ea6e26..8c40855 100644 --- a/src/duration.rs +++ b/src/duration.rs @@ -12,7 +12,8 @@ constants! { DEFAULT_SHORT = Millis(250); DRAINING = DEFAULT_LONG; + HEATING = DEFAULT_LONG; LOCKING = DEFAULT_SHORT; - SOAK_WATER_PUMPING = DEFAULT_LONG; SEPARATOR_TRANSITION = DEFAULT; + SOAK_WATER_PUMPING = DEFAULT_LONG; } diff --git a/src/sketch.rs b/src/sketch.rs index f78ba52..b0b0a17 100644 --- a/src/sketch.rs +++ b/src/sketch.rs @@ -73,7 +73,7 @@ impl Sketch { pub fn invoke(&mut self) { let curr_ms = millis(); let delta_ms = curr_ms.wrapping_sub(self.last_ms); - let _stop = self.stop.is_low(); + let stop = self.stop.is_low(); macro_rules! transition_to { ($state:ident) => { @@ -132,6 +132,11 @@ impl Sketch { self.water_pump.set_high(); } + State::SoakWaterPumping if stop => { + transition_to!(SoakWaterDraining); + self.upper_drain_pump.set_high(); + self.water_pump.set_low(); + } State::SoakWaterPumping if delta_ms < duration::SOAK_WATER_PUMPING => {} State::SoakWaterPumping => { transition_to!(SoakWaterHeating); @@ -139,6 +144,17 @@ impl Sketch { self.heater.set_high(); } + State::SoakWaterHeating if stop => { + transition_to!(SoakWaterDraining); + self.heater.set_low(); + self.upper_drain_pump.set_high(); + } + State::SoakWaterHeating if delta_ms < duration::HEATING => {} + State::SoakWaterHeating => { + transition_to!(SoakWaterHeatedMixing); + self.mixer.set_high(); + } + _ => { /* TODO */ } } }