fix: round Bengle scaled MMR writes - #604
Merged
Merged
Conversation
ODevStudio
marked this pull request as ready for review
August 12, 2026 13:20
tadelv
approved these changes
Aug 12, 2026
tadelv
left a comment
Member
There was a problem hiding this comment.
Implementation looks good and the scaling/rounding behavior is correct against tadelv/Bengle firmware (EndOfShotWeight is ×100, so 2.30 g must serialize as raw 230). I found no code-level blockers.
Suggestions for the PR body only:
- Reframe provenance: this rounding fix originally came from historical B-1/#459, not #462. #462 depended on it for
EndOfShotWeight, while merged #601 salvaged the relevant A013/SAW path. - Explicitly relate this PR to umbrella #469 and state that this is a targeted extraction from the old Bengle stack, not a continuation/acceptance of that stacked architecture.
- It would be clearer to say that the capability/scenario doc edits are post-#601 cleanup rather than part of the rounding bug itself.
- Uncheck the E2E-test box unless an actual running-app
simulate=1+ curl/websocat smoke was performed; the handler-level MockBengle smoke is useful but is not that E2E category.
Approved with those non-blocking documentation suggestions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Change Type (select all)
Scope (select all touched areas)
Linked Issues
Root Cause (if bug fix)
(value * scale).toInt()truncates binary floating-point products such as2.3 * 100, which can be represented just below 230.Regression Test Plan (if bug fix or refactor)
simulate=1+ curl/websocat)test/unit/models/device/impl/de1/unified_de1/protected_surface_test.dartendOfShotWeight = 2.3writes raw 230 while plain DE1setSteamFlow(2.3)remains raw 229.Documentation Obligations (required)
assets/api/rest_v1.ymlorassets/api/websocket_v1.yml(if REST/WebSocket changed)doc/Api.md(if user-facing endpoint changed)doc/Plugins.md(if events/API changed)doc/Skins.md(if skin behavior changed)doc/Profiles.md(if profile handling changed)doc/DeviceManagement.md(if device flows changed)Only the existing OpenAPI operation description and existing regression scenario were stale; endpoint behavior and user-facing API documentation did not change.
Security Impact (required)
Yes/No): NoYes/No): NoYes/No): NoYes/No): YesYes/No): NoYes/No): NoYes, explain risk and mitigation: protected non-DE1 scaled MMR payloads now use nearest-integer rounding. Existing kind and range checks remain, and a regression proves the private DE1 path is unchanged.User-Visible Changes
Bengle scaled capability values are encoded to the nearest firmware unit. Capability documentation now lists
cupWarmer,integratedScale,ledStrip, andstopAtWeight.Verification
Local gates (run before pushing)
dart format lib test- no remaining changesflutter analyze- clean (no new warnings)flutter test- all pass./scripts/fetch_dye2_plugin.sh- DYE2 plugin installed intoassets/plugins/dye2.reaplugin/Focused tests: 15 passed. The full suite ran to completion; its only failure was the pre-existing Windows CRLF-sensitive assertion in
test/connect_result_schema_test.dart.The fetch script could not be rerun because WSL startup is denied and
jqis unavailable in this Windows shell. The existing bundled DYE2 v0.1.4 manifest, API version, permissions, andcreatePluginentry point were validated locally.Manual verification (if applicable)
simulate=1): YescupWarmer,integratedScale,ledStrip, andstopAtWeight, and firmware-autonomous SAW returned the machine toidleat 36.17 g.universal_bleruntime incompatibilities.Evidence
Before the implementation change, the focused Bengle regression reported raw 229 instead of 230. Afterward all 15 focused tests passed.
Compatibility & Migration
Yes/No): YesYes/No): NoYes/No): NoNoorYes, explain exact steps: no migration or configuration changes are required.Risks & Mitigations