From 17ab5a5e83c664293eceb98297af72b56b9de548 Mon Sep 17 00:00:00 2001 From: Christian Baars Date: Sun, 5 Jan 2025 19:14:59 +0100 Subject: [PATCH] fix missing button when turning on BLE (#22770) --- tasmota/include/xsns_62_esp32_mi.h | 2 +- .../tasmota_xsns_sensor/xsns_62_esp32_mi.ino | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tasmota/include/xsns_62_esp32_mi.h b/tasmota/include/xsns_62_esp32_mi.h index 27b4ad231..4b8f6ea87 100644 --- a/tasmota/include/xsns_62_esp32_mi.h +++ b/tasmota/include/xsns_62_esp32_mi.h @@ -235,7 +235,7 @@ struct { uint32_t handleEveryDevice:1; } option; #ifdef USE_MI_EXT_GUI - uint32_t widgetSlot; + uint32_t widgetSlot = 0; #ifdef USE_ENERGY_SENSOR uint8_t energy_history[24]; #endif //USE_ENERGY_SENSOR diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino index 6d2bb789f..6abd6b470 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino @@ -2624,7 +2624,6 @@ void MI32sendWidget(uint32_t slot){ } void MI32InitGUI(void){ - MI32.widgetSlot=0; WSContentStart_P("m32"); WSContentSend_P(HTTP_MI32_SCRIPT_1); WSContentSendStyle(); @@ -2938,6 +2937,20 @@ int ExtStopBLE(){ bool Xsns62(uint32_t function) { + +#ifdef USE_WEBSERVER +#ifdef USE_MI_EXT_GUI + switch (function) { + case FUNC_WEB_ADD_MAIN_BUTTON: + WSContentSend_P(HTTP_BTN_MENU_MI32); + break; + case FUNC_WEB_ADD_HANDLER: + WebServer_on(PSTR("/m32"), MI32HandleWebGUI); + break; + } + #endif //USE_MI_EXT_GUI +#endif //USE_WEBSERVER + if (!Settings->flag5.mi32_enable) { return false; } // SetOption115 - Enable ESP32 MI32 BLE bool result = false; @@ -2977,14 +2990,6 @@ bool Xsns62(uint32_t function) case FUNC_WEB_SENSOR: MI32Show(0); break; -#ifdef USE_MI_EXT_GUI - case FUNC_WEB_ADD_MAIN_BUTTON: - if (Settings->flag5.mi32_enable) WSContentSend_P(HTTP_BTN_MENU_MI32); - break; - case FUNC_WEB_ADD_HANDLER: - WebServer_on(PSTR("/m32"), MI32HandleWebGUI); - break; -#endif //USE_MI_EXT_GUI #endif // USE_WEBSERVER } return result;