I've tried to build a libretiny ESPHOME firmware with a HeatPumpIR component and it failed to compile.
Mainly, errors are easy to workaround but I don't know where to report them.
The errors are like this:
Compiling .pioenvs/irremotesalon/lib84c/IRremoteESP8266/IRrecv.cpp.o
/piolibs/IRremoteESP8266/src/IRrecv.cpp:126:7: error: '_IRrecv' has not been declared
126 | using _IRrecv::timer;
| ^~~~~~~
/piolibs/IRremoteESP8266/src/IRrecv.cpp:160:3: error: expected unqualified-id before 'if'
160 | if (params.rawlen) params.rcvstate = kStopState;
| ^~
/piolibs/IRremoteESP8266/src/IRrecv.cpp:167:1: error: expected declaration before '}' token
167 | }
| ^
/piolibs/IRremoteESP8266/src/IRrecv.cpp:170:27: error: expected initializer before 'gpio_intr'
170 | static void USE_IRAM_ATTR gpio_intr() {
| ^~~~~~~~~
/piolibs/IRremoteESP8266/src/IRrecv.cpp: In member function 'void IRrecv::enableIRIn(bool)':
/piolibs/IRremoteESP8266/src/IRrecv.cpp:354:35: error: 'gpio_intr' was not declared in this scope
354 | attachInterrupt(params.recvpin, gpio_intr, CHANGE);
| ^~~~~~~~~
/piolibs/IRremoteESP8266/src/IRrecv.cpp: In member function 'uint32_t IRrecv::ticksLow(uint32_t, uint8_t, uint16_t)':
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1071:8: error: no matching function for call to 'max(int32_t, int)'
1071 | 0));
| ^
In file included from /config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/algorithm:61,
from /config/.esphome/platformio/platforms/libretiny/cores/common/arduino/src/Arduino.h:14,
from /piolibs/IRremoteESP8266/src/IRrecv.h:10,
from /piolibs/IRremoteESP8266/src/IRrecv.cpp:6:
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)'
254 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed:
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1071:8: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
1071 | 0));
| ^
In file included from /config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/algorithm:61,
from /config/.esphome/platformio/platforms/libretiny/cores/common/arduino/src/Arduino.h:14,
from /piolibs/IRremoteESP8266/src/IRrecv.h:10,
from /piolibs/IRremoteESP8266/src/IRrecv.cpp:6:
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed:
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1071:8: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
1071 | 0));
| ^
In file included from /config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/algorithm:62,
from /config/.esphome/platformio/platforms/libretiny/cores/common/arduino/src/Arduino.h:14,
from /piolibs/IRremoteESP8266/src/IRrecv.h:10,
from /piolibs/IRremoteESP8266/src/IRrecv.cpp:6:
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algo.h:3485:5: note: candidate: 'template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)'
3485 | max(initializer_list<_Tp> __l)
| ^~~
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algo.h:3485:5: note: template argument deduction/substitution failed:
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1071:8: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
1071 | 0));
| ^
In file included from /config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/algorithm:62,
from /config/.esphome/platformio/platforms/libretiny/cores/common/arduino/src/Arduino.h:14,
from /piolibs/IRremoteESP8266/src/IRrecv.h:10,
from /piolibs/IRremoteESP8266/src/IRrecv.cpp:6:
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algo.h:3491:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)'
3491 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algo.h:3491:5: note: template argument deduction/substitution failed:
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1071:8: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
1071 | 0));
| ^
/piolibs/IRremoteESP8266/src/IRrecv.cpp: In member function 'bool IRrecv::matchAtLeast(uint32_t, uint32_t, uint8_t, uint16_t)':
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1154:75: error: no matching function for call to 'min(uint32_t&, unsigned int)'
1154 | return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
| ^
In file included from /config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/algorithm:61,
from /config/.esphome/platformio/platforms/libretiny/cores/common/arduino/src/Arduino.h:14,
from /piolibs/IRremoteESP8266/src/IRrecv.h:10,
from /piolibs/IRremoteESP8266/src/IRrecv.cpp:6:
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)'
230 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algobase.h:230:5: note: template argument deduction/substitution failed:
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1154:75: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int')
1154 | return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
| ^
In file included from /config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/algorithm:61,
from /config/.esphome/platformio/platforms/libretiny/cores/common/arduino/src/Arduino.h:14,
from /piolibs/IRremoteESP8266/src/IRrecv.h:10,
from /piolibs/IRremoteESP8266/src/IRrecv.cpp:6:
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
278 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algobase.h:278:5: note: template argument deduction/substitution failed:
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1154:75: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int')
1154 | return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
| ^
In file included from /config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/algorithm:62,
from /config/.esphome/platformio/platforms/libretiny/cores/common/arduino/src/Arduino.h:14,
from /piolibs/IRremoteESP8266/src/IRrecv.h:10,
from /piolibs/IRremoteESP8266/src/IRrecv.cpp:6:
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algo.h:3473:5: note: candidate: 'template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)'
3473 | min(initializer_list<_Tp> __l)
| ^~~
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algo.h:3473:5: note: template argument deduction/substitution failed:
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1154:75: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
1154 | return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
| ^
In file included from /config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/algorithm:62,
from /config/.esphome/platformio/platforms/libretiny/cores/common/arduino/src/Arduino.h:14,
from /piolibs/IRremoteESP8266/src/IRrecv.h:10,
from /piolibs/IRremoteESP8266/src/IRrecv.cpp:6:
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algo.h:3479:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)'
3479 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/config/.esphome/platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/10.3.1/bits/stl_algo.h:3479:5: note: template argument deduction/substitution failed:
/piolibs/IRremoteESP8266/src/IRrecv.cpp:1154:75: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
1154 | return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
| ^
*** [.pioenvs/irremotesalon/lib84c/IRremoteESP8266/IRrecv.cpp.o] Error 1
========================= [FAILED] Took 350.51 seconds =========================
for one and the other is mainly due to using low level PWM registers by enum where the declaration doesn't exists since it's not the right platform.
I've patched the file in the container /config/.esphome/build/mydevice/.piolibdeps/mydevice/HeatpumpIR/IRSenderPWM.cpp like this to fix it:
--- IRSenderPWM.cpp.bk 2023-09-03 14:25:59.731285672 +0200
+++ IRSenderPWM.cpp 2023-09-03 14:26:28.401488636 +0200
@@ -3,7 +3,7 @@
// ESP8266 does not have the Arduino PWM control registers
-#if not defined ESP8266 && not defined ESP32
+#if not defined ESP8266 && not defined ESP32 && not defined LIBRETINY
// Heavily based on Ken Shirriff's IRRemote library:
// https://github.com/shirriff/Arduino-IRremote
And this file /piolibs/IRremoteESP8266/src/IRrecv.cpp like this:
This second patch disable IR receiver definition completely. I don't understand why IRremoteESP8266 is fetched at all, since the code in ESPHome/components/heatpumpir/climate.py contains:
cg.add_library("tonia/HeatpumpIR", "1.0.23")
if CORE.is_esp8266 or CORE.is_esp32:
cg.add_library("crankyoldgit/IRremoteESP8266", "2.7.12")
in its to_code function, so it shouldn't be included at all, right ?
I've tried to build a libretiny ESPHOME firmware with a HeatPumpIR component and it failed to compile.
Mainly, errors are easy to workaround but I don't know where to report them.
The errors are like this:
for one and the other is mainly due to using low level PWM registers by enum where the declaration doesn't exists since it's not the right platform.
I've patched the file in the container
/config/.esphome/build/mydevice/.piolibdeps/mydevice/HeatpumpIR/IRSenderPWM.cpp
like this to fix it:And this file
/piolibs/IRremoteESP8266/src/IRrecv.cpp
like this:This second patch disable IR receiver definition completely. I don't understand why
IRremoteESP8266
is fetched at all, since the code in ESPHome/components/heatpumpir/climate.py contains:in its
to_code
function, so it shouldn't be included at all, right ?