From 100805ff26df647302ea8e2c3dc2da6882216776 Mon Sep 17 00:00:00 2001 From: Alain Turbide Date: Tue, 23 Jun 2020 18:09:44 -0400 Subject: [PATCH 1/4] Add support for GlobalCache codes using the same format as irsend raw. Use irsend gc,xxx,xxx --- tasmota/xdrv_05_irremote_full.ino | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index 60e16b30d..3f43c364a 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -470,6 +470,29 @@ uint32_t IrRemoteCmndIrSendRaw(void) return IE_INVALID_RAWDATA; } // Parameters must be at least 3 + +#ifdef IR_GC +//ir_gc + + if (strcmp(str, "gc") == 0) { //if first parameter is gc then we process global cache data else it is raw + + uint16_t GC[count+1]; + for (uint32_t i = 0; i <= count; i++) { + GC[i] = strtol(strtok_r(nullptr, ", ", &p), nullptr, 0); + if (!GC[i]) { + return IE_INVALID_RAWDATA; + } + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: GC value %d"), GC[i]); + } + irsend->sendGC(GC, count+1); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: GC sent count %d"), count); + return IE_NO_ERROR; + } +//end ir_gc +#endif + + + uint16_t parm[count]; for (uint32_t i = 0; i < count; i++) { parm[i] = strtol(strtok_r(nullptr, ", ", &p), nullptr, 0); From 2b1d251b85de0f6f9af1a67ce277a9850bdcc1be Mon Sep 17 00:00:00 2001 From: Alain Turbide Date: Tue, 23 Jun 2020 19:46:55 -0400 Subject: [PATCH 2/4] - Added case insensitivity for GC/gc - Added repeat support - removed debug messages --- tasmota/xdrv_05_irremote_full.ino | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index 3f43c364a..ba132b9be 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -472,23 +472,19 @@ uint32_t IrRemoteCmndIrSendRaw(void) #ifdef IR_GC -//ir_gc - - if (strcmp(str, "gc") == 0) { //if first parameter is gc then we process global cache data else it is raw - + if (strcmp(str, "gc") == 0 ||strcmp(str, "GC") == 0) { //if first parameter is gc then we process global cache data else it is raw uint16_t GC[count+1]; for (uint32_t i = 0; i <= count; i++) { GC[i] = strtol(strtok_r(nullptr, ", ", &p), nullptr, 0); if (!GC[i]) { - return IE_INVALID_RAWDATA; + return IE_INVALID_RAWDATA; } - AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: GC value %d"), GC[i]); } - irsend->sendGC(GC, count+1); - AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: GC sent count %d"), count); - return IE_NO_ERROR; + for (uint32_t r = 0; r <= repeat; r++) { + irsend->sendGC(GC, count+1); + } + return IE_NO_ERROR; } -//end ir_gc #endif From 0c02d1ae3e6dae5b037575ca04ef60c230e96103 Mon Sep 17 00:00:00 2001 From: Alain Turbide Date: Tue, 23 Jun 2020 20:13:09 -0400 Subject: [PATCH 3/4] add missing irsend_active flag to block ir receive during send --- tasmota/xdrv_05_irremote_full.ino | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index ba132b9be..d4f289c0a 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -470,9 +470,8 @@ uint32_t IrRemoteCmndIrSendRaw(void) return IE_INVALID_RAWDATA; } // Parameters must be at least 3 - #ifdef IR_GC - if (strcmp(str, "gc") == 0 ||strcmp(str, "GC") == 0) { //if first parameter is gc then we process global cache data else it is raw + if (strcmp(str, "gc") == 0 || strcmp(str, "GC") == 0) { //if first parameter is gc then we process global cache data else it is raw uint16_t GC[count+1]; for (uint32_t i = 0; i <= count; i++) { GC[i] = strtol(strtok_r(nullptr, ", ", &p), nullptr, 0); @@ -480,6 +479,7 @@ uint32_t IrRemoteCmndIrSendRaw(void) return IE_INVALID_RAWDATA; } } + irsend_active = true; for (uint32_t r = 0; r <= repeat; r++) { irsend->sendGC(GC, count+1); } @@ -487,8 +487,6 @@ uint32_t IrRemoteCmndIrSendRaw(void) } #endif - - uint16_t parm[count]; for (uint32_t i = 0; i < count; i++) { parm[i] = strtol(strtok_r(nullptr, ", ", &p), nullptr, 0); From 076d1521e33b6cabb10c10d17bd0315c966b2e7e Mon Sep 17 00:00:00 2001 From: Alain Turbide Date: Wed, 24 Jun 2020 07:09:22 -0400 Subject: [PATCH 4/4] - switched to strcasecmp for compare - removed ifdef/endif --- tasmota/xdrv_05_irremote_full.ino | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index d4f289c0a..457ff63f4 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -470,8 +470,7 @@ uint32_t IrRemoteCmndIrSendRaw(void) return IE_INVALID_RAWDATA; } // Parameters must be at least 3 -#ifdef IR_GC - if (strcmp(str, "gc") == 0 || strcmp(str, "GC") == 0) { //if first parameter is gc then we process global cache data else it is raw + if (strcasecmp(str, "gc") == 0) { //if first parameter is gc then we process global cache data else it is raw uint16_t GC[count+1]; for (uint32_t i = 0; i <= count; i++) { GC[i] = strtol(strtok_r(nullptr, ", ", &p), nullptr, 0); @@ -485,7 +484,6 @@ uint32_t IrRemoteCmndIrSendRaw(void) } return IE_NO_ERROR; } -#endif uint16_t parm[count]; for (uint32_t i = 0; i < count; i++) {