Prevent double SerialBT init
This commit is contained in:
parent
875edafc21
commit
b8ce313482
@ -32,6 +32,7 @@
|
|||||||
BLEUart SerialBT;
|
BLEUart SerialBT;
|
||||||
BLEDis bledis;
|
BLEDis bledis;
|
||||||
BLEBas blebas;
|
BLEBas blebas;
|
||||||
|
bool SerialBT_init = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BT_PAIRING_TIMEOUT 35000
|
#define BT_PAIRING_TIMEOUT 35000
|
||||||
@ -379,10 +380,14 @@ void bt_start() {
|
|||||||
// start device information service
|
// start device information service
|
||||||
bledis.begin();
|
bledis.begin();
|
||||||
|
|
||||||
|
if (!SerialBT_init) {
|
||||||
|
|
||||||
SerialBT.bufferTXD(true); // enable buffering
|
SerialBT.bufferTXD(true); // enable buffering
|
||||||
|
|
||||||
SerialBT.setPermission(SECMODE_ENC_WITH_MITM, SECMODE_ENC_WITH_MITM); // enable encryption for BLE serial
|
SerialBT.setPermission(SECMODE_ENC_WITH_MITM, SECMODE_ENC_WITH_MITM); // enable encryption for BLE serial
|
||||||
SerialBT.begin();
|
SerialBT.begin();
|
||||||
|
SerialBT_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
blebas.begin();
|
blebas.begin();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user