Skip to content
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

ESP8266: Allow auto modem sleep if power off and sleep permitted #1184

Merged
merged 3 commits into from
Sep 20, 2020

Conversation

pfeerick
Copy link
Contributor

@pfeerick pfeerick commented Sep 15, 2020

Closes #1144.

Adds a 1ms delay only when main power is off and the noWifiSleep option is not active, and only for the ESP8266. This is needed for the automatic modem sleep to operate on the ESP8266 between DTIM beacons. The ESP32 appears to have a different mechanism, via the esp_wifi_set_ps() API call, but that a problem for another issue/PR.

I'm leaving this as a draft for now, until I've been able to test it for a few days for unforeseen side effects. ;)

To show the effect of this on my Wemos D1 Mini, I powered it via USB and put a calibrated power meter on it. The LED Strip and relay is still being powered via the main PSU.

Pre PR video - ~150ma continous

Post PR - rolling 90-120ma

Post PR - rolling 80-140ma - second meter

@pfeerick pfeerick changed the title ESP8266: Allow modem sleep if power off and sleep permitted ESP8266: Allow auto modem sleep if power off and sleep permitted Sep 15, 2020
@Aircoookie
Copy link
Member

Thank you :) Let me know once you believe it is ready for review!

@pfeerick
Copy link
Contributor Author

pfeerick commented Sep 20, 2020

I think it's time to call it cooked. Just short of 5 days uptime with zero stability issues. Driving a 507 led strip in four segments, with static and animated effects run each day and being poked by Home-Assistant for notifications, this seems to be mostly working - sometimes it seems to still get hung up in 'full power' mode, but if left alone long enough seems to revert to sleepy modem mode. Either that, or perhaps unticking "Disable WiFi sleep" doesn't always work without a restart (which would not surprise me given how... unpredictable... oh, alright, downright buggy... the ESP8266 API is).

image

I'll look as spinning up a ESP32 and see if I can see what's happening over there re: modem sleep, etc. I'll probably poke around the guts of WLED a bit more and see what's keep the ESP8266s attention, but I suspect it's the amount of network traffic / something on the network waking it up, not WLEDs fault.

@pfeerick pfeerick marked this pull request as ready for review September 20, 2020 04:19
@Aircoookie Aircoookie merged commit 1313a44 into wled:master Sep 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Missing delay to activate sleep mode on ESP8266
2 participants