Closed nitrousnrg closed 3 months ago
What is the state_sleep argument used for in light sleep? Should it not be enough to give it a time-argument that tells it how long to sleep as it will return after it?
Also, how do TCP sockets, bluetooth etc. behave in light sleep? Do they get restored properly when waking up?
Oh I agree, it should have the same arguments as sleep-deep. It's calling esp_wifi_restore() and esp_wifi_start() but those should be called from the user script after the sleep is resumed.
Will update the function and add the extensions that we need (wifi-restore wifi-start) in a few days.
We haven't tested TCP and bluetooth, we only tested espnow and as long as you restore/start the wifi again it works well.
Here's a cleaner update!
at least for espnow, you do need to issue the (wifi-start) upon resume that this commit adds. You don't really need (wifi-stop) as it already stops it when it goes to sleep, but we added it anyway just to make it complete.
Looks good! Can you also make a PR to BLDC and update the documentation?
FYI: I have updated the code a bit. The hold and deepsleep hold functions are now separate.
FYI: I have updated the code a bit. The hold and deepsleep hold functions are now separate.
Ok good
Looks good! Can you also make a PR to BLDC and update the documentation?
Yes, will take care of that today, thanks!
Done already. Hope I got it right. https://github.com/vedderb/bldc/commit/75e8955251552bd88f35649e13bc8d281c98a659
Done already. Hope I got it right. vedderb/bldc@75e8955
I couldn't have done it better, thanks!
Two extensions were added:
sleep-light
: This shuts down the CPU and peripherals, but unlike deep sleep, the data is RAM is preserved so it easier to work with.Here is an example of power consumption without going to sleep (it does turn off the radio though)
And this is how it looks like when you put it to light sleep between transmissions.
gpio-configure-hold
: When a sleep command is issued, the GPIOs return to the default state which is often unwanted/dangerous. If you need the GPIOs to stay at the same level, this function latches them so they don't change state when you go to sleep. The latch must be manually disabled if you want to change the GPIO pin state.