Fix stale scale notification recovery - #351
Open
ODevStudio wants to merge 3 commits into
Open
ODevStudio wants to merge 3 commits into
ODevStudio wants to merge 3 commits into
Conversation
ODevStudio
marked this pull request as ready for review
July 27, 2026 15:09
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.
Failure sequence
DE1app retained an HDS BLE handle whose control writes still succeeded, including heartbeats, tare, and timer commands, but no FFF4
0xCEweight notifications arrived. The first-update watchdog retried notification enable ten times, abandoned recovery, and left the stale handle connected. Power cycling and reconnecting restored weight updates, while the UI could continue to showWEIGHT WAIT.Root cause
The first-update watchdog was not tied to the handle it watched and only cancelled itself after retry exhaustion. Disconnect cleanup was also not idempotent or handle-aware, so a delayed disconnect callback for the stale handle could clear or close a replacement connection. Weight packets were likewise processed without verifying that they belonged to the active handle. Scale-dependent controls and the weight UI used the BLE connection handle rather than confirmed live weight reporting.
Behavior change
0xCEweight packet from the active handle.0xCAweights from clearing the wait state.Tests
C:\Program Files\Git\mingw64�in clsh.exe tests\scale_watchdog.test.tcl(9 passed)git diff --checkde1app-textmode.tclstartup reached the REPL and exited cleanly; the local environment still reports its pre-existing missinglambdaandblepackages.Coverage includes retry exhaustion, stale watchdog handles, duplicate disconnect callbacks, stale disconnects while a replacement is connecting or connected, cached
0xCAprocessing without operational state, active-handle0xCEprocessing, and stale-handle0xCErejection beforeprocess_weight_update. The disconnect cases exercise the realscale_disconnect_handler; packet tests record weight-processing calls.