From 07f107981d282baa084c28626966b1515e1fb21d Mon Sep 17 00:00:00 2001 From: BBBits Date: Mon, 7 Dec 2020 18:18:29 +1300 Subject: [PATCH 1/3] IR rx Igore min bits if unknown 1st draft Code should be in IRrecv.cpp --- tasmota/settings.h | 6 +++--- tasmota/xdrv_05_irremote.ino | 12 +++++++++--- tasmota/xdrv_05_irremote_full.ino | 8 ++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tasmota/settings.h b/tasmota/settings.h index 02dd5cba3..8f8d6e9d4 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -142,9 +142,9 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t mqtt_switches : 1; // bit 0 (v9.0.0.3) - SetOption114 - (Switch) Detach Switches from relays and enable MQTT action state for all the SwitchModes (1) uint32_t mi32_enable : 1; // bit 1 (v9.1.0.1) - SetOption115 - (ESP32 BLE) Enable ESP32 MI32 BLE (1) uint32_t zb_disable_autoquery : 1; // bit 2 (v9.1.0.1) - SetOption116 - (Zigbee) Disable auto-query of zigbee lights and devices (1) - uint32_t spare03 : 1; // bit 3 - uint32_t spare04 : 1; // bit 4 - uint32_t spare05 : 1; // bit 5 + uint32_t ir_rx_min_unknown_bits_8 : 1; // bit 3 SetOption117 + uint32_t ir_rx_min_unknown_bits_16 : 1;// bit 4 SetOption118 + uint32_t ir_rx_min_unknown_bits_32 : 1;// bit 5 SetOption119 uint32_t spare06 : 1; // bit 6 uint32_t spare07 : 1; // bit 7 uint32_t spare08 : 1; // bit 8 diff --git a/tasmota/xdrv_05_irremote.ino b/tasmota/xdrv_05_irremote.ino index cd401d7c0..6c7e934b5 100644 --- a/tasmota/xdrv_05_irremote.ino +++ b/tasmota/xdrv_05_irremote.ino @@ -19,7 +19,7 @@ /* Below is the Pyhton3 code to decompress IR comact format. - +Resolve this {"Protocol":"UNKNOWN","Bits":4,"Hash":"0xC1E490FF"}} ====================================================================== import re @@ -170,7 +170,14 @@ void IrReceiveCheck(void) iridx = results.decode_type; if ((iridx < 0) || (iridx > MAX_STANDARD_IR)) { iridx = 0; } // UNKNOWN - + uint8_t min_bits = 0; + if(Settings.flag5.ir_rx_min_unknown_bits_8) { min_bits += 8; } + if(Settings.flag5.ir_rx_min_unknown_bits_16) { min_bits += 16; } + if(Settings.flag5.ir_rx_min_unknown_bits_32) { min_bits += 32; } + if (results.bits < min_bits){ + irrecv->resume(); + return; + } if (iridx) { if (results.bits > 64) { // This emulates IRutils resultToHexidecimal and may needs a larger IR_RCV_BUFFER_SIZE @@ -247,7 +254,6 @@ void IrReceiveCheck(void) } #endif // USE_DOMOTICZ } - irrecv->resume(); } } diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index ce75d09db..bf1d8c790 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -287,6 +287,14 @@ void IrReceiveCheck(void) decode_results results; if (irrecv->decode(&results)) { + uint8_t min_bits = 0; + if(Settings.flag5.ir_rx_min_unknown_bits_8) { min_bits += 8; } + if(Settings.flag5.ir_rx_min_unknown_bits_16) { min_bits += 16; } + if(Settings.flag5.ir_rx_min_unknown_bits_32) { min_bits += 32; } + if (results.bits < min_bits){ + irrecv->resume(); + return; + } uint32_t now = millis(); // if ((now - ir_lasttime > IR_TIME_AVOID_DUPLICATE) && (UNKNOWN != results.decode_type) && (results.bits > 0)) { From 4453e24aa6db5ec8b9026c23cad9b9e1f14ee4a0 Mon Sep 17 00:00:00 2001 From: BBBits Date: Mon, 7 Dec 2020 20:40:51 +1300 Subject: [PATCH 2/3] Revert "IR rx Igore min bits if unknown 1st draft" This reverts commit 07f107981d282baa084c28626966b1515e1fb21d. --- tasmota/settings.h | 6 +++--- tasmota/xdrv_05_irremote.ino | 12 +++--------- tasmota/xdrv_05_irremote_full.ino | 8 -------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/tasmota/settings.h b/tasmota/settings.h index 8f8d6e9d4..02dd5cba3 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -142,9 +142,9 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t mqtt_switches : 1; // bit 0 (v9.0.0.3) - SetOption114 - (Switch) Detach Switches from relays and enable MQTT action state for all the SwitchModes (1) uint32_t mi32_enable : 1; // bit 1 (v9.1.0.1) - SetOption115 - (ESP32 BLE) Enable ESP32 MI32 BLE (1) uint32_t zb_disable_autoquery : 1; // bit 2 (v9.1.0.1) - SetOption116 - (Zigbee) Disable auto-query of zigbee lights and devices (1) - uint32_t ir_rx_min_unknown_bits_8 : 1; // bit 3 SetOption117 - uint32_t ir_rx_min_unknown_bits_16 : 1;// bit 4 SetOption118 - uint32_t ir_rx_min_unknown_bits_32 : 1;// bit 5 SetOption119 + uint32_t spare03 : 1; // bit 3 + uint32_t spare04 : 1; // bit 4 + uint32_t spare05 : 1; // bit 5 uint32_t spare06 : 1; // bit 6 uint32_t spare07 : 1; // bit 7 uint32_t spare08 : 1; // bit 8 diff --git a/tasmota/xdrv_05_irremote.ino b/tasmota/xdrv_05_irremote.ino index 6c7e934b5..cd401d7c0 100644 --- a/tasmota/xdrv_05_irremote.ino +++ b/tasmota/xdrv_05_irremote.ino @@ -19,7 +19,7 @@ /* Below is the Pyhton3 code to decompress IR comact format. -Resolve this {"Protocol":"UNKNOWN","Bits":4,"Hash":"0xC1E490FF"}} + ====================================================================== import re @@ -170,14 +170,7 @@ void IrReceiveCheck(void) iridx = results.decode_type; if ((iridx < 0) || (iridx > MAX_STANDARD_IR)) { iridx = 0; } // UNKNOWN - uint8_t min_bits = 0; - if(Settings.flag5.ir_rx_min_unknown_bits_8) { min_bits += 8; } - if(Settings.flag5.ir_rx_min_unknown_bits_16) { min_bits += 16; } - if(Settings.flag5.ir_rx_min_unknown_bits_32) { min_bits += 32; } - if (results.bits < min_bits){ - irrecv->resume(); - return; - } + if (iridx) { if (results.bits > 64) { // This emulates IRutils resultToHexidecimal and may needs a larger IR_RCV_BUFFER_SIZE @@ -254,6 +247,7 @@ void IrReceiveCheck(void) } #endif // USE_DOMOTICZ } + irrecv->resume(); } } diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index bf1d8c790..ce75d09db 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -287,14 +287,6 @@ void IrReceiveCheck(void) decode_results results; if (irrecv->decode(&results)) { - uint8_t min_bits = 0; - if(Settings.flag5.ir_rx_min_unknown_bits_8) { min_bits += 8; } - if(Settings.flag5.ir_rx_min_unknown_bits_16) { min_bits += 16; } - if(Settings.flag5.ir_rx_min_unknown_bits_32) { min_bits += 32; } - if (results.bits < min_bits){ - irrecv->resume(); - return; - } uint32_t now = millis(); // if ((now - ir_lasttime > IR_TIME_AVOID_DUPLICATE) && (UNKNOWN != results.decode_type) && (results.bits > 0)) { From ad6fcd74598963c9344014b1525caa19cb6cc4e3 Mon Sep 17 00:00:00 2001 From: BBBits Date: Wed, 9 Dec 2020 09:16:17 +1300 Subject: [PATCH 3/3] Resolve Truncated Value In KNX_RXx --- tasmota/xdrv_11_knx.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/xdrv_11_knx.ino b/tasmota/xdrv_11_knx.ino index cfe47e6b0..6aaf73715 100644 --- a/tasmota/xdrv_11_knx.ino +++ b/tasmota/xdrv_11_knx.ino @@ -590,7 +590,7 @@ void KNX_CB_Action(message_t const &msg, void *arg) else if ((chan->type >= KNX_SLOT1) && (chan->type <= KNX_SLOT5)) // KNX RX SLOTs (write command) { if (!toggle_inhibit) { - char command[25]; + char command[35]; //4294967295.00 13chars + 17 if (msg.data_len == 1) { // Command received snprintf_P(command, sizeof(command), PSTR("event KNXRX_CMND%d=%d"), ((chan->type) - KNX_SLOT1 + 1 ), msg.data[0]);