Skip to content

Conversation

@Boteium
Copy link
Contributor

@Boteium Boteium commented Nov 26, 2022

This PR add the option to automatically toggle on/off sleep mode during the night
This should address issue #1440

Copy link
Contributor

@Itai-Nelken Itai-Nelken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been using this for the last few days and it works very well though it is a bit annoying that it always returns to notifications on mode when stopping sleep. It would be better if it would return to the previous notification state in my opinion.

@Boteium
Copy link
Contributor Author

Boteium commented Dec 2, 2022

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 ?

@Itai-Nelken
Copy link
Contributor

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.

@Boteium
Copy link
Contributor Author

Boteium commented Dec 2, 2022

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

@FintasticMan
Copy link
Member

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.

@kieranc
Copy link
Contributor

kieranc commented Dec 16, 2022

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?

@escoand
Copy link

escoand commented Dec 16, 2022

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

@Boteium
Copy link
Contributor Author

Boteium commented Dec 18, 2022

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.

@LinuxinaBit
Copy link

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

@Boteium
Copy link
Contributor Author

Boteium commented Feb 21, 2023

It's 24H.

@LinuxinaBit
Copy link

LinuxinaBit commented Feb 21, 2023

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???”

mark9064 added a commit to mark9064/InfiniTime that referenced this pull request May 8, 2023
commit d2fc306
Author: Boteium <boteium@users.noreply.github.com>
Date:   Fri Dec 2 14:58:31 2022 +0800

    update option name

commit efbe748
Author: SuIông N <Boteium@users.noreply.github.com>
Date:   Fri Dec 2 14:55:49 2022 +0800

    Update title

    Co-authored-by: Itai Nelken <70802936+Itai-Nelken@users.noreply.github.com>

commit 0f1cc69
Author: Boteium <boteium@users.noreply.github.com>
Date:   Sat Nov 26 18:18:43 2022 +0800

    add auto sleep
mark9064 added a commit to mark9064/InfiniTime that referenced this pull request May 27, 2023
commit d2fc306
Author: Boteium <boteium@users.noreply.github.com>
Date:   Fri Dec 2 14:58:31 2022 +0800

    update option name

commit efbe748
Author: SuIông N <Boteium@users.noreply.github.com>
Date:   Fri Dec 2 14:55:49 2022 +0800

    Update title

    Co-authored-by: Itai Nelken <70802936+Itai-Nelken@users.noreply.github.com>

commit 0f1cc69
Author: Boteium <boteium@users.noreply.github.com>
Date:   Sat Nov 26 18:18:43 2022 +0800

    add auto sleep
@Boteium
Copy link
Contributor Author

Boteium commented Jun 22, 2023

update UI to reduce confusion
InfiniSim_2023-06-22_224919

@github-actions
Copy link

github-actions bot commented Jun 22, 2023

Build size and comparison to main:

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

@KaffeinatedKat KaffeinatedKat mentioned this pull request Oct 2, 2023
@mark9064
Copy link
Member

mark9064 commented Dec 13, 2023

Works well 👍 (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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants