Bug description
Crash when sending raw IR message over MQTT that contains value greater or equal then 16384. When sending message outside MQTT callback it works fine and it starts my AC.
Steps to reproduce
Try sending this raw message over MQTT:
8910,4462,616,578,614,1666,614,580,612,580,570,1710,570,624,570,624,570,624,568,1712,570,624,570,622,570,1710,570,624,570,624,568,624,570,624,570,624,570,624,568,624,570,624,570,624,570,1712,570,1712,570,624,570,624,570,624,570,622,570,624,600,1680,602,592,602,1680,602,592,602,590,602,1678,602,592,602,19880,600,594,600,592,600,592,602,592,600,592,602,592,602,592,602,590,602,592,602,592,602,592,602,592,602,592,602,1678,602,592,602,592,602,590,602,590,604,590,602,592,602,592,602,590,602,592,602,590,602,592,602,592,602,592,602,592,602,1680,602,1678,602,1680,602,590,602
Device information
PLATFORM: Espressif 8266 > Espressif Generic ESP8266 ESP-01 1M
HARDWARE: ESP8266 80MHz 80KB RAM (1MB Flash)
ARDUINO CORE: 2.3.0
ESPURNA: 1.13.6-dev
Stack trace
Exception (9):
epc1=0x40104894 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000003 depc=0x00000000
ctx: sys
sp: 3ffff810 end: 3fffffb0 offset: 01a0
stack>>>
3ffff9b0: 0000008b 0000003f 3fff7094 4010068c
3ffff9c0: 40104ac0 0ef08ed2 3fff1d40 00000000
3ffff9d0: 3ffeef00 3fff1d40 0000025a 4022267c
3ffff9e0: 00000000 0ef077a1 402017d0 00000013
3ffff9f0: 3fff1d40 3fff74fe 0000008b 402225d8
3ffffa00: 32c2b757 00000049 00004da8 40222528
3ffffa10: 00000015 207a4829 3fff07e2 40222609
...
Thanks for reporting!
Referencing IR library code:
https://github.com/markszabo/IRremoteESP8266/blob/41efc71bb414dab0f471bf32b1815b7aee846402/src/IRsend.h#L30
is the limit you encountered
https://github.com/markszabo/IRremoteESP8266/blob/41efc71bb414dab0f471bf32b1815b7aee846402/src/IRsend.cpp#L124-L155
it hits a special case and tries to call delay(...) from the MQTT callback.
You can add additional global build flag Correction: No ifndef there-DALLOW_DELAY_CALLS=0
You need to change it here to false. It will disable that version of _delayMicroseconds and use only actual microsecond delay. It might be unstable though (as comment suggests)
https://github.com/markszabo/IRremoteESP8266/blob/2cfc2d7df2d0410f7af5c00a3a4b7fff346034d5/src/IRremoteESP8266.h#L234-L238
Most helpful comment
Thanks for reporting!
Referencing IR library code:
https://github.com/markszabo/IRremoteESP8266/blob/41efc71bb414dab0f471bf32b1815b7aee846402/src/IRsend.h#L30
is the limit you encountered
https://github.com/markszabo/IRremoteESP8266/blob/41efc71bb414dab0f471bf32b1815b7aee846402/src/IRsend.cpp#L124-L155
it hits a special case and tries to call
delay(...)from the MQTT callback.You can add additional global build flagCorrection: No ifndef there-DALLOW_DELAY_CALLS=0You need to change it here to
false. It will disable that version of _delayMicroseconds and use only actual microsecond delay. It might be unstable though (as comment suggests)https://github.com/markszabo/IRremoteESP8266/blob/2cfc2d7df2d0410f7af5c00a3a4b7fff346034d5/src/IRremoteESP8266.h#L234-L238