Skip to content

Commit 9fd6b41

Browse files
author
Alexander Hoffer
committed
fix: preserve bonded BLE reconnects
1 parent da67328 commit 9fd6b41

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

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

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

0 commit comments

Comments
 (0)