From f135f46990434a4055a986a04dfb8f0c4b12a467 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:55:45 +0100 Subject: [PATCH] Fix more GUI issues --- .../xdrv_01_9_webserver.ino | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index 10d9fb4e8..d0da62759 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -1257,29 +1257,28 @@ int32_t IsShutterWebButton(uint32_t idx) { /*-------------------------------------------------------------------------------------------*/ -void WebGetDeviceCounts(uint32_t &buttons_non_light, uint32_t &buttons_non_light_non_shutter, uint32_t &light_shutter_button_mask) { - light_shutter_button_mask = 0; // Bitmask for each light and/or shutter button - buttons_non_light = TasmotaGlobal.devices_present; +void WebGetDeviceCounts(uint32_t &buttons_non_light_non_shutter, uint32_t &light_shutter_button_mask) { + buttons_non_light_non_shutter = TasmotaGlobal.devices_present; + light_shutter_button_mask = 0; // Bitmask for each light and/or shutter button #ifdef USE_LIGHT // Chk for reduced toggle buttons used by lights if (TasmotaGlobal.light_type) { - // Find and skip light buttons (Lights are controlled by the last TasmotaGlobal.devices_present (or 2)) + // Find and skip light buttons uint32_t light_device = LightDevice(); uint32_t light_devices = LightDevices(); - buttons_non_light -= light_devices; for (uint32_t button_idx = light_device; button_idx < (light_device + light_devices); button_idx++) { + buttons_non_light_non_shutter--; light_shutter_button_mask |= (1 << (button_idx -1)); // Set button bit in bitmask } } #endif // USE_LIGHT - buttons_non_light_non_shutter = buttons_non_light; #ifdef USE_SHUTTER // Chk for reduced toggle buttons used by shutters - // Find and skip dedicated shutter buttons - if (buttons_non_light && Settings->flag3.shutter_mode) { // SetOption80 - Enable shutter support - for (uint32_t button_idx = 1; button_idx <= buttons_non_light; button_idx++) { + if (Settings->flag3.shutter_mode) { // SetOption80 - Enable shutter support + // Find and skip dedicated shutter buttons + for (uint32_t button_idx = 1; button_idx <= TasmotaGlobal.devices_present; button_idx++) { if (IsShutterWebButton(button_idx) != 0) { buttons_non_light_non_shutter--; light_shutter_button_mask |= (1 << (button_idx -1)); // Set button bit in bitmask @@ -1288,8 +1287,7 @@ void WebGetDeviceCounts(uint32_t &buttons_non_light, uint32_t &buttons_non_light } #endif // USE_SHUTTER -// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("HTP: DP %d, BNL %d, BNLNS %d, SB %08X"), -// TasmotaGlobal.devices_present, buttons_non_light, buttons_non_light_non_shutter, light_shutter_button_mask); +// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("HTP: DP %d, BNLNS %d, SB %08X"), TasmotaGlobal.devices_present, buttons_non_light_non_shutter, light_shutter_button_mask); } #ifdef USE_LIGHT @@ -1372,10 +1370,9 @@ void HandleRoot(void) { #ifndef FIRMWARE_MINIMAL if (TasmotaGlobal.devices_present) { - uint32_t buttons_non_light; uint32_t buttons_non_light_non_shutter; uint32_t light_shutter_button_mask; - WebGetDeviceCounts(buttons_non_light, buttons_non_light_non_shutter, light_shutter_button_mask); + WebGetDeviceCounts(buttons_non_light_non_shutter, light_shutter_button_mask); uint32_t button_idx = 1; if (buttons_non_light_non_shutter) { // Any non light AND non shutter button - Show toggle buttons @@ -1458,13 +1455,15 @@ void HandleRoot(void) { #ifdef USE_LIGHT if (TasmotaGlobal.light_type) { // Any light - Show light button and slider(s) - button_idx = LightDevice(); + uint32_t light_device = LightDevice(); + uint32_t light_devices = LightDevices(); + button_idx = light_device; WSContentSend_P(HTTP_TABLE100); // "