Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-C3 Support #1695

Closed
sh-user opened this issue Dec 5, 2021 · 4 comments · Fixed by #1696 or #1732
Closed

ESP32-C3 Support #1695

sh-user opened this issue Dec 5, 2021 · 4 comments · Fixed by #1696 or #1732
Assignees
Labels
enhancement ESP32 ESP32 only issue

Comments

@sh-user
Copy link

sh-user commented Dec 5, 2021

ESP32-C3
RISC-V processor (RV32IMC)
Arduino 1.8.13
IRremoteESP8266 library 2.8.0

Is it possible to support ESP32-C3?
Example IRrecvDemo.ino does not compile

C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp: In member function 'uint32_t IRrecv::ticksLow(uint32_t, uint8_t, uint16_t)':
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1082:8: error: no matching function for call to 'max(int32_t, int)'
       0));
        ^
In file included from c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\algorithm:61,
                 from C:\Users\Alex1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32/Arduino.h:155,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.h:10,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:6:
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note: candidate: 'template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)'
     max(const _Tp& __a, const _Tp& __b)
     ^~~
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1082:8: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
       0));
        ^
In file included from c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\algorithm:61,
                 from C:\Users\Alex1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32/Arduino.h:155,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.h:10,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:6:
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1082:8: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
       0));
        ^
In file included from c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\algorithm:62,
                 from C:\Users\Alex1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32/Arduino.h:155,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.h:10,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:6:
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note: candidate: 'template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)'
     max(initializer_list<_Tp> __l)
     ^~~
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1082:8: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
       0));
        ^
In file included from c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\algorithm:62,
                 from C:\Users\Alex1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32/Arduino.h:155,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.h:10,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:6:
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1082:8: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
       0));
        ^
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp: In member function 'bool IRrecv::matchAtLeast(uint32_t, uint32_t, uint8_t, uint16_t)':
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1165:75: error: no matching function for call to 'min(uint32_t&, unsigned int)'
   return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
                                                                           ^
In file included from c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\algorithm:61,
                 from C:\Users\Alex1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32/Arduino.h:155,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.h:10,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:6:
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algobase.h:195:5: note: candidate: 'template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)'
     min(const _Tp& __a, const _Tp& __b)
     ^~~
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1165:75: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int')
   return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
                                                                           ^
In file included from c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\algorithm:61,
                 from C:\Users\Alex1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32/Arduino.h:155,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.h:10,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:6:
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algobase.h:243:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1165:75: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int')
   return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
                                                                           ^
In file included from c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\algorithm:62,
                 from C:\Users\Alex1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32/Arduino.h:155,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.h:10,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:6:
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algo.h:3450:5: note: candidate: 'template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)'
     min(initializer_list<_Tp> __l)
     ^~~
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1165:75: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
                                                                           ^
