Feature/complete radio driver guards #36
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/complete-radio-driver-guards"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Type of Change
Related Issues
Testing Performed
Hardware Tested
Code Quality Checklist
Breaking Changes
Screenshots/Logs
Additional Notes
Summary of Changes
Hello @okapteinis, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request enhances the robustness and portability of the codebase by introducing conditional compilation guards around radio driver-related code. The changes ensure that radio driver initialization and declarations are only included when the
RADIO_DRIVER_AVAILABLEmacro is defined, preventing compilation errors and allowing the system to build correctly across various hardware configurations, regardless of radio driver support.Highlights
radio_init()) and the seeding of the fast random number generator (fast_rng.begin(radio_get_rng_seed())) inexamples/companion_radio/main.cppare now conditionally compiled using#if RADIO_DRIVER_AVAILABLE. This ensures these operations only occur when a radio driver is present, preventing compilation errors on platforms without one.externdeclaration forradio_driverinvariants/sensecap_indicator_d1l/target.hhas been placed inside an#if RADIO_DRIVER_AVAILABLEblock. This prevents compilation issues on platforms where the radio driver is not supported or available, improving code portability.Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either
/gemini <command>or@gemini-code-assist <command>. Below is a summary of the supported commands on the current page./gemini review/gemini summary/gemini helpCustomization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a
.gemini/folder in the base of the repository. Detailed instructions can be found here.Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩︎
Code Review
This pull request aims to add preprocessor guards to conditionally compile radio driver code. While the intent is good, the implementation is incomplete and introduces compilation errors. The changes make the definition of key objects like
the_meshandradio_driverconditional, but their usages are not, which will break the build whenRADIO_DRIVER_AVAILABLEis disabled. I've left two critical comments with details on how to fix these issues by ensuring all related code is properly guarded.@ -128,3 +129,4 @@if (!radio_init()) { halt(); }fast_rng.begin(radio_get_rng_seed());#endifWhile adding this guard is a good start, it introduces a compilation issue. The object
the_meshis defined within an#if RADIO_DRIVER_AVAILABLEblock (lines 96-102), but its usages throughoutsetup()andloop()are not conditionally compiled. This will cause a build failure whenRADIO_DRIVER_AVAILABLEis not defined. Please wrap all usages ofthe_meshwith the same preprocessor directive. For example,the_mesh.loop()at line 229 and multiple calls withinsetup()need to be guarded.@ -26,2 +26,4 @@extern ESP32Board board;#if RADIO_DRIVER_AVAILABLEextern WRAPPER_CLASS radio_driver;#endifGuarding the
externdeclaration ofradio_driveris correct, but this change is incomplete and will lead to compilation errors. The definition ofradio_driverinvariants/sensecap_indicator_d1l/target.cpp(line 67) is not guarded. Furthermore, radio-related functions likeradio_init()(declared at line 49) useradio_driverbut are not guarded. WhenRADIO_DRIVER_AVAILABLEis false,radio_driverwill be undeclared, causing a build failure. To fix this, you need to wrap all radio-related code, including function declarations in this file (lines 49-53) and their definitions and related objects intarget.cpp, with#if RADIO_DRIVER_AVAILABLE.