From 14034ee9d11cc7e3a4823a01fa480ee24296bd7b Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 13 Nov 2020 11:21:28 +0100 Subject: [PATCH] Fix KNX buttons, switches and sensors detection Fix KNX buttons, switches and sensors detection regression from v9.1.0 (#9811) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/xdrv_11_knx.ino | 50 +++++++++++++++++------------------------ 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04c2dd4ba..c11a67ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file. ### Fixed - NTP fallback server functionality (#9739) - Telegram group chatid not supported (#9831) +- KNX buttons, switches and sensors detection regression from v9.1.0 (#9811) ### Removed - Version compatibility check diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 251b6396b..d3792191c 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -73,6 +73,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota ### Fixed - NTP fallback server functionality (#9739) - Telegram group chatid not supported (#9831) +- KNX buttons, switches and sensors detection regression from v9.1.0 (#9811) ### Removed - Version compatibility check diff --git a/tasmota/xdrv_11_knx.ino b/tasmota/xdrv_11_knx.ino index 2aa9afa9a..ce8aa6250 100644 --- a/tasmota/xdrv_11_knx.ino +++ b/tasmota/xdrv_11_knx.ino @@ -466,43 +466,35 @@ void KNX_INIT(void) // Read Configuration // Check which relays, buttons and sensors where configured for this device // and activate options according to the hardware - /*for (uint32_t i = GPIO_REL1; i < GPIO_REL8 + 1; ++i) - { - if (GetUsedInModule(i, TasmotaGlobal.my_module.io)) { device_param[i - GPIO_REL1].show = true; } + /* + for (uint32_t i = 0; i < 8; i++) { + if (PinUsed(GPIO_REL1, i)) { + device_param[i].show = true; + } } - for (uint32_t i = GPIO_REL1_INV; i < GPIO_REL8_INV + 1; ++i) - { - if (GetUsedInModule(i, TasmotaGlobal.my_module.io)) { device_param[i - GPIO_REL1_INV].show = true; } - }*/ - for (uint32_t i = 0; i < TasmotaGlobal.devices_present; ++i) - { + */ + for (uint32_t i = 0; i < TasmotaGlobal.devices_present; ++i) { device_param[i].show = true; } - for (uint32_t i = GPIO_SWT1; i < GPIO_SWT1 + 4; ++i) - { - if (GetUsedInModule(i, TasmotaGlobal.my_module.io)) { device_param[i - GPIO_SWT1 + 8].show = true; } + for (uint32_t i = 0; i < 4; i++) { + if (PinUsed(GPIO_KEY1, i)) { + device_param[8 + i].show = true; + } } - for (uint32_t i = GPIO_KEY1; i < GPIO_KEY1 + 4; ++i) - { - if (GetUsedInModule(i, TasmotaGlobal.my_module.io)) { device_param[i - GPIO_KEY1 + 8].show = true; } + for (uint32_t i = 0; i < 8; i++) { + if (PinUsed(GPIO_SWT1, i)) { + device_param[8 + i].show = true; + } } - for (uint32_t i = GPIO_SWT1_NP; i < GPIO_SWT1_NP + 4; ++i) - { - if (GetUsedInModule(i, TasmotaGlobal.my_module.io)) { device_param[i - GPIO_SWT1_NP + 8].show = true; } + if (PinUsed(GPIO_DHT11) || PinUsed(GPIO_DHT22) || PinUsed(GPIO_SI7021)) { + device_param[KNX_TEMPERATURE-1].show = true; + device_param[KNX_HUMIDITY-1].show = true; } - for (uint32_t i = GPIO_KEY1_NP; i < GPIO_KEY1_NP + 4; ++i) - { - if (GetUsedInModule(i, TasmotaGlobal.my_module.io)) { device_param[i - GPIO_KEY1_NP + 8].show = true; } - } - if (GetUsedInModule(GPIO_DHT11, TasmotaGlobal.my_module.io)) { device_param[KNX_TEMPERATURE-1].show = true; } - if (GetUsedInModule(GPIO_DHT22, TasmotaGlobal.my_module.io)) { device_param[KNX_TEMPERATURE-1].show = true; } - if (GetUsedInModule(GPIO_SI7021, TasmotaGlobal.my_module.io)) { device_param[KNX_TEMPERATURE-1].show = true; } #ifdef USE_DS18x20 - if (GetUsedInModule(GPIO_DSB, TasmotaGlobal.my_module.io)) { device_param[KNX_TEMPERATURE-1].show = true; } + if (PinUsed(GPIO_DSB)) { + device_param[KNX_TEMPERATURE-1].show = true; + } #endif - if (GetUsedInModule(GPIO_DHT11, TasmotaGlobal.my_module.io)) { device_param[KNX_HUMIDITY-1].show = true; } - if (GetUsedInModule(GPIO_DHT22, TasmotaGlobal.my_module.io)) { device_param[KNX_HUMIDITY-1].show = true; } - if (GetUsedInModule(GPIO_SI7021, TasmotaGlobal.my_module.io)) { device_param[KNX_HUMIDITY-1].show = true; } #if defined(USE_ENERGY_SENSOR) // Any device with a Power Monitoring