Commit e953baa7 authored by Philippe Kalaf's avatar Philippe Kalaf

Added soft stop feature

parent ad95fb2d
...@@ -337,10 +337,16 @@ void BrewControl::stop() ...@@ -337,10 +337,16 @@ void BrewControl::stop()
_shot_clock = 0; _shot_clock = 0;
} }
void BrewControl::soft_stop()
{
_pump_control.set_level(0);
_soft_stop_timer.attach(callback(this, &BrewControl::stop), 7.0);
}
bool BrewControl::toggle() bool BrewControl::toggle()
{ {
if(_state) if(_state)
stop(); soft_stop();
else else
start(); start();
......
...@@ -98,6 +98,8 @@ public: ...@@ -98,6 +98,8 @@ public:
uint8_t start(); uint8_t start();
/// Stop brewing /// Stop brewing
void stop(); void stop();
/// Stop brewing with reduced backflush
void soft_stop();
/// Enable PID boiler control /// Enable PID boiler control
void enable_boiler(); void enable_boiler();
...@@ -118,6 +120,9 @@ private: ...@@ -118,6 +120,9 @@ private:
// Pump phase controller for pressure control // Pump phase controller for pressure control
PhaseControl _pump_control; PhaseControl _pump_control;
// Soft stop reduces backflush
Timeout _soft_stop_timer;
// Pressure Sensor // Pressure Sensor
PressureSensor _pressure_sensor; PressureSensor _pressure_sensor;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
FHKSC::FHKSC(PinName pin) : _interrupt(pin) { // create the InterruptIn on the pin specified to FHKSC FHKSC::FHKSC(PinName pin) : _interrupt(pin) { // create the InterruptIn on the pin specified to FHKSC
_interrupt.mode(PullDown); // an internal pull up is used, otherwise disable here _interrupt.mode(PullDown); // an internal pull up is used, otherwise disable here
_interrupt.rise(callback(this, &FHKSC::increment)); // attach increment function of this counter instance _interrupt.rise(callback(this, &FHKSC::increment)); // attach increment function of this counter instance
_flow_rate_timer.start(); _flow_rate_timer.start();
_time_last_increment_us = 0; _time_last_increment_us = 0;
} }
...@@ -50,6 +50,9 @@ uint32_t FHKSC::read_ul() ...@@ -50,6 +50,9 @@ uint32_t FHKSC::read_ul()
void FHKSC::reset_count() void FHKSC::reset_count()
{ {
_flow_ul = 0; _flow_ul = 0;
// reset timer since it can only run for 30 mins
_flow_rate_timer.reset();
_time_last_increment_us = 0;
} }
// flow rate in ml per second // flow rate in ml per second
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment