InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

add auto sleep

Open Boteium opened this issue 2 years ago • 13 comments

This PR add the option to automatically toggle on/off sleep mode during the night This should address issue https://github.com/InfiniTimeOrg/InfiniTime/issues/1440

Boteium avatar Nov 26 '22 10:11 Boteium

Restoring previous state should be something easy to implement.

We would have to modify "QuickSettings.cpp", because notification state can change after auto sleep is set. we would also need to modify notification state variable. Notification::Sleep should became an independent variable, or, a new variable for storing previous state should be introduced.

However, I have concern that too many changes might block this PR Do you think we should take one baby step at a time and make state-restoring a future PR ?

Boteium avatar Dec 02 '22 07:12 Boteium

However, I have concern that too many changes might block this PR from being merged. Do you think we should take one baby step at a time and make state-restoring a future PR ?

I think you're right. Baby steps are better.

Itai-Nelken avatar Dec 02 '22 09:12 Itai-Nelken

There's another undefined behavior. What if previous setting is "sleep" ? Should the notification be set to on, off , or sleep ? I can imagine each option would have its supporters.

In the mean time, this is the "back to previous status" but "back to off if is already in sleep" version. https://github.com/Boteium/InfiniTime/tree/auto_sleep_v2

Boteium avatar Dec 02 '22 10:12 Boteium

I think that returning to notifications off if it was set to sleep before auto sleep kicked in is probably the best solution. I think it might also be good for sleep to turn off when the alarm rings.

FintasticMan avatar Dec 02 '22 11:12 FintasticMan

I like this, it's a much needed feature IMO. I can't imagine a situation where I'd want it to enter sleep mode automatically then not leave sleep mode, is there a reason I'm missing for the 'stop sleep' being a separate checkbox? It would look cleaner with only one checkbox plus start/end times.

edit: the name should probably be changed as 'sleep setting' could be confusing. Quiet hours maybe?

kieranc avatar Dec 16 '22 09:12 kieranc

It would be nice to have even more checkboxes. Sleep Bluetooth comes to my mind.

escoand avatar Dec 16 '22 15:12 escoand

I originally design it this way because I might manually enter sleep/off mode (go to bed early) but may forget to turn it on in the morning. That's why there are two checkboxs and why "stop sleep" is set to "on" instead of previous state. The UI also make sure users cannot set start/stop to the same time. (only one checkbox will be active in this case)

I agree "sleep mode" should be something simple and easy to use. I also like the idea of even fine grained customization. I do have auto brightness on my build so I can certainly see the reason of auto sleep bluetooth. But meragable PR is my focus for now. Maybe we can keep the default UI simple but let user set the advanced options on the companion app when PR 1441 is ready.

Boteium avatar Dec 18 '22 11:12 Boteium

Is it in 24h time or 12h? (i.e. in your example, is it 1:00 PM to 8:30 AM or something else?)

LinuxinaBit avatar Feb 20 '23 22:02 LinuxinaBit

It's 24H.

Boteium avatar Feb 21 '23 09:02 Boteium

Maybe reducing it to 30 minute increments would allow localization indicators like time zone to fit in sort of an 8:30 PM configuration as well as a 20 : 30 configuration, each with two buttons. Seems less confusing than saying 8h 30m which seems like it would leave people going “8 hours from what???”

LinuxinaBit avatar Feb 21 '23 14:02 LinuxinaBit

update UI to reduce confusion InfiniSim_2023-06-22_224919

Boteium avatar Jun 22 '23 15:06 Boteium

Build size and comparison to main:

Section Size Difference
text 410600B 1332B
data 996B 0B
bss 63356B 0B

github-actions[bot] avatar Jun 22 '23 15:06 github-actions[bot]

Works well :+1: (daily driven since may) Only change I'd suggest is that the minutes spinner shouldn't change the hours. No other time picker I've ever used does this and I found it quite surprising. Definitely a personal preference thing though, not a deal breaker at all

mark9064 avatar Dec 13 '23 22:12 mark9064