Repository navigation
Fix Battery Guard BM6 empty realtime replies - #412
Merged
fl4p merged 1 commit intoSep 16, 2026
Merged
Conversation
fl4p
added a commit
that referenced
this pull request
Sep 16, 2026
The fallback ordering from #412 was latched for good by any sentinel frame and never retried the default one: * _empty_realtime was set from any notification, including one arriving outside a pending request — connect() subscribes before the first write, so a single stray sentinel pinned a working BM6 onto the untested path until restart. It is now cleared at the start of every realtime request and on connect. * If the fallback ordering also stops answering, every poll re-entered it and timed out. A timeout there now clears the preference, so the next poll uses the default ordering again. * _q_write_before_notify unsubscribed, wrote, then re-subscribed with no try/finally, so a raising write left FFF4 unsubscribed for the rest of the connection. * On the sentinel, _q cancelled the response waiter immediately and discarded a real frame arriving a few tens of ms later; it now keeps waiting for EMPTY_REALTIME_GRACE before falling back.
Owner
|
Merged, with a follow-up in a999a5b that makes the fallback recoverable. The sentinel detection and the ordering switch are yours, unchanged — what I changed is the state around them:
Your two state-machine tests still pass as written; three more cover the stray sentinel, the revert, and the failed write. Ships in 2.21. |
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
Why
Battery Guard devices can answer the normal notify-before-write flow with an empty
d15507ff...realtime frame and subsequently expose 0 V / 0% samples. The fallback is activated only after that exact sentinel because BM6 is a shared decoder used by other device variants.Tests
Fixes #410