Skip to content

data: clear _rtcValid when bridge disconnects#29

Open
Swissola wants to merge 3 commits into
anthropics:mainfrom
Swissola:fix/rtc-valid-on-disconnect
Open

data: clear _rtcValid when bridge disconnects#29
Swissola wants to merge 3 commits into
anthropics:mainfrom
Swissola:fix/rtc-valid-on-disconnect

Conversation

@Swissola
Copy link
Copy Markdown

Summary

  • Track wasConnected before each dataPoll() connection check
  • Clear _rtcValid on the connected → disconnected transition

Motivation

_rtcValid was set when the bridge sent a time sync and never cleared when the bridge went offline. The clock face continued to show even with no live NTP source backing it. If the device stayed on for hours after the bridge closed, the displayed time was drifting further from reality with no visual indication that the sync had been lost.

Clearing on disconnect means the clock only shows while a bridge has verified the time in the current session.

Behaviour after this change

  • Clock disappears when bridge disconnects (same as before first sync)
  • On reconnect, bridge re-sends time sync → clock reappears with fresh verified time
  • Behaviour during a connected session is unchanged

Test plan

  • Bridge connected — clock shows normally
  • Close bridge — clock face disappears
  • Reconnect bridge — clock reappears once time sync packet arrives
  • Normal RTC-synced session unaffected

🤖 Generated with Claude Code

Swissola and others added 3 commits May 22, 2026 17:37
sleep=Donald Duck, idle=Bongo Cat, busy=SpongeBob multitasking,
attention=Surprised Pikachu (Nouns glasses), celebrate=Peanuts party,
dizzy=Powerpuff Girls spiral eyes, heart=heart eyes ghost.

Source GIFs in characters/memes-src/, device-ready pack in characters/memes/.
Built with prep_character.py at 96x98px, 64 colours per frame.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Track the current peer BD address in onConnect (extended overload).
bleRemoveCurrentBond() removes only that peer's LTK from NVS. The
"unpair" JSON command now calls this instead of bleClearBonds(), so
each host unpairs itself independently. bleClearBonds() is reserved
for factory reset only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
_rtcValid was never cleared when the bridge went offline, so the clock face
continued to display even after the NTP source was gone. Clear the flag on
the connected->disconnected transition so the next reconnect must receive a
fresh time sync before the clock reappears.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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