-
Notifications
You must be signed in to change notification settings - Fork 832
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
[Build] Add compatibility with C++20 #2040
base: master
Are you sure you want to change the base?
[Build] Add compatibility with C++20 #2040
Conversation
Looks like the linter and doxygen need some fix to support conditional compilation 👎 |
Have you considered defining internal types separately, all the #if s are becoming quite messy? |
I'll think about that, but IMHO it'll be about as messy... 😞 |
Now using typedefs for everything that was defined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm for the atomic_ changes, not sure about the rest which is more relevant to platformio than c++?
…witching interrupts off/on instead of (missing) low-level IDF calls
@tonhuisman Why going back to core 2.0.x? Makes no sense. The platform 2023.10.03 is NOT based on IDF5.1 EDIT: Comment race condition ;-) |
@tonhuisman Adding this fixes the compile error and no code change regarding interrupts are needed
|
Thanks! 🦸 |
…disable`, thnx Jason2866!
FYI. I've seen this PR and been thinking about how to do this "better" in a way. Btw .. thanks ever so much for all the work you've all put into this PR, it's awesome. You've done a great job. I just want to clean up something we inherited from the original IRremote library and the early days of this library. That stuff was left pretty much unchanged because it was magic code & worked, and assumed people know exactly what they were doing. My research in to In short, I want to enlist you guys (@tonhuisman & @Jason2866, tasmota etal) in helping to better fix it, and I don't want to just copy a lot of your work and pretend it was my work. |
Looking forward to do testing on all ESP32x MCUS. Considering to do a RMT driver? |
I've changed my mind on the approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What tests on actual hardware have been done? i.e. Does it still capture okay on ESP32s & 8266s?
@@ -21,6 +21,12 @@ extern "C" { | |||
#include "IRremoteESP8266.h" | |||
#include "IRutils.h" | |||
|
|||
#if defined(ESP32) | |||
#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) | |||
#include <driver/gpio.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this hurt or cause an issue if it is always included?
i.e. Can we just include this header all the time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm more inclined to only add includes when really needed, trying to avoid unneeded code being pulled in the build or having unexpected interactions.
@crankyoldgit The changes fixes the compile, but it is not useable at all. With actual Arduino 3.0 alpha2 it crashes. In my earlier builds it did not crash but the receiving recognition rate was horrible. Tests where done with Tasmota and your provided receive test example. |
I did the changers to the new timer interface of esp-idf 5.1 only by documentation. I have most certainly missed something here because I'm not sure how it worked before, nor how it is supposed to work with the new timers. I will receive my ESP32 test device shortly to do actual tests. |
Hmm. I'll probably have to dust off my old ESP32 as well. |
…, update Platform build
Hi @tonhuisman, I am facing the same problem. When I am compiling the IR receiver code in ESP-IDF, I am getting the following errors: "/home/iotminds/esp/ESP-IDF-CPP-Template/components/IRremoteESP8266-master/src/IRrecv.cpp: In function 'void gpio_intr()': After removing the IRrecv.cpp file configuration in the ESP-IDF CMakeLists.txt and recompiling the code, the compilation is successful, and the IR send code is working. However, after replacing the IRrecv.cpp, IRrecv.h, IRremoteESP8266.h, and IRutils.h files from commit 9cfcebc, the compilation is successful, but the IR receive code is not working. The ESP module is continuously restarting, and the following error is encountered. "I (32) boot: ESP-IDF v5.2-dev-2164-g3befd5fff7-dirty 2nd stage bootloader [ 84][E][esp32-hal-timer.c:105] timerBegin(): Resolution cannot be reached with any clock source, aborting! ELF file SHA256: 25bc68b7f Is there a solution available to resolve this problem, or could you provide any assistance? Additionally, any estimate on the time required to address this issue would be helpful. |
I assume you are compiling the code from this branch? (though it looks like you don't... 🤔) |
Thank you for your response. I am aware that the patch has not been
integrated into the master branch. To address this, in the master branch, I
replaced four files: IRrecv.cpp, IRrecv.h, IRremoteESP8266.h, and
IRutils.h, with the versions from this commit:
9cfcebc
.
While I believe this replacement may make the code functional, it appears
that the original patch is not effective."
Thanks and Regards
Sagar M.
…On Fri, 10 Nov, 2023, 5:50 pm Ton Huisman, ***@***.***> wrote:
I assume you are compiling the code from this branch? (though it looks
like you don't... 🤔)
The master branch doesn't have these adjustments included yet.
—
Reply to this email directly, view it on GitHub
<#2040 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBRO5NMLZUCNOCT5CF6QXVTYDYLXZAVCNFSM6AAAAAA5WJEGFOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBVGY2DAMJRHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
You have to use latest commit db98aa0 |
Hi Jason,
Thank you for your prompt response. I appreciate your guidance, and I will
proceed with applying the mentioned commit.
…On Fri, 10 Nov, 2023, 9:53 pm Jason2866, ***@***.***> wrote:
You have to use latest commit db98aa0
<db98aa0>
—
Reply to this email directly, view it on GitHub
<#2040 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBRO5NOYBINJOMS7IIKIOLTYDZIHHAVCNFSM6AAAAAA5WJEGFOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBWGAZTKNJQG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi @Jason2866, I have applied the commit you suggested: db98aa0. The compilation is successful without any errors, still IR receive code is not working get the error log continuously [E (501) gptimer: gptimer_start(344): timer is not enabled yet]. However, the IR send code is functional. I've included my code below along with the code logs. Could you please review and suggest what mistake I might have made? Your assistance would be greatly appreciated. Module : ESP-32 [My code ] #include "Arduino.h" const uint16_t kRecvPin = 15; const uint32_t kBaudRate = 115200; #if DECODE_AC #define LEGACY_TIMING_INFO false IRrecv irrecv(kRecvPin, kCaptureBufferSize, kTimeout, true); IRsend irsend(kIrLed); uint16_t rawData[439] = {3460, 1752, 426, 472, 426, 1264, 466, 470, 424, 434, 462, 470, 426, 470, 448, 448, 448, 446, 448, 410, 464, 470, 426, 432, 464, 470, 450, 448, 426, 1300, 426, 472, 450, 446, 426, 432, 462, 434, 490, 444, 444, 414, 486, 448, 444, 1248, 466, 1264, 464, 1264, 466, 432, 466, 468, 426, 1304, 426, 434, 464, 470, 424, 472, 450, 444, 426, 434, 464, 472, 424, 472, 426, 470, 424, 470, 448, 448, 450, 408, 464, 470, 426, 470, 426, 430, 464, 470, 426, 432, 462, 434, 486, 410, 462, 434, 462, 434, 486, 448, 450, 406, 488, 446, 452, 446, 448, 408, 484, 414, 488, 408, 488, 410, 488, 408, 486, 410, 486, 1244, 462, 1266, 486, 410, 490, 406, 482, 414, 488, 408, 490, 406, 486, 9988, 3496, 1712, 492, 408, 490, 1238, 488, 410, 462, 474, 426, 430, 488, 448, 450, 408, 488, 408, 486, 408, 490, 408, 490, 404, 490, 406, 488, 408, 490, 1238, 488, 410, 488, 408, 490, 408, 488, 408, 488, 410, 486, 410, 464, 434, 488, 1240, 490, 1240, 488, 1242, 488, 410, 488, 408, 486, 1242, 488, 410, 488, 446, 452, 444, 448, 410, 488, 410, 488, 408, 488, 408, 488, 408, 486, 410, 488, 408, 488, 408, 490, 408, 486, 410, 486, 410, 486, 410, 492, 404, 488, 1240, 488, 408, 490, 406, 492, 406, 488, 408, 492, 406, 488, 408, 488, 1240, 488, 1242, 492, 1238, 490, 1240, 488, 410, 488, 408, 486, 410, 488, 408, 488, 408, 486, 448, 450, 408, 490, 406, 490, 406, 488, 1242, 490, 1238, 488, 410, 490, 406, 486, 410, 488, 1242, 490, 1240, 486, 1242, 492, 406, 464, 438, 484, 408, 490, 406, 488, 408, 488, 410, 486, 410, 488, 408, 490, 408, 490, 404, 488, 408, 490, 406, 488, 408, 490, 406, 486, 410, 488, 410, 486, 410, 490, 406, 490, 1240, 488, 1242, 490, 1240, 488, 410, 488, 406, 490, 406, 490, 406, 490, 408, 486, 410, 492, 406, 490, 406, 488, 408, 486, 1244, 486, 1242, 488, 1242, 488, 410, 488, 408, 490, 406, 498, 398, 490, 406, 488, 408, 488, 408, 486, 408, 488, 408, 488, 408, 492, 406, 490, 406, 488, 410, 492, 404, 490, 406, 470, 428, 486, 1242, 488, 408, 490, 406, 488, 1242, 488, 410, 488, 408, 490, 406, 488, 1242, 492, 406, 490, 404, 490, 406, 488, 410, 490, 406, 490, 406, 486, 410, 488, 408, 486, 408, 486, 410, 486, 410, 492, 404, 488, 408, 494, 402, 488, 408, 488, 408, 490, 406, 488, 1240, 490, 408, 488, 410, 488, 1240, 488, 1242, 488, 408, 488, 1244, 486}; extern "C" void app_main() #if defined(ESP8266) Serial.printf("\n" D_STR_IRRECVDUMP_STARTUP "\n", kRecvPin); pinMode(19,OUTPUT); while(true){ if (irrecv.decode(&results)) { } [LOGS] I (33) boot: ESP-IDF v5.2-dev-2164-g3befd5fff7-dirty 2nd stage bootloader I (0) cpu_start: App cpu up. Backtrace: 0x400FB3E2:0x3FFB10C0 0x400FB58E:0x3FFB10E0 0x400832A5:0x3FFB1100 0xGuru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0). 0x400fb58e: task_wdt_isr at /home/iotminds/esp/esp-idf/components/esp_system/task_wdt/task_wdt.c:585 0x400832a5: _xt_lowint1 at /home/iotminds/esp/esp-idf/components/xtensa/xtensa_vectors.S:1236 Core 0 register dump: A2 : 0x00800000 A3 : 0x20000000 A4 : 0x00000000 A5 : 0x00001496 0x4000c2f6: memcpy in ROM Core 0 was running in ISR context: 0x4000921a: uart_tx_one_char in ROM Backtrace: 0x40009217:0x3ffb0f50 0x40007d13:0x3ffb0f70 0x40007c69:0x3ffb0f90 0x40008106:0x3ffb0fb0 0x40081b26:0x3ffb1040 0x40081d00:0x3ffb1060 0x40081d6a:0x3ffb1090 0x400fb3e2:0x3ffb10c0 0x400fb58e:0x3ffb10e0 0x400832a5:0x3ffb1100 0x400835c7:0x3ffb6500 0x40082c63:0x3ffb6520 0x400f2d93:0x3ffb6540 0x400eac3f:0x3ffb6560 0x400eacd4:0x3ffb6580 0x400eaeee:0x3ffb65c0 0x400d7275:0x3ffb65e0 0x40110c16:0x3ffb6650 0x4008996a:0x3ffb6680 0x40007d13: ets_write_char_uart in ROM 0x40007c69: ets_write_char in ROM 0x40008106: ets_printf in ROM 0x40081b26: print_entry at /home/iotminds/esp/esp-idf/components/esp_system/port/arch/xtensa/debug_helpers.c:44 0x40081d00: esp_backtrace_print_from_frame at /home/iotminds/esp/esp-idf/components/esp_system/port/arch/xtensa/debug_helpers.c:82 0x40081d6a: esp_backtrace_print at /home/iotminds/esp/esp-idf/components/esp_system/port/arch/xtensa/debug_helpers.c:102 0x400fb3e2: task_wdt_timeout_handling at /home/iotminds/esp/esp-idf/components/esp_system/task_wdt/task_wdt.c:461 (discriminator 3) 0x400fb58e: task_wdt_isr at /home/iotminds/esp/esp-idf/components/esp_system/task_wdt/task_wdt.c:585 0x400832a5: _xt_lowint1 at /home/iotminds/esp/esp-idf/components/xtensa/xtensa_vectors.S:1236 0x400835c7: gpio_intr_service at /home/iotminds/esp/esp-idf/components/driver/gpio/gpio.c:493 0x40082c63: esp_timer_impl_get_time at /home/iotminds/esp/esp-idf/components/esp_timer/src/esp_timer_impl_lac.c:140 0x400f2d93: delayMicroseconds at /home/iotminds/esp/ESP-IDF-CPP-Template/components/arduino/cores/esp32/esp32-hal-misc.c:225 0x400eac3f: IRsend::_delayMicroseconds(unsigned long) at /home/iotminds/esp/ESP-IDF-CPP-Template/components/IRremoteESP8266-master/src/IRsend.cpp:119 0x400eacd4: IRsend::mark(unsigned short) at /home/iotminds/esp/ESP-IDF-CPP-Template/components/IRremoteESP8266-master/src/IRsend.cpp:177 0x400eaeee: IRsend::sendRaw(unsigned short const*, unsigned short, unsigned short) at /home/iotminds/esp/ESP-IDF-CPP-Template/components/IRremoteESP8266-master/src/IRsend.cpp:547 0x400d7275: app_main at /home/iotminds/esp/ESP-IDF-CPP-Template/main/main.cpp:64 0x40110c16: main_task at /home/iotminds/esp/esp-idf/components/freertos/app_startup.c:217 (discriminator 13) 0x4008996a: vPortTaskWrapper at /home/iotminds/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162 Core 1 register dump: A2 : 0x00000000 A3 : 0x00000000 A4 : 0x3ffaf8c0 A5 : 0x3ffaf8a0 A10 : 0x00000000 A11 : 0x00000000 A12 : 0x80089c56 A13 : 0x3ffb7140 Backtrace: 0x400852ab:0x3ffb7230 0x400d3313:0x3ffb7250 0x400883d5:0x3ffb7270 0x4008996a:0x3ffb7290 0x400d3313: esp_vApplicationIdleHook at /home/iotminds/esp/esp-idf/components/esp_system/freertos_hooks.c:59 0x400883d5: prvIdleTask at /home/iotminds/esp/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4364 (discriminator 1) 0x4008996a: vPortTaskWrapper at /home/iotminds/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162 |
Hi @Jason2866 , |
Looks like compiled with IDF. Don't know if the lib works with IDF |
Recently, the Arduino ESP32 launched a stable version of V3.0.0, it seems that some interfaces in the library have changed, resulting in failure to compile through |
Thanks you for your reply, which arduino versions are compatible for the
Compilation. Can you please suggest it to me.
…On Fri, 31 May, 2024, 7:51 am Zhentao-Lin, ***@***.***> wrote:
Recently, the Arduino ESP32 launched a stable version of V3.0.0, it seems
that some interfaces in the library have changed, resulting in failure to
compile through
—
Reply to this email directly, view it on GitHub
<#2040 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBRO5NOEVYO77DPXBQVGDRTZE7NA7AVCNFSM6AAAAAA5WJEGFOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBRGEZDGNRZGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
V2.0.14 before can use this library, V2.0.15-V2.0.17 I have not tested, it should be OK. Neither V3.0.0 is possible. |
Thank you for your update regarding the library versions. I will proceed
with verifying these library versions and ensure compatibility. Should I
encounter any issues or require further clarification, I will reach out to
you.
…On Fri, 31 May, 2024, 8:18 am Zhentao-Lin, ***@***.***> wrote:
V2.0.14 before can use this library, V2.0.15-V2.0.17 I have not tested, it
should be OK. Neither V3.0.0 is possible.
—
Reply to this email directly, view it on GitHub
<#2040 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBRO5NNRSZBIPRNCWJQPKG3ZE7QGJAVCNFSM6AAAAAA5WJEGFOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBRGE2DCNRYGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Works for me without errors, if add "bool timerStarted(hw_timer_t *timer);" to "esp32-hal-timer.h" and "esp32-hal-timer.c" and use this function in "IRrecv.cpp". Base were the commits 9cfcebc and db98aa0 Test and files can be found here : https://github.com/mboehmerm/Three-IPS-Displays-with-ST7789-170x320-240x280-240x320/tree/main/IRremoteESP8266 Added in esp32-hal-timer.h
Added in esp32-hal-timer.c
In the file IRrecv.cpp i replaced
with
and
with
I hope there is a better solution without modifying the esp32-hal-timer files. |
@mboehmerm Dont know what's causing the need that you have to modify files. |
This is the first solution i found, that works with Arduino IDE without any errors. Is there a better solution? Where can i find it? |
🤔 (... sorry, too obvious...) |
I get an error
|
I'm also seeing the same error as @almirus regarding gptimer when using Arduino IDE targeting a M5Stack NanoC6. The library also fails to receive the NEC codes that were previously working under ESP32 2.0.17 - so I don't believe they're spurious either. |
I'm considering merging #2144 which only has changes for ESP32 CoreV3, that way we don't risk breaking anything for earlier versions? After that we could look into merging any other changes? How does that sound? |
We have been using these adjustments on the Arduino 3.x/IDF 5.x builds of ESPEasy since I started this PR, so I see no reason not to merge this, and other relevant changes. |
In principle I agree, #2144 is a duplicate, but there is also about the cleanest solution. (read: easiest to review) In it's current state it essentially only has added lines and no changes, which I can validate does not create any new issues for <V3 My hope is that this PR can be rebased on #2144 and then review the remaining parts. |
The scope of this PR is to instate compatibility with C++20, not 'just' Arduino 3.x. |
Feature:
volatile
operators like++
and volatile method argumentsResolves #2039