Conversation
Use FlowMap bilinear interpolation for RPM→flow, add RpmSensor, and adjust pressure control
|
We require contributors to sign our Contributor License Agreement, and we don't have yours on file. In order for us to review and merge your code, please contact @jniebuhr (mdwasp) on Discord to get yourself added. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f57aed24b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| void DimmedPump::updatePower() { | ||
| // Update controller output and apply power to SSR + DAC. | ||
| _pressureController.update(static_cast<PressureController::ControlMode>(_mode)); | ||
|
|
||
| if (_mode != ControlMode::POWER) { | ||
| _power = _controllerPower; | ||
| } | ||
|
|
||
| _power = std::clamp(_power, 0.0f, 100.0f); | ||
|
|
||
| _psm.set(static_cast<int>(_power)); | ||
| mcp->setVoltage(MCP_VOLTAGE * _power / 100.0f); | ||
| } | ||
|
|
||
| void DimmedPump::setPower(float setpoint) { | ||
| _mode = ControlMode::POWER; | ||
| _power = std::clamp(setpoint, 0.0f, 100.0f); | ||
| _ctrlPressure = (_power > 0.0f) ? 20.0f : 0.0f; | ||
| } |
There was a problem hiding this comment.
Sync manual power into controller state
In POWER mode, updatePower() always runs _pressureController.update(...) before applying _power, but setPower() no longer propagates the manual setpoint into _controllerPower. As a result, the controller continues using a stale _controllerPower for flow/volume estimation (and related telemetry) while the actual pump output follows _power, so after switching to POWER mode the reported flow/coffee volume can stay at 0 or a previous value even though the pump is running. This regression only appears when operating in manual power mode; consider setting _controllerPower = _power in setPower() (or before the update call when _mode == POWER) so estimates track the real output.
Useful? React with 👍 / 👎.
Add inline documentation for feedforward plumbing and BLE Kf handling
|
We require contributors to sign our Contributor License Agreement, and we don't have yours on file. In order for us to review and merge your code, please contact @jniebuhr (mdwasp) on Discord to get yourself added. |
|


With these changes, the objective is to improve the performance of the gear pump allowing to read the pulses from the pump ESC tacho pin. It counts time between pulses to infiere RPM (2 pulses per revolution, on falling from 5v to 80mv), It is coded to read pulses in the GPIO 13. From there on flowmap using the gear pump datasheet is inferred the actual flow using interpolation of the flow curves (intersection from RPM and pressure), then it converts ml/min to ml/sec, and feed this info into dimmed pump and pressure controller. With all these changes it should allow for a smooth pressure control tailored to the MPB 015 24V 70W Gear Pump. Since all this code was written by IA it's prone to have errors, so is to be treated as experimental.