fix(scale): harden HDS sleeping reconnect follow-up - #882
Merged
Merged
Conversation
Follow up merged PR #867 against current OpenScale behavior. Reassert display-off after sleeping reconnects, retain only the prior sleep lifecycle capability evidence needed to finish that sleep safely, and require a post-wake status frame before confirming HDS SoftSleep exit. Add focused regressions for reconnect darkness/power-off and applied wake confirmation.
ODevStudio
force-pushed
the
fix/867-hds-sleep-reconnect
branch
from
September 15, 2026 16:09
7ce3431 to
cd428ca
Compare
ODevStudio
marked this pull request as ready for review
September 15, 2026 17:58
tadelv
approved these changes
Sep 15, 2026
tadelv
left a comment
Member
There was a problem hiding this comment.
Reviewed adversarially against AGENTS.md, the surrounding Decent Scale lifecycle code/tests, and OpenScale's disconnect behavior. The underlying issue is real: OpenScale can restore the display after BLE disconnect unless soft sleep is active, so retaining the sleep-time capability/profile state and reasserting Display Off on reconnect is appropriate. SoftSleep is correctly not reissued, normal data-channel/profile negotiation resumes on wake, and the added regression coverage exercises the relevant reconnect/wake paths. I did not find a merge-blocking correctness or architecture issue in this PR.
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
Follow-up to merged PR #867, based on review against the current
decentespresso/openscaleHDS firmware behavior.This draft addresses two lifecycle gaps:
displayOffwas therefore able to leave the physical display on while Decaid still considered the scale asleep. Sleeping reconnects now re-assert the shared0A 00display-off command.0A 04 00wake from the BLE callback and applies it later on the main loop. A successful GATT write therefore proves that wake was queued, not that it was applied. Decaid now keeps the SoftSleep-exit obligation until a post-wake status frame is observed; the existing bounded exit retry is reused when confirmation does not arrive.The sleeping lifecycle also retains the last positively negotiated power-off/SoftSleep capability evidence across the reconnect boundary. The ordinary per-connection profile still resets to conservative and is re-negotiated on wake, so this does not relax fresh-connection negotiation for normal awake connections.
OpenScale reference
Current OpenScale behavior used for this follow-up:
restoreDisplayAfterBleDisconnect(), which restores the display unlessb_softSleepis true.displayOn()queues a BLE status response, and main-loop pending commands are applied before the queued BLE status response is emitted.Tests
Added focused regressions for:
wakeDisplay()remaining pending until a post-wake HDS status frame arrives.Verification
flutter analyze --no-pub: no issues found.flutter test --no-pub --concurrency=1: 4255 passed, 1 skipped on Windows. Used the pinned plugin assets, QuickJS DLL and OpenSSL on PATH; serial execution avoids local port contention between web UI suites.git diff --check: clean.539caafd.Refs #867.
Linked Issue
N/A - maintainer follow-up to merged PR #867.
Impact
Sleeping HDS reconnects reassert display-off, and SoftSleep wake waits for status confirmation. No API/spec, database migration, skin, or plugin contract changes. The CI follow-up only updates the existing reconnect test helper to assert the exact display-off packet instead of expecting no writes.
Contributor Responsibility