Skip to content

The recording heartbeat survives disconnect — the board re-arms it - #23

Merged
lkasso merged 1 commit into
mainfrom
led-heartbeat
Jul 20, 2026
Merged

The recording heartbeat survives disconnect — the board re-arms it#23
lkasso merged 1 commit into
mainfrom
led-heartbeat

Conversation

@lkasso

@lkasso lkasso commented Jul 20, 2026

Copy link
Copy Markdown
Member

The parked follow-up from the group-logging cycle. Field evidence showed the LED pattern + play bytes were correct but the firmware kills LED playback when the link drops — so unattended boards never blinked.

Fix: the board re-arms its own heartbeat. Group start records two disconnect events (Settings 0x0A, revision ≥ 2): re-set the red pattern, then play. Every link drop relights the blink with no phone involved; the immediate setLED covers the connected window so indication is continuous across the handoff.

Cleanup is the load-bearing part: disconnect-event bindings live on the board and outlive app sessions — an un-removed pair would relight the LED on every future disconnect, forever. The event ids are stamped onto the board's pending records (ledEventIDsJSON, lightweight local-only migration), and the collect pass removes them right after stopping the LED — resolving ids from the records, so cleanup survives app restarts. Everything is best-effort: the heartbeat is a courtesy and can never fail a logging session.

SDK: MWEvent gains a public init(id:) for reconstructing persisted handles.

Hardware check: start a group → pocket the boards → they should blink red every 5 s while disconnected; Stop & Download All → blinking stops and stays stopped across subsequent connects/disconnects. Full app suite + 1058 SPM tests green.

🤖 Generated with Claude Code

Follow-up to the group-logging cycle: the LED pattern and play were
byte-perfect on the wire, but the firmware stops LED playback the
moment the link drops, so unattended boards never blinked.

The board now re-arms its own heartbeat: group start records two
DISCONNECT EVENTS (Settings 0x0A, revision ≥ 2) — re-set the red
pattern, then play — so every link drop relights the blink with no
phone involved. The immediate setLED still covers the connected
window, giving continuous indication across the handoff.

The event ids are stamped onto the board's LogSessionRecords
(ledEventIDsJSON, lightweight local-only migration) because the
bindings OUTLIVE app sessions: an un-removed pair would relight the
LED on every future disconnect forever. The collect pass tears them
down right after stopping the LED, resolving ids from the records so
cleanup survives app restarts. All best-effort — the heartbeat is a
courtesy and can never fail a logging session.

MWEvent gains a public init(id:) so persisted handles can be
reconstructed for removal — bindings live on the board, not in the
process.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lkasso
lkasso merged commit d6ba896 into main Jul 20, 2026
6 checks passed
@lkasso
lkasso deleted the led-heartbeat branch July 20, 2026 04:12
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.

1 participant