WiFi: Fix setSleep() using cached instead of provided sleep type#12296
Conversation
👋 Hello niliha, 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 ...
|
5e44b63 to
dc28fd7
Compare
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit dc28fd7. ♻️ This comment has been updated with latest results. |
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]
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description of Change
It seems that with this commit a bug was introduced, where setSleep() does not set the provided sleep type on the driver, but uses a cached value which defaults to a power saving mode for all platforms expect for ESP32S2.
This only happens if WiFi has already been started in STA mode before invoking setSleep().
In my case (ESP32), when invoking setSleep(false) only once, this leads to the unexpected result that the sleep mode is still active.
This PR proposes a minimal change to use the provided sleep mode instead of using the cached value.
Test Scenario
Reproduction Steps
Expected Result (with Fix)
WiFi sleep mode is set to WIFI_PS_NONE;
Actual Result (without Fix)
WiFi sleep mode is set to WIFI_PS_MIN_MODEM;