mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Merge pull request #9796 from Staars/mi32
MI_ESP32: prepare for core-stage, fix crash
This commit is contained in:
commit
b6b154aae8
@ -745,18 +745,11 @@ void MI32StatusInfo() {
|
||||
* init NimBLE
|
||||
\*********************************************************************************************/
|
||||
|
||||
void MI32Init(void) {
|
||||
|
||||
MIBLEsensors.reserve(10);
|
||||
MIBLEbindKeys.reserve(10);
|
||||
MINBLEscanResult.reserve(20);
|
||||
void MI32PreInit(void) {
|
||||
MIBLEsensors.reserve(10);
|
||||
MIBLEbindKeys.reserve(10);
|
||||
MINBLEscanResult.reserve(20);
|
||||
MI32.mode.init = false;
|
||||
if (!MI32.mode.init) {
|
||||
NimBLEDevice::init("");
|
||||
|
||||
MI32.mode.canScan = 1;
|
||||
MI32.mode.init = 1;
|
||||
MI32.period = Settings.tele_period;
|
||||
|
||||
//test section for options
|
||||
MI32.option.allwaysAggregate = 1;
|
||||
@ -766,6 +759,19 @@ MINBLEscanResult.reserve(20);
|
||||
MI32.option.showRSSI = 1;
|
||||
MI32.option.ignoreBogusBattery = 1; // from advertisements
|
||||
MI32.option.holdBackFirstAutodiscovery = 1;
|
||||
AddLog_P(LOG_LEVEL_INFO,PSTR("MI32: pre-init"));
|
||||
}
|
||||
|
||||
void MI32Init(void) {
|
||||
if (MI32.mode.init) return;
|
||||
if (Wifi.status == 0) return;
|
||||
|
||||
if (!MI32.mode.init) {
|
||||
NimBLEDevice::init("");
|
||||
AddLog_P(LOG_LEVEL_INFO,PSTR("MI32: init BLE device"));
|
||||
MI32.mode.canScan = 1;
|
||||
MI32.mode.init = 1;
|
||||
MI32.period = Settings.tele_period;
|
||||
|
||||
MI32StartScanTask(); // Let's get started !!
|
||||
}
|
||||
@ -2179,10 +2185,15 @@ bool Xsns62(uint8_t function)
|
||||
{
|
||||
bool result = false;
|
||||
if (FUNC_INIT == function){
|
||||
MI32Init();
|
||||
MI32PreInit();
|
||||
}
|
||||
|
||||
if (MI32.mode.init) {
|
||||
if(!MI32.mode.init){
|
||||
if(function==FUNC_EVERY_250_MSECOND){
|
||||
MI32Init();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
switch (function) {
|
||||
case FUNC_EVERY_50_MSECOND:
|
||||
MI32Every50mSecond();
|
||||
@ -2202,7 +2213,6 @@ bool Xsns62(uint8_t function)
|
||||
break;
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif // USE_MI_ESP32
|
||||
|
Loading…
x
Reference in New Issue
Block a user