vedderb / vesc_express

The source code for the VESC Express
GNU General Public License v3.0
41 stars 34 forks source link

Add lisp extensions to reduce power consumption #36

Closed nitrousnrg closed 3 months ago

nitrousnrg commented 3 months ago

Two extensions were added:

Here is an example of power consumption without going to sleep (it does turn off the radio though) image

And this is how it looks like when you put it to light sleep between transmissions. image

vedderb commented 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?

nitrousnrg commented 3 months ago

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.

nitrousnrg commented 3 months ago

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.

vedderb commented 3 months ago

Looks good! Can you also make a PR to BLDC and update the documentation?

vedderb commented 3 months ago

FYI: I have updated the code a bit. The hold and deepsleep hold functions are now separate.

nitrousnrg commented 3 months ago

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!

vedderb commented 3 months ago

Done already. Hope I got it right. https://github.com/vedderb/bldc/commit/75e8955251552bd88f35649e13bc8d281c98a659

nitrousnrg commented 3 months ago

Done already. Hope I got it right. vedderb/bldc@75e8955

I couldn't have done it better, thanks!