In file included from c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\algorithm:62,
                 from C:\Users\Alex1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32/Arduino.h:155,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.h:10,
                 from C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:6:
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algo.h:3456:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
c:\users\alex1\appdata\local\arduino15\packages\esp32\tools\riscv32-esp-elf-gcc\gcc8_4_0-esp-2021r2\riscv32-esp-elf\include\c++\8.4.0\bits\stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
C:\Users\Alex1\Documents\Arduino\libraries\IRremoteESP8266\src\IRrecv.cpp:1165:75: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   return measured >= ticksLow(std::min(desired, MS_TO_USEC(params.timeout)),
                                                                           ^
exit status 1
Error compiling for board ESP32C3 Dev Module.
@crankyoldgit crankyoldgit self-assigned this Dec 6, 2021
@crankyoldgit crankyoldgit added bug ESP32 ESP32 only issue labels Dec 6, 2021
@crankyoldgit
Copy link
Owner

Looks like the compiler is slightly different for the C3. Should be fixable.
Are you using PlatformIO? If so, can you please include the platformio.ini file please so we/I can try to replicate this build environment.

crankyoldgit added a commit that referenced this issue Dec 6, 2021
Seems the experimental Arduino support for the ESP32-C3 is a bit more finiky than the other environments.
Work around those issues by forcing the compiler to chose the correct std::min() & std::max() routines by casting the arguments.

Fixes #1695
@crankyoldgit
Copy link
Owner

PR #1696 should fix the compilation errors.

Note: This isn't a problem with the library per se, well, as far as I can tell. This seems to be an issue with the experimental Arduino ESP32-C3 support. I made up a mock ESP32-C3 environment (I have no C3 boards to test with) and I was able to get it to compile successfully. i.e. The IRrecvDumpV2 & IRMQTTServer examples.

Anyway, the workarounds I've added shouldn't cause an issue with any other platforms.

As I have no way of testing the resulting code, that's as far as I can go at the moment.

In short, it builds a binary as expected now, at least if you use a platformio.ini entry like: platformio/platform-espressif32#497 (comment)
That cause similar errors to the ones your reported prior to the fix.

Please download & test branch: https://github.com/crankyoldgit/IRremoteESP8266/tree/Issue1695

Warning: As far as I can tell ESP32-C3 Arduino support is in it's infancy. I wouldn't describe it as well tested/finished yet.

crankyoldgit added a commit that referenced this issue Dec 6, 2021
Seems the experimental Arduino support for the ESP32-C3 is a bit more finicky than the other environments.
Work around those issues by forcing the compiler to chose the correct `std::min()` & `std::max()` routines by casting the arguments.

Fixes #1695
crankyoldgit added a commit that referenced this issue Dec 31, 2021
_v2.8.1 (20220101)_

**[Bug Fixes]**
- Arduino ESP32 Core v2.0.2+ crashes due to our timer hack. (#1715 #1715)
- SONY: Fix old Sony CD-Player Remote (12 Bit) (#1714)

**[Features]**
- Add tool to convert protocol & code to raw timing info. (#1708 #1707 #1703)
- Add basic support for COOLIX48 protocol. (#1697 #1694)
- MITSUBISHI_AC: Added support for i-SAVE mode. (#1666)
- TOSHIBA_AC: Add Filter setting support. aka. Pure. (#1693 #1692)
- Airton: Add detailed A/C support. (#1688 #1670)

**[Misc]**
- Add a structured library version number. (#1717)
- Workflows Split UnitTests (#1712)
- Reduce time for workflow/Build (#1709)
- Fix some compiler & linter warnings (#1699 #1700)
- Fujitsu: Update supported A/C models (#1690 #1689 #1702 #1701)
- Remove extra `const` qualifier for char pointer (#1704)
- TCL: Update supported devices. (#1698)
- ESP32-C3: Work around for some C3 specific compiler issues. (#1696 #1695)
crankyoldgit added a commit that referenced this issue Jan 1, 2022
## _v2.8.1 (20220101)_

**[Bug Fixes]**
- Arduino ESP32 Core v2.0.2+ crashes due to our timer hack. (#1715 #1713 )
- SONY: Fix old Sony CD-Player Remote (12 Bit) (#1714)

**[Features]**
- Add tool to convert protocol & code to raw timing info. (#1708 #1707 #1703)
- Add basic support for COOLIX48 protocol. (#1697 #1694)
- MITSUBISHI_AC: Added support for i-SAVE mode. (#1666)
- TOSHIBA_AC: Add Filter setting support. aka. Pure. (#1693 #1692)
- Airton: Add detailed A/C support. (#1688 #1670)

**[Misc]**
- Add a structured library version number. (#1717)
- Workflows Split UnitTests (#1712)
- Reduce time for workflow/Build (#1709)
- Fix some compiler & linter warnings (#1699 #1700)
- Fujitsu: Update supported A/C models (#1690 #1689 #1702 #1701)
- Remove extra `const` qualifier for char pointer (#1704)
- TCL: Update supported devices. (#1698)
- ESP32-C3: Work around for some C3 specific compiler issues. (#1696 #1695)
@crankyoldgit
Copy link
Owner

FYI, the changes mentioned above have now been included in the new v2.8.1 release of the library.

crankyoldgit pushed a commit that referenced this issue Jan 9, 2022
crankyoldgit added a commit that referenced this issue Mar 14, 2022
_v2.8.2 (20220314)_

**[Bug Fixes]**
- ESP32-C3: Fix reboot/crashes on ESP32-C3s when receiving. (#1768 #1751)

**[Features]**
- HITACHI_AC296: Add `IRac` class support & tests. (#1776 #1758 #1757)
- Support for Hitachi RAS-70YHA3 (remote RAR-3U3) (#1758 #1757)
- LG: Add Swing Toggle support for Model `LG6711A20083V` (#1771 #1770)
- IRMQTTServer: add `MQTT_SERVER_AUTODETECT_ENABLE` via mqtt mDNS (#1769)
- Experimental basic support for Kelon 168 bit / 21 byte protocol. (#1747 #1745 #1744)
- MitsubishiAC: Tweak repeat gap timing. (#1760 #1759)
- Gree YAP0F8 (Detected as Kelvinator) vertical position set support (#1756)
- Make KELON (48 bit) protocol decoding stricter. (#1746 #1744)
- IRMQTTServer V1.6.1 (#1740 #1739 #1729)
- HITACHI_AC264: Add minimal detailed support. (#1735 #1729)
- LG2: Improve Light toggle msg handling. (#1738 #1737)
- MIDEA: Add support for Quiet, Clean & Freeze Protect controls. (#1734 #1733)
- Add basic support for HITACHI_AC264 264bit protocol. (#1730 #1729)
- ESP32-C3: Work around for some C3 specific compiler issues again. (#1732 #1695)

**[Misc]**
- MIDEA: Update supported devices (#1774 #1773 #1716)
- Update devices supported by ELECTRA_AC (#1766 #1765)
- Improve documentation for `encodePioneer()` (#1761 #1749)
- Update (un)supported DAIKIN128 devices. (#1752)
- Refactor `decodeCOOLIX()` code & add another test case. (#1750 #1748)
- Simplify code based on state_t being initialised by default. (#1736 #1699)
- Add comments to help Teknopoint users. (#1731 #1728)
- Fix library version string calculation. (#1727 #1725)
- Confirm we can reproduce `TurnOnFujitsuAC.ino` via IRac/IRMQTTServer. (#1726 #1701)
crankyoldgit added a commit that referenced this issue Mar 15, 2022
##_v2.8.2 (20220314)_

**[Bug Fixes]**
- ESP32-C3: Fix reboot/crashes on ESP32-C3s when receiving. (#1768 #1751)

**[Features]**
- HITACHI_AC296: Add `IRac` class support & tests. (#1776 #1758 #1757)
- Support for Hitachi RAS-70YHA3 (remote RAR-3U3) (#1758 #1757)
- LG: Add Swing Toggle support for Model `LG6711A20083V` (#1771 #1770)
- IRMQTTServer: add `MQTT_SERVER_AUTODETECT_ENABLE` via mqtt mDNS (#1769)
- Experimental basic support for Kelon 168 bit / 21 byte protocol. (#1747 #1745 #1744)
- MitsubishiAC: Tweak repeat gap timing. (#1760 #1759)
- Gree YAP0F8 (Detected as Kelvinator) vertical position set support (#1756)
- Make KELON (48 bit) protocol decoding stricter. (#1746 #1744)
- IRMQTTServer V1.6.1 (#1740 #1739 #1729)
- HITACHI_AC264: Add minimal detailed support. (#1735 #1729)
- LG2: Improve Light toggle msg handling. (#1738 #1737)
- MIDEA: Add support for Quiet, Clean & Freeze Protect controls. (#1734 #1733)
- Add basic support for HITACHI_AC264 264bit protocol. (#1730 #1729)
- ESP32-C3: Work around for some C3 specific compiler issues again. (#1732 #1695)

**[Misc]**
- MIDEA: Update supported devices (#1774 #1773 #1716)
- Update devices supported by ELECTRA_AC (#1766 #1765)
- Improve documentation for `encodePioneer()` (#1761 #1749)
- Update (un)supported DAIKIN128 devices. (#1752)
- Refactor `decodeCOOLIX()` code & add another test case. (#1750 #1748)
- Simplify code based on state_t being initialised by default. (#1736 #1699)
- Add comments to help Teknopoint users. (#1731 #1728)
- Fix library version string calculation. (#1727 #1725)
- Confirm we can reproduce `TurnOnFujitsuAC.ino` via IRac/IRMQTTServer. (#1726 #1701)
@crankyoldgit
Copy link
Owner

FYI, the changes mentioned above have now been included in the new v2.8.2 release of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ESP32 ESP32 only issue
Projects
None yet
2 participants