sleep_tracker_pinetime_wasp-os icon indicating copy to clipboard operation
sleep_tracker_pinetime_wasp-os copied to clipboard

Implement deepsleep()

Open GaryM0101 opened this issue 10 months ago • 4 comments

Looks like someone had some success implementing deepsleep() in the underlying nRF C code for micropython. I'm going to give this a try and see.

GaryM0101 avatar Mar 21 '25 15:03 GaryM0101

Hi ! Thanks for the heads up. Keep up updated!

thiswillbeyourgithub avatar Mar 22 '25 20:03 thiswillbeyourgithub

I patched in changes to modmachine.c and rebuilt the nRF port. The changes took just fine. I ran wasp-os for a day without any issues, however I don't believe we're calling deepsleep in the firmware anywhere to test it.

So today I put in the sleep "sleep profoundly" change into wasp.py. As soon as the screen went to sleep it would not respond to button pushes or even a long push to invoke the bootloader. So it went into a power-off mode and the pins became unresponsive (my guess).

I was able to reflash the bootloader via SWD pins and now back to looking at putting in a "pin sense" algorithm while in deepsleep.

I believe this is good step forward. We'll keep you in loop for any updates.

Cheers!

GaryM0101 avatar Mar 23 '25 15:03 GaryM0101

Thanks. I think I remember having read somewhere that there is a timeout argument to the deep sleep function that allows to sleep for at least some portion of a duty cycle in a way. So basically if in the loop of the main class of the code you call deep sleep then possibly you increase the battery quite a lot, no? I actually remember having coded something like this a while ago, but it did not change a lot and I learned the hard way that it was actually because deep sleep was not implemented so it was returning instantly.

thiswillbeyourgithub avatar Mar 23 '25 17:03 thiswillbeyourgithub

Found it : https://github.com/wasp-os/wasp-os/pull/454/files

It was a while ago there might be stupid things in that code

thiswillbeyourgithub avatar Mar 23 '25 17:03 thiswillbeyourgithub

I was able to do a pin sense argument and using the button and bring it out of deep sleep. However, deep sleep shuts down the everything including the clock, basically putting it into a hibernation (power-off) mode. Every time you take it out of deep sleep you need to set the clock and date.

Deep sleep does save power. I noticed no power loss, leaving it deep asleep for two weeks.

But having to update the clock every time makes it not usable, unless you can auto-sync the clock and update the current time automatically it's not worth the effort.

So closing this issue as it stands.

GaryM0101 avatar Apr 22 '25 19:04 GaryM0101

Thanks for the followup gary!

It's a bit weird no? If the watch is sleeping so hard that it's not even keeping the clock running it's almost like if it was powered off even. There must be some way to sleep hard while keeping the minimum alive, and the elapsed time sounds like the bare minimum no?

What is actually running during deep sleep? Because if no clock is running then it can't even know to wake up after some elapsed time either.

Edit: rerrading your message it's basically what you said sorry. But what is even running during deep sleep? I find it very surprising that the clock is not even running

thiswillbeyourgithub avatar Apr 22 '25 21:04 thiswillbeyourgithub