mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-11 08:54:51 +05:00
fix: handle BLE initialization failures
This commit is contained in:
1 parent
9cf10201f6
commit
69ed4ef86c
1 file changed
+12
-7
+12
-7
@@ -874,14 +874,19 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!NimBLEDevice::isInitialized() && millis() > 5000) {
|
if (!NimBLEDevice::isInitialized() && millis() > 5000) {
|
||||||
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
|
if (NimBLEDevice::init(PROJECT_NAME)) {
|
||||||
NimBLEDevice::init("");
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
|
||||||
|
|
||||||
#ifdef ESP_PWR_LVL_P20
|
#ifdef ESP_PWR_LVL_P20
|
||||||
NimBLEDevice::setPower(ESP_PWR_LVL_P20);
|
NimBLEDevice::setPower(ESP_PWR_LVL_P20);
|
||||||
#elifdef ESP_PWR_LVL_P9
|
#elifdef ESP_PWR_LVL_P9
|
||||||
NimBLEDevice::setPower(ESP_PWR_LVL_P9);
|
NimBLEDevice::setPower(ESP_PWR_LVL_P9);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.swarningln(FPSTR(L_SENSORS_BLE), F("Unable to initialize!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->pBLEScan == nullptr) {
|
if (this->pBLEScan == nullptr) {
|
||||||
|
|||||||
Reference in new issue
Block a user