Commit a2f424f9 authored by Philippe Kalaf's avatar Philippe Kalaf

Fix to the average pressure calculations

parent a68ad147
Pipeline #55089817 failed with stages
in 54 seconds
......@@ -318,9 +318,16 @@ void BrewControl::_log_brew_params()
#endif
// Internal helper function to set brew states properly
void BrewControl::_set_state(uint8_t state)
void BrewControl::_set_state(uint8_t new_state)
{
_state = state;
// Let's start the average pressure calculation when we start brewing
if ((_state == STOPPED || _state == PRE_INFUSING) && new_state == BREWING)
_pressure_sensor.start_count();
// Let's stop the average pressure calculation when we stop brewing
else if (_state == BREWING && (new_state == SOFT_STOPPING || new_state == STOPPED))
_average_pressure = _pressure_sensor.stop_count();
_state = new_state;
if (_state == BREWING || _state == STEAMING || _state == PRE_INFUSING)
_brew_worker_thread.flags_set(1);
}
......@@ -542,8 +549,7 @@ void BrewControl::soft_stop()
// Turn off pump
_pump_control.set_level(0);
// Stop pressure counter and shot clock
_average_pressure = _pressure_sensor.stop_count();
// shot clock
_shot_clock.stop();
_set_state(SOFT_STOPPING);
......
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