Skip to content

Commit 4157e43

Browse files
authored
Merge pull request #3005 from axhoff/agent/fix-ble-reconnect
Fix bonded BLE reconnects on ESP32
2 parents 8b048ab + 9fd6b41 commit 4157e43

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/helpers/esp32/SerialBLEInterface.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ void SerialBLEInterface::onMtuChanged(BLEServer* pServer, esp_ble_gatts_cb_param
103103

104104
void SerialBLEInterface::onDisconnect(BLEServer* pServer) {
105105
BLE_DEBUG_PRINTLN("onDisconnect()");
106+
deviceConnected = false;
106107
if (_isEnabled) {
107108
adv_restart_time = millis() + ADVERT_RESTART_DELAY;
108-
109-
// loop() will detect this on next loop, and set deviceConnected to false
110109
}
111110
}
112111

@@ -216,8 +215,6 @@ size_t SerialBLEInterface::checkRecvFrame(uint8_t dest[]) {
216215
return frame.len;
217216
}
218217

219-
if (pServer->getConnectedCount() == 0) deviceConnected = false;
220-
221218
if (deviceConnected != oldDeviceConnected) {
222219
if (!deviceConnected) { // disconnecting
223220
clearBuffers();

0 commit comments

Comments
 (0)