-
-
Notifications
You must be signed in to change notification settings - Fork 160
Description
Describe the feature
Introduce a new flow feedback mode that uses scale measured puck outflow (g/s) as the control feedback instead of relying solely on the pump flow estimate from pumpFlowModel(). At the same time, refactor the interaction between flow and pressure control so that pressure acts as a duty ceiling rather than a competing controller (min(duty_flow, duty_pressure)).
This requires:
• A profile option: FlowFeedbackMode = PUMP | PUCK
• Using d(weight)/dt from the Bluetooth scale as flow feedback when available
• Making pumpFlowModel() pressure-aware: Q = f(duty, pressure)
Changing the control merge from:
duty = min(duty_flow, duty_pressure)
to:
duty = clamp(duty_flow, 0, duty_ceiling_from_pressure)
• (Optionally) tracking temporary puck water storage to better model delayed outflow as the puck degrades during the shot
This preserves current behavior by default while enabling a new, more physically correct control mode when a scale is present.
Why is this feature useful?
Right now, flow control regulates estimated pump inflow, while users care about actual puck outflow into the cup. During real shots, especially when the puck breaks down or when the shot hits the pressure limit, the two diverge significantly.
This causes a failure mode where:
• The profile requests e.g. 2 g/s flow
• The shot hits the 9 bar pressure limit
• The controller believes it is respecting the flow limit (based on the pump model)
• The scale shows 3 g/s or more in the cup
The system does not distinguish between:
• Water entering the puck (pump flow)
• Water leaving the puck (puck flow)
By using scale flow as feedback and making pressure a constraint instead of a competing command:
• Flow control regulates cup output
• Pressure limiting no longer causes flow integrator wind-up and later surges
• Shots that hit the pressure ceiling remain within the intended flow envelope
• Logs and tuning become much more transparent and intuitive
• The system behavior better matches the real physics of puck wetting and breakdown
This results in more stable shots, fewer unexplained flow spikes, and a control model that matches how espresso extraction actually behaves.
How complex is this feature?
Medium - Requires some changes
Additional context
Branch created for testing:
https://github.com/KT-0001/gaggimate/tree/feature/puck-flow-feedback