Skip to content

Fix bonded BLE reconnects on ESP32#3005

Merged
ripplebiz merged 1 commit into
meshcore-dev:devfrom
axhoff:agent/fix-ble-reconnect
Jul 21, 2026
Merged

Fix bonded BLE reconnects on ESP32#3005
ripplebiz merged 1 commit into
meshcore-dev:devfrom
axhoff:agent/fix-ble-reconnect

Conversation

@axhoff

@axhoff axhoff commented Jul 20, 2026

Copy link
Copy Markdown

Summary

  • make ESP32 BLE connection state event-driven
  • clear the usable connection flag in the disconnect callback
  • stop overwriting successful authentication with a lagging server connection count

Root cause

On some bonded Android reconnects, onAuthenticationComplete() ran before the BLE server updated its internal connected count. The authentication callback set deviceConnected, but checkRecvFrame() immediately observed a stale count of zero and cleared it permanently. The BLE link remained connected while writeFrame() refused to send responses.

Scope

This keeps successful authentication as the event that enables frame writes and uses the existing disconnect callback as the event that disables them. Advertising restart timing, pairing requirements, frame queues, and protocol behavior are unchanged.

Validation

  • git diff --check
  • pio run -e Xiao_S3_WIO_companion_radio_ble
  • rigorous Fable adversarial review: approved with no actionable findings

Fixes #2963

@axhoff
axhoff marked this pull request as ready for review July 20, 2026 14:51
@ripplebiz
ripplebiz merged commit 4157e43 into meshcore-dev:dev Jul 21, 2026
15 checks passed
hermes-gadget added a commit to gadgethd/MeshCore-MQTT that referenced this pull request Jul 22, 2026
Upstream dev: 7ecb2cb..78240e9 (6 commits)
3885c67 fix: synchronize BLE receive queue
9fd6b41 fix: preserve bonded BLE reconnects
4d4d7c3 refactor: use FreeRTOS BLE receive queue
8b048ab Merge pull request meshcore-dev#3007
4157e43 Merge pull request meshcore-dev#3005
78240e9 optimised: value-init not needed

Clean auto-merge (no conflicts). MQTT additions preserved.
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.

2 participants