mirror of https://github.com/arendst/Tasmota.git
IR rx Igore min bits if unknown 1st draft
Code should be in IRrecv.cpp
This commit is contained in:
parent
9051240121
commit
07f107981d
|
@ -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 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 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 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 ir_rx_min_unknown_bits_8 : 1; // bit 3 SetOption117
|
||||||
uint32_t spare04 : 1; // bit 4
|
uint32_t ir_rx_min_unknown_bits_16 : 1;// bit 4 SetOption118
|
||||||
uint32_t spare05 : 1; // bit 5
|
uint32_t ir_rx_min_unknown_bits_32 : 1;// bit 5 SetOption119
|
||||||
uint32_t spare06 : 1; // bit 6
|
uint32_t spare06 : 1; // bit 6
|
||||||
uint32_t spare07 : 1; // bit 7
|
uint32_t spare07 : 1; // bit 7
|
||||||
uint32_t spare08 : 1; // bit 8
|
uint32_t spare08 : 1; // bit 8
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Below is the Pyhton3 code to decompress IR comact format.
|
Below is the Pyhton3 code to decompress IR comact format.
|
||||||
|
Resolve this {"Protocol":"UNKNOWN","Bits":4,"Hash":"0xC1E490FF"}}
|
||||||
======================================================================
|
======================================================================
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -170,7 +170,14 @@ void IrReceiveCheck(void)
|
||||||
|
|
||||||
iridx = results.decode_type;
|
iridx = results.decode_type;
|
||||||
if ((iridx < 0) || (iridx > MAX_STANDARD_IR)) { iridx = 0; } // UNKNOWN
|
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 (iridx) {
|
||||||
if (results.bits > 64) {
|
if (results.bits > 64) {
|
||||||
// This emulates IRutils resultToHexidecimal and may needs a larger IR_RCV_BUFFER_SIZE
|
// This emulates IRutils resultToHexidecimal and may needs a larger IR_RCV_BUFFER_SIZE
|
||||||
|
@ -247,7 +254,6 @@ void IrReceiveCheck(void)
|
||||||
}
|
}
|
||||||
#endif // USE_DOMOTICZ
|
#endif // USE_DOMOTICZ
|
||||||
}
|
}
|
||||||
|
|
||||||
irrecv->resume();
|
irrecv->resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,6 +287,14 @@ void IrReceiveCheck(void)
|
||||||
decode_results results;
|
decode_results results;
|
||||||
|
|
||||||
if (irrecv->decode(&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();
|
uint32_t now = millis();
|
||||||
|
|
||||||
// if ((now - ir_lasttime > IR_TIME_AVOID_DUPLICATE) && (UNKNOWN != results.decode_type) && (results.bits > 0)) {
|
// if ((now - ir_lasttime > IR_TIME_AVOID_DUPLICATE) && (UNKNOWN != results.decode_type) && (results.bits > 0)) {
|
||||||
|
|
Loading…
Reference in New Issue