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

settings: Add sleep/wake notification times #2002

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chmeeedalf
Copy link

Add configure screens for sleep and wake notification times, so the watch can automatically set notifications to sleep or on as applicable.

This could probably be done in a much better way, but I didn't want to refactor the whole date/time UI to add this. An alternative, doing that, is to create a widget base class for all time-like setting widgets, and derive from that for each of the various interfaces.

Copy link

github-actions bot commented Feb 3, 2024

Build size and comparison to main:

Section Size Difference
text 374896B 2080B
data 948B 0B
bss 22544B 8B

@JF002
Copy link
Collaborator

JF002 commented Feb 11, 2024

Hi and thanks for your first contribution to the InfiniTime project !
Could you explain into more detail what those changes do? Maybe add a few screenshots of the new UI?

Oh and also do not forget to check that those changes are consistent with the InfiniTime vision.

@FintasticMan
Copy link
Member

I think this is similar to #1461, right? I think this is a very useful feature, let's decide on a good implementation together. It might be good if you could upload pictures from InfiniSim to see the UI.

@chmeeedalf
Copy link
Author

@FintasticMan yes, it's exactly like that, I didn't see it before. Here are a couple screenshots:

image

image

image

(I noticed I forgot to change "current time" in my code, until I looked closer to get the screenshot).

Setting sleep and wake times to the same value disables the operation.

const int hoursValue = hourCounter.GetValue();
const int minutesValue = minuteCounter.GetValue();
NRF_LOG_INFO("Setting wakeup time to %02d:%02d:00", hoursValue, minutesValue);
settingsController.SetSleepTime(static_cast<uint8_t>(hoursValue),
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is setting the sleep time instead of the wake time.

NRF_LOG_INFO("Setting sleep time to %02d:%02d:00", hoursValue, minutesValue);
settingsController.SetSleepTime(static_cast<uint8_t>(hoursValue),
static_cast<uint8_t>(minutesValue));
settingSetSleepWakeTime.Quit();
Copy link
Contributor

Choose a reason for hiding this comment

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

This will make pressing the "set" button advance to the set wake time screen (like what happens with the set date & time setting).

Suggested change
settingSetSleepWakeTime.Quit();
settingSetSleepWakeTime.Advance();

uint8_t h, m;

lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(title, "Set current time");
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you said you changed this? maybe you forgot to push the change?

Suggested change
lv_label_set_text_static(title, "Set current time");
lv_label_set_text_static(title, "Set wake time");

Copy link
Author

@chmeeedalf chmeeedalf Dec 13, 2024

Choose a reason for hiding this comment

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

I must've only changed it in my InfiniSim checkout, which seems to have vanished for me, too. Will update, along with all your suggestions.

@Itai-Nelken
Copy link
Contributor

I have been testing this pr (with my suggestions above) for the past few days, and for some reason, sleep mode only automatically starts if the notification settings is set to ring (and not do not disturb). I don't see any code that does that, so I think its a weird bug?

@chmeeedalf
Copy link
Author

I have been testing this pr (with my suggestions above) for the past few days, and for some reason, sleep mode only automatically starts if the notification settings is set to ring (and not do not disturb). I don't see any code that does that, so I think its a weird bug?

It's intentional. SetNotificationStatusByTime() first checks if the notification status is "Off" (looks like DnD to me), and if so it doesn't change it. The idea being that you would explicitly set/unset DnD, and the watch changing it itself would be a surprise, and go against your desire to not be disturbed.

Add configure screens for sleep and wake notification times, so the
watch can automatically set notifications to sleep or on as applicable.
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.

4 participants