Prevent double SerialBT init

This commit is contained in:
jacob.eva 2024-09-17 17:17:53 +01:00
parent 875edafc21
commit b8ce313482
No known key found for this signature in database
GPG Key ID: 0B92E083BBCCAA1E

View File

@ -32,6 +32,7 @@
BLEUart SerialBT;
BLEDis bledis;
BLEBas blebas;
bool SerialBT_init = false;
#endif
#define BT_PAIRING_TIMEOUT 35000
@ -379,10 +380,14 @@ void bt_start() {
// start device information service
bledis.begin();
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_init = true;
}
blebas.begin();