Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sleep settings #2230

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

JustScott
Copy link
Contributor

@JustScott JustScott commented Jan 18, 2025

Add a settings page for enabling/disabling actions to be done when sleep is turned on or off.

Added Options:

  • Allow Always on Display
  • Allow Chimes
  • Allow Notifications
  • Disable Ble (Ble is turned back on when sleep is turned off only if you had it on before enabling sleep)

Selecting 'Allow Notify' will disable the 'Disable Bluetooth' setting, and vice versa, as notifications cannot be received without Bluetooth enabled.

I wanted to add an option for disabling steps, but failed to find a way in the code to do this. The step count would just update once sleep was turned off. Any help with this would be much appreciated... but I'm also fine with that option being left out.

InfiniSim_2025-01-18_110929
InfiniSim_2025-01-18_114426

Copy link

github-actions bot commented Jan 18, 2025

Build size and comparison to main:

Section Size Difference
text 374316B 1292B
data 948B 0B
bss 22552B 16B

Run in InfiniEmu

@mark9064
Copy link
Member

I'm a bit confused as to what this is for. Sleep mode is for when you're sleeping - so I don't think that chimes, AOD or notifications should ever be allowed as you're not awake to see them. As for BLE, there are a couple of reasons I can think of, such as if you power off your phone at night and don't want anyone to be able to connect to your pinetime? But this seems like something that should be fixed with a security mode rather than worked around. I'd be interested to hear what you were aiming for here, I think there's definitely room to rework the modes but I'm not sure this is the best path forward

@JustScott
Copy link
Contributor Author

@mark9064

I'm a bit confused as to what this is for. Sleep mode is for when you're sleeping - so I don't think that chimes, AOD or notifications should ever be allowed as you're not awake to see them. As for BLE, there are a couple of reasons I can think of, such as if you power off your phone at night and don't want anyone to be able to connect to your pinetime? But this seems like something that should be fixed with a security mode rather than worked around. I'd be interested to hear what you were aiming for here, I think there's definitely room to rework the modes but I'm not sure this is the best path forward

I originally created this as I wanted AOD at night so that I could see the time whenever I wake up without having to click my watch, then I thought it would be nice to have the option to get notifications if you, for example, sleep with your phone outside of your room and recieve a call. The chime option being allowed could be helpful for those trying to get into lucid dreaming. The Ble setting is nice to turn on to conserve battery life if you don't need notifications at night anyways.

@mark9064
Copy link
Member

I see where you're coming from now. I guess the dilemma is that if InfiniTime supported every possible configuration someone could want, it'd just be too big and complex to fit on the watch and maintain. So there is the InfiniTime vision where particularly there is "Prefer solid defaults over customisability". Of course this isn't a black and white rule, it's up to interpretation of whether a setting is a good idea or not (or there would be no settings at all right!).

So I'm not trying to hate on your idea! But more trying to weigh up whether this is a feature that is worth pulling in, or if it's something that would better live in a fork. A rule of thumb I try to use is "would the average user need to change this". When I go through the settings at the moment, I can say yes for everything: users need to choose watchface, imperial/metric units, switch 12h/24h, set the time etc. But I struggle to see this so much for this feature, which is why I'm more reserved towards it. It's hard to decide particularly for settings as they are part of the OS (as apps can be disabled/enabled by default easily)

@mark9064 mark9064 added the new feature This thread is about a new feature label Jan 23, 2025
@JustScott
Copy link
Contributor Author

@mark9064 I agree this probably goes beyond the infinitime vision, specifically for an official system setting, considering not everyone would find this useful. I think this feature could better serve the user as part of a sleep app, perhaps, if someone wants to adapt the code into there branch... otherwise I'm going to keep using this and keep it up to date with the main branch if anyone wants to add it to there fork. Thanks for the conversation mark!

Add a settings page for enabling/disabling actions to be done when
sleep is turned on or off.

Added Options:
- [x] Allow Always on Display
- [x] Allow Chimes
- [x] Allow Notifications
- [x] Disable BLE
@JustScott JustScott force-pushed the sleep_settings branch 2 times, most recently from 99bd6bd to 7c9b630 Compare February 16, 2025 05:38
@JustScott
Copy link
Contributor Author

Replaced Allow AOD with Enable AOD

Leaving it as Allow AOD assumes the user wants it the same during the day as during sleep. In my opinion the user would either want AOD on during sleep or they wouldn't.

new_enable_aod_sleep_option

Leaving it as "Allow AOD" assumes the user wants it the same
during the day as during sleep. In my opinion the user would
either want AOD on during sleep or they wouldn't.
@JustScott JustScott force-pushed the sleep_settings branch 2 times, most recently from 43f89d8 to b886afe Compare February 18, 2025 16:54
@JustScott
Copy link
Contributor Author

JustScott commented Feb 18, 2025

Add an Ignore Steps option:
new_sleep_settings

When enabled and in sleep mode, motionController tracks the steps in the variable ignoreSteps and subtracts that from the total steps stored in nbSteps before returning the step count. This stop steps from counting up during sleep, and doesn't show them when sleep is disabled either.
show_sleep_disabling_steps

Added this PR to Infinisim to fix a build error

I believe this should also apply to the step count sent to companion apps, but I haven't tested this yet.

Don't count up trip steps during sleep. Check if deltaSteps is greater
than zero before adding to ignoreSteps as well as trip steps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This thread is about a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants