mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-25 15:27:17 +00:00
Merge pull request #9850 from rvbglas/development
Delay ESP32 Bluetooth initialization after WiFi init/set sleep mode.
This commit is contained in:
commit
eab462d2e3
@ -275,13 +275,21 @@ void ESP32ResumeScanTask() {
|
|||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("%s: Resumed scanner task"),"BLE");
|
AddLog_P(LOG_LEVEL_DEBUG, PSTR("%s: Resumed scanner task"),"BLE");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
void ESP32Init() {
|
||||||
|
|
||||||
void IBEACON_Init() {
|
if (TasmotaGlobal.global_state.wifi_down) { return; }
|
||||||
|
|
||||||
#ifdef USE_IBEACON_ESP32
|
if (WiFi.getSleep() == false) {
|
||||||
|
if (0 == Settings.flag3.sleep_normal) {
|
||||||
|
AddLog_P(LOG_LEVEL_DEBUG,PSTR("%s: About to restart to put WiFi modem in sleep mode"),"BLE");
|
||||||
|
Settings.flag3.sleep_normal = 1; // SetOption60 - Enable normal sleep instead of dynamic sleep
|
||||||
|
TasmotaGlobal.restart_flag = 2;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddLog_P(LOG_LEVEL_DEBUG,PSTR("%s: Initializing Blueetooth..."),"BLE");
|
||||||
|
|
||||||
ESP32BLE.mode.init = false;
|
|
||||||
if (!ESP32BLE.mode.init) {
|
if (!ESP32BLE.mode.init) {
|
||||||
NimBLEDevice::init("");
|
NimBLEDevice::init("");
|
||||||
|
|
||||||
@ -293,6 +301,17 @@ void IBEACON_Init() {
|
|||||||
IB_TIMEOUT_TIME=IB_TIMEOUT_INTERVAL;
|
IB_TIMEOUT_TIME=IB_TIMEOUT_INTERVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void IBEACON_Init() {
|
||||||
|
|
||||||
|
#ifdef USE_IBEACON_ESP32
|
||||||
|
|
||||||
|
ESP32BLE.mode.init = false;
|
||||||
|
ESP32BLE.mode.runningScan = false;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
hm17_found=0;
|
hm17_found=0;
|
||||||
@ -320,6 +339,8 @@ void IBEACON_Init() {
|
|||||||
|
|
||||||
void esp32_every_second(void) {
|
void esp32_every_second(void) {
|
||||||
|
|
||||||
|
if (!ESP32BLE.mode.init) { return; }
|
||||||
|
|
||||||
if (TasmotaGlobal.ota_state_flag) {
|
if (TasmotaGlobal.ota_state_flag) {
|
||||||
if (ESP32BLE.mode.runningScan) {
|
if (ESP32BLE.mode.runningScan) {
|
||||||
AddLog_P(LOG_LEVEL_DEBUG,PSTR("%s: Upgrade procedure started"),"BLE");
|
AddLog_P(LOG_LEVEL_DEBUG,PSTR("%s: Upgrade procedure started"),"BLE");
|
||||||
@ -953,6 +974,13 @@ bool Xsns52(byte function)
|
|||||||
case FUNC_INIT:
|
case FUNC_INIT:
|
||||||
IBEACON_Init();
|
IBEACON_Init();
|
||||||
break;
|
break;
|
||||||
|
#ifdef USE_IBEACON_ESP32
|
||||||
|
case FUNC_EVERY_250_MSECOND:
|
||||||
|
if (!ESP32BLE.mode.init) {
|
||||||
|
ESP32Init();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case FUNC_LOOP:
|
case FUNC_LOOP:
|
||||||
IBEACON_loop();
|
IBEACON_loop();
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user