From 4dc937ee7d10c7897190ebc95ac4bbf1309be393 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Fri, 6 Nov 2020 00:05:22 +0900 Subject: [PATCH 1/2] Remove dead code in IR --- tasmota/xdrv_05_irremote_full.ino | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index 73974feb6..400c794e7 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -719,36 +719,6 @@ uint32_t IrRemoteSendRawStandard(char ** pp, uint32_t count, uint32_t repeat) { free(arr); } return IE_NO_ERROR; - - - - count++; - if (count < 200) { - uint16_t raw_array[count]; // It's safe to use stack for up to 200 packets (limited by mqtt_data length) - for (uint32_t i = 0; i < count; i++) { - raw_array[i] = strtol(strtok_r(nullptr, ", ", pp), nullptr, 0); // Allow decimal (20496) and hexadecimal (0x5010) input - } - - irsend_active = true; - for (uint32_t r = 0; r <= repeat; r++) { - irsend->sendRaw(raw_array, count, freq); - } - } else { - uint16_t *raw_array = reinterpret_cast(malloc(count * sizeof(uint16_t))); - if (raw_array == nullptr) { - return IE_INVALID_RAWDATA; - } - - for (uint32_t i = 0; i < count; i++) { - raw_array[i] = strtol(strtok_r(nullptr, ", ", pp), nullptr, 0); // Allow decimal (20496) and hexadecimal (0x5010) input - } - - irsend_active = true; - for (uint32_t r = 0; r <= repeat; r++) { - irsend->sendRaw(raw_array, count, freq); - } - free(raw_array); - } } // parse the frequency value From b7f90a30802b1c5625ac7ae2549fcb338ce074ca Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Fri, 6 Nov 2020 00:07:39 +0900 Subject: [PATCH 2/2] Fix frequency parsing in raw IRsend --- tasmota/xdrv_05_irremote_full.ino | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index 400c794e7..4a00e2204 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -688,8 +688,7 @@ uint32_t IrRemoteParseRawCompact(char * str, uint16_t * arr, size_t arr_len) { // count: number of commas in parameters, i.e. it contains count+1 values // repeat: number of repeats (0 means no repeat) // -uint32_t IrRemoteSendRawStandard(char ** pp, uint32_t count, uint32_t repeat) { - uint16_t freq = parsqeFreq(*pp); +uint32_t IrRemoteSendRawStandard(char ** pp, uint16_t freq, uint32_t count, uint32_t repeat) { // IRsend 0,896,876,900,888,894,876,1790,874,872,1810,1736,948,872,880,872,936,872,1792,900,888,1734 // IRsend 0,+8570-4240+550-1580C-510+565-1565F-505Fh+570gFhIdChIgFeFgFgIhFgIhF-525C-1560IhIkI-520ChFhFhFgFhIkIhIgIgIkIkI-25270A-4225IkIhIgIhIhIkFhIkFjCgIhIkIkI-500IkIhIhIkFhIgIl+545hIhIoIgIhIkFhFgIkIgFgI @@ -766,7 +765,7 @@ uint32_t IrRemoteCmndIrSendRaw(void) // standard raw // IRsend ,, ... // IRsend , - return IrRemoteSendRawStandard(&p, count, repeat); + return IrRemoteSendRawStandard(&p, parsqeFreq(str), count, repeat); } }