LightningPiggy / lightning-piggy

LILYGO TTGO T5 2.13 and 2.66 inch DEPG ePaper Display
https://www.lightningpiggy.com/
GNU Lesser General Public License v2.1
6 stars 4 forks source link

Smarter (or no) sleep depending on battery #2

Closed ThomasFarstrike closed 6 months ago

ThomasFarstrike commented 1 year ago

When the Lightning Piggy receives a payment, it would be nice if this is immediately visible on the display, as instant feedback is more gratifying for the users, confirms that all works well, etc.

Therefore, we should add an "awake mode" so the device doesn't go to sleep after refreshing everything, but instead stays awake and polls the lnbits backend every X seconds (example: 10 seconds) or better yet, keeps a websocket open so it gets instant notifications (if lnbits supports this). Then, if the amount of sats changed, it should update the sats amount on the display and the payment messages so the user sees the incoming payment. In awake mode, it should also refresh the other display items (wifi signal strength etc) every so often.

The piggy should stay in "awake mode" as long as:

The piggy should stay in "awake mode" for a few minutes if:

Finally, the sleep duration of the piggy should depend on the battery voltage. Something like:

ThomasFarstrike commented 6 months ago

Since noone stepped up, I've started working on this, as the deadline is fast approaching!

ThomasFarstrike commented 6 months ago

https://github.com/LightningPiggy/lightning-piggy/tree/issue-2-smarter-or-no-sleep-depending-on-battery

ThomasFarstrike commented 6 months ago

I implemented all of the above. Being in this "forever awake" mode (when battery powered) or "awake for a while" (while manually started) took some rework because it changes the previous model of "boot, display stuff, sleep until next boot".

ThomasFarstrike commented 6 months ago

This is ready and deployed in v2.0.0 in the webinstaller.