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
Fix attach_interrupt(...) for esp-idf framework #2416
Fix attach_interrupt(...) for esp-idf framework #2416
Conversation
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
Tomorrow, I'll dig up a normal dual core ESP32 to see if the fix is only applicable to ESP32 unicore. |
Okay, this PR is useful for a regular dual core EPS32 as well. I tried flashing one with the rotary encoder for testing the interrupt setup, and this is what I ended up with:
So the same symptom here. |
no, only laziness 😝 |
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.
LGTM. let me know if you want to move it to cpp, otherwise we can also merge now
I will move it to the .cpp file. Moved the PR to draft for the time being. |
Alright, moved the code to the .cpp file, and added an error log now I had access to |
Ow, checks failing, that's what you get for committing at 3am 😄 I'll fix the issues tomorrow, and give the code a spin on a few of my devices for testing. |
Okay, the code should be ready now. The checks are running, fingers crossed 🤞 |
What does this implement/fix?
The
attach_interrupt(...)
implementation for the esp32 component usesESP_INTR_FLAG_LEVEL5
forgpio_install_isr_service(...)
. This interrupt level requires handlers that are written in assembly. Therefore C-code handler are not acceptable and using those results in a failed interrupt setup.Additionally, the return value of
gpio_install_isr_service(...)
was not checked, resulting in aLoadProhibited
abort, because of a NULL pointer exception. further down the road. I added a check to see if it actually returnsESP_OK
.Note:
Adding some logging in case of a fail would be a nice to have, but this code currently lives in the
gpio_idf.h
file and not thegpio_idf.cpp
file. That makes the structure different from the other .h files and I shouldn't define aTAG
in this .h file for logging purposes.Is there a reason why this code is in the .h file or is it okay if I split declaration and implementation between respectively the .h and the .cpp file here?
Types of changes
Related issue or feature (if applicable): fixes esphome/issues#2483
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#
Test Environment
Example entry for
config.yaml
:Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: