mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2025-05-08 17:35:20 -04:00
Fix BLE service duplication bug on nRF52
This commit is contained in:
parent
55c6bd06a2
commit
ef80c2638c
1 changed files with 8 additions and 3 deletions
11
Bluetooth.h
11
Bluetooth.h
|
@ -32,6 +32,7 @@
|
|||
BLEUart SerialBT;
|
||||
BLEDis bledis;
|
||||
BLEBas blebas;
|
||||
bool SerialBT_init = false;
|
||||
#endif
|
||||
|
||||
#define BT_PAIRING_TIMEOUT 35000
|
||||
|
@ -502,10 +503,14 @@ void bt_disconnect_callback(uint16_t conn_handle, uint8_t reason) {
|
|||
// start device information service
|
||||
bledis.begin();
|
||||
|
||||
SerialBT.bufferTXD(true); // enable buffering
|
||||
// Guard to ensure SerialBT service is not duplicated through BT being power cycled
|
||||
if (!SerialBT_init) {
|
||||
SerialBT.bufferTXD(true); // enable buffering
|
||||
|
||||
SerialBT.setPermission(SECMODE_ENC_WITH_MITM, SECMODE_ENC_WITH_MITM); // enable encryption for BLE serial
|
||||
SerialBT.begin();
|
||||
SerialBT.setPermission(SECMODE_ENC_WITH_MITM, SECMODE_ENC_WITH_MITM); // enable encryption for BLE serial
|
||||
SerialBT.begin();
|
||||
SerialBT_init = true;
|
||||
}
|
||||
|
||||
blebas.begin();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue