Skip to content

BLE Ghost connect fix#2333

Draft
gjelsoe wants to merge 1 commit intomeshcore-dev:devfrom
gjelsoe:blue-ghost-connect-fix
Draft

BLE Ghost connect fix#2333
gjelsoe wants to merge 1 commit intomeshcore-dev:devfrom
gjelsoe:blue-ghost-connect-fix

Conversation

@gjelsoe
Copy link
Copy Markdown

@gjelsoe gjelsoe commented Apr 19, 2026

Fix BLE ghost connection state after reset/DFU/Update

More testing might be needed, hence the draft.

Problem

After a firmware update or reset, the device could get stuck believing it was still connected to a BLE client, preventing new connections.

Root Causes

  1. onDisconnect() did not reset deviceConnected unconditionally, leaving stale state if disconnect occurred before enable() was called.
  2. onAuthenticationComplete() set deviceConnected = true even when _isEnabled was false, allowing a bonded phone to ghost-connect before the device was ready.
  3. deviceConnected, oldDeviceConnected and adv_restart_time were not explicitly reset in begin(), leaving potential stale RAM state.

Fix

  • Always reset deviceConnected = false in onDisconnect() regardless of _isEnabled
  • Guard deviceConnected = true in onAuthenticationComplete() behind _isEnabled, disconnecting the peer if not yet enabled
  • Explicitly reset connection state variables in begin()

Changes

  • SerialBLEInterface.cpponDisconnect(), onAuthenticationComplete(), begin()

Test Device

  • Heltec v4.2

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