Repository navigation
v0.2.14 — Fix connectable BLE invisible on Sony Xperia (waitDisabled race)
Bug fix
Connectable BLE advertising (ADV_IND) was invisible on Sony Xperia 10 III and similar phones.
Root cause
waitDisabled() unconditionally cleared EVENTS_DISABLED at entry before polling. For connectable advertising, the radio hardware shorts chain PHYEND→DISABLE→RXEN fires synchronously: by the time the software called waitDisabled(), the DISABLE stage had already set EVENTS_DISABLED — and the function erased it. The poll loop then spun for ~350 000 iterations (~30 ms), then force-disabled the radio that was already sitting in RX and ready to receive SCAN_REQ.
Sony Xperia 10 III (Qualcomm BLE) sends SCAN_REQ at exactly T_IFS = 150 µs; that window was consistently missed, so no SCAN_RSP was ever transmitted, and the device never appeared in nRF Scanner or any other BLE scanner on that phone.
ADV_NON_CONN_IND (BleAdvertiser sketch) was unaffected because it uses transmitPreparedPacketOnCurrentChannel(), which polls EVENTS_DISABLED without a pre-clear.
Fix
In waitDisabled(): check EVENTS_DISABLED before clearing it. If the event is already set (hardware fired DISABLE before we arrived), detect and clear it immediately and return true. Only proceed to the polling loop if the event is not yet set.
Affected sketches (now fixed)
BleNordicUartBridgeBleNordicUartLoopbackProbeBleNordicUartCommandConsoleBleNusBridgeBleConnectableScannableAdvertiserBleConnectionPeripheral- All other connectable (ADV_IND) peripheral sketches
Full Changelog: v0.2.13...v0.2.14