Browse Source
Merge pull request #3005 from axhoff/agent/fix-ble-reconnect
Fix bonded BLE reconnects on ESP32
pull/1632/merge
ripplebiz
4 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
1 additions and
4 deletions
-
src/helpers/esp32/SerialBLEInterface.cpp
|
|
|
@ -103,10 +103,9 @@ void SerialBLEInterface::onMtuChanged(BLEServer* pServer, esp_ble_gatts_cb_param |
|
|
|
|
|
|
|
void SerialBLEInterface::onDisconnect(BLEServer* pServer) { |
|
|
|
BLE_DEBUG_PRINTLN("onDisconnect()"); |
|
|
|
deviceConnected = false; |
|
|
|
if (_isEnabled) { |
|
|
|
adv_restart_time = millis() + ADVERT_RESTART_DELAY; |
|
|
|
|
|
|
|
// loop() will detect this on next loop, and set deviceConnected to false
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -216,8 +215,6 @@ size_t SerialBLEInterface::checkRecvFrame(uint8_t dest[]) { |
|
|
|
return frame.len; |
|
|
|
} |
|
|
|
|
|
|
|
if (pServer->getConnectedCount() == 0) deviceConnected = false; |
|
|
|
|
|
|
|
if (deviceConnected != oldDeviceConnected) { |
|
|
|
if (!deviceConnected) { // disconnecting
|
|
|
|
clearBuffers(); |
|
|
|
|