Skip to content

Conversation

@ericyanush
Copy link

@ericyanush ericyanush commented Aug 4, 2025

A WIP implementation of the Hardware Scales mod.

Overview

What's included:

  • Integration of two HX711 modules with shared clock line (tested on GM Pro v1)
  • Taring of scales
  • Calibrating individual load cells
  • Basic reading averaging
  • HX711 power down
  • Integration of Hardware scale into display firmware
    • HardwareScalePlugin added
    • Combine with BLEScalePlugin / adjust BLEScalePlugin
    • Hardware scale calibration factors settings
    • WebUI for performing scale calibration
    • Add tare button to WebUI dashboard?
    • Add live weight display to brewing "start" screen?
    • Add tare button to brewing "start" screen?

Open questions / Feedback needed

Some notes, and places I'd like some feedback:

  1. Feedback on changes to the WebUI would be especially appreciated; my experience with React is quite low 🙈
  2. I added the display of the current weight to the status and chart views on the webui home page, mostly out of convenience for testing as the currently weight doesn't show anywhere else.
  3. I have the new code for LED / ToF commented out of the controller startup, as their use of the 5-pin port interferes with the HX711's. The HX711 uses a two wire serial (SPI like) signalling protocol, which isn't compatible with the I2C that is being used on other expansion boards.
  4. I'm currently piggybacking on the BLE volumetric measurement source. A third source could be added rather easily, but for the sake of proving out the rest of implementation, I took the easy path forward.
  5. I currently have the BLEScalePlugin disabled in (commented out the register plugin call) in the display firmware. Right now the BLEScalePlugin makes the assumption that it is the only source of enabling and disabling volumetric overrides, and updates the status of the override in its runloop. I see two possible paths forward here:
    a. Combine the BLEScalePlugin and the HardwareScalePlugin into a single plugin that allows for only one type of scale to be active at a time.
    b. Change the type of the volumetric override from a bool to an enum that indicates what the source of the override is, then in the setVolumetricOverride method, check to see if the source of the change request matches the currently configured one, something like:
enum VolumetricOverrideSource {
    NONE,
    BLUETOOTH,
    HARDWARE_SCALE,
};

void setVolumetricOverride(bool override, VolumetricOverrideSource source) {
    if (_override == source || _override == NONE) {
       _override = override ? source : NONE;
    }
}

Testing

I've completed all my testing on a GCP E24 with GM Pro v1.

Test setup:

  • Hardware scale mod, using mostly standard parts found in the printables project (I had to narrow up the low profile drip tray adapter to fit the LP drip tray I purchased from Aliexpress).
  • Hardware scales with two discrete "green" HX711 boards.
    • HX711 boards modified with a 4.7K/10K voltage divider on the DT lines to ensure that we don't expose the ESP32 on the controller board to more than ~3.4V. Alternatively a bi-directional MOSFET type level shifter could be used, but without easy access to a 3.3V source, the voltage divider is simpler to implement.

Test notes:

  • The predictive scale feature is rather aggressive in my testing, and I've had to lower its time interval to 200ms to not dramatically undershoot the target weights.

Also removed bit filtering, as it didn't seem to make a significant difference, although more testing is required to validate
More work is required, as I currently have the BLE scale plugin disabled to not interfere
…t weight to overview and chart, needs review.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

… for scale interactions, add tare button on process controls widget.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 5, 2025

@jniebuhr jniebuhr added this to the v1.7.0 milestone Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants