diff --git a/xdrip/BluetoothTransmitter/CGM/Dexcom/G5/CGMG5Transmitter.swift b/xdrip/BluetoothTransmitter/CGM/Dexcom/G5/CGMG5Transmitter.swift index 93e37130..1d37c1db 100644 --- a/xdrip/BluetoothTransmitter/CGM/Dexcom/G5/CGMG5Transmitter.swift +++ b/xdrip/BluetoothTransmitter/CGM/Dexcom/G5/CGMG5Transmitter.swift @@ -289,7 +289,11 @@ class CGMG5Transmitter:BluetoothTransmitter, CGMTransmitter { override func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) { - super.centralManager(central, didDisconnectPeripheral: peripheral, error: error) + let delayInSeconds = 2.0 + + DispatchQueue.main.asyncAfter(deadline: .now() + delayInSeconds) { + super.centralManager(central, didDisconnectPeripheral: peripheral, error: error) + } if waitingPairingConfirmation { // device has requested a pairing request and is now in a status of verifying if pairing was successfull or not, this by doing setNotify to writeCharacteristic. If a disconnect occurs now, it means pairing has failed (probably because user didn't approve it