-
Notifications
You must be signed in to change notification settings - Fork 35
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
Simplify interrupt handling #32
Conversation
- Simplify interrupt handling for RF24Gateway - Update examples to remove interrupt enable/disabling
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@@ -83,11 +82,9 @@ int main(int argc, char** argv) | |||
mesh.begin(); | |||
} | |||
|
|||
gw.interrupts(); // Re-enable interrupts when done accessing the radio |
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.
This kind of API change implies a feature (aka minor) version bump. We should probably add something to CMakeLists.txt that checks RF24 lib version. CMake's find_library()
doesn't seem to care about the found lib's version, so I might have to dig deeper into how to mandate a certain RF24 version -- find_library()
's VALIDATOR
arg (new in CMake v3.25) seems like a strong lead.
BTW, I was thinking this new Linux kernel IRQ support would be released under RF24 v1.5.0.
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.
Well most users should be using the installer, using the latest versions, but I see where you're going and its probably a good idea. Although these changes should still work with previous RF24 versions in theory.
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.
CMake's find_package()
has a version verification if a required version is specified! 👀 I'm not sure if that will work with RF24 as a shared library though.
I see now why you were so enthusiastic about Linux kernel IRQ support. Hopefully they don't break our implementation of it anytime soon. |
Haha, that was kind of an epic thread and coding session, but I think we are good for a while. |
- Add a longer delay similar to the polling example to minimize CPU usage
- Only delay if no IRQ and no radio data available
- When using interrupts, still use the old waitDelay variable to set the delay in the poll() function
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'll experiment with the version checking in CMake during a different PR.
* Simplify interrupt handling - Simplify interrupt handling for RF24Gateway - Update examples to remove interrupt enable/disabling * Modify delay - Add a longer delay similar to the polling example to minimize CPU usage * Only delay if no action - Only delay if no IRQ and no radio data available * Make delay configurable by users - When using interrupts, still use the old waitDelay variable to set the delay in the poll() function
cherry-picked this change to v1.x branch |
a: Change interrupt to toggle a variable instead of actually handling radio data
b: Move radio handling into the poll() function which is called anyway from the main loop