fix(5ghz): Rework WiFi LR logic for 5GHz chips#12202
Conversation
👋 Hello me-no-dev, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 90 files 90 suites 31m 50s ⏱️ For more details on these failures, see this check. Results for commit 055873e. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
This PR refactors WiFi Long Range (LR) mode handling to support dual-band ESP32 chips (2.4GHz and 5GHz) with ESP-IDF >= 5.4.2. The changes introduce helper functions to encapsulate LR protocol detection and configuration, replacing direct protocol manipulation with more maintainable code.
Key Changes:
- Introduced three helper functions (
_wifi_is_lr_enabled,_wifi_enable_lr,_wifi_disable_lr) to manage LR protocol state with special handling for dual-band configurations - Defined protocol bitmask macros (
WIFI_PROTOCOL_DEFAULT,WIFI_PROTOCOL_DEFAULT_5G) to centralize protocol definitions - Refactored
WiFiGenericClass::modeto use helper functions instead of direct ESP-IDF API calls
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request refactors and enhances how Long Range (LR) WiFi mode is enabled and disabled, especially for platforms supporting multiple bands (2.4GHz and 5GHz) and newer ESP-IDF versions. The changes introduce helper functions to manage LR mode more robustly and update the logic in the main WiFi mode handler to use these helpers, improving maintainability and compatibility.
Long Range (LR) WiFi Protocol Handling:
_wifi_is_lr_enabled,_wifi_enable_lr, and_wifi_disable_lrto encapsulate the logic for detecting, enabling, and disabling Long Range WiFi mode, with special handling for platforms supporting both 2.4GHz and 5GHz bands and ESP-IDF >= 5.4.2.WIFI_PROTOCOL_DEFAULT,WIFI_PROTOCOL_DEFAULT_5G) to simplify protocol selection based on hardware and configuration support.Refactoring of WiFi mode logic:
WiFiGenericClass::modemethod to use the new helper functions for enabling/disabling LR mode, replacing direct protocol manipulation with more robust and readable code. This ensures correct protocol handling and better error reporting.Fixes: #12200