InfiniTime
InfiniTime copied to clipboard
add auto sleep
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
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 ?
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.
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
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.
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?
It would be nice to have even more checkboxes. Sleep Bluetooth comes to my mind.
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.
Is it in 24h time or 12h? (i.e. in your example, is it 1:00 PM to 8:30 AM or something else?)
It's 24H.
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???”
update UI to reduce confusion
Build size and comparison to main:
Section | Size | Difference |
---|---|---|
text | 410600B | 1332B |
data | 996B | 0B |
bss | 63356B | 0B |
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