-
-
Notifications
You must be signed in to change notification settings - Fork 955
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
Basic alarm app #662
Basic alarm app #662
Conversation
Thank you very much for this PR, many people are requesting this app for a long time, it's more than welcome!
That's OK for me : we start with a first simple implement and we improve it later on! At first sight, the code looks pretty good! There's just this minor detail: all method should start with a capital letter, even private ones. Ex : https://github.com/JF002/InfiniTime/pull/662/files#diff-f09dce847462bd3e0850bdd9ead3aef31f554a3736ee1d5378fa3e394d8f7de2R47 |
Great! I miss this so much on PT. It's a great start and yet it would be cool to have more than one alarm, I must admit I usually have just one active most of the time. I know people who has plenty of them, but I could live with just one. I have a couple of suggestions to improve the app without making it a full-featured one.
|
Thanks all for the comments and suggested fixes. Looks pretty straightforward. "Size must be set before alignment" - thanks! I finally understand why the buttons were never where I expected them. Makes sense in hindsight. |
@adocampo thanks for the feedback. Here's what I think on these features:
|
The settings controller is very easy to interact with so you can store the alarms there - have a look at the steps goal settings app |
I'd keep the scope as it is right now and discuss improvements under #366. Discussing improvements there would help focusing on things in the scope of this PR and polishing it up. |
I agree, with @Avamander, let's keep the scope of the PR simple, so that we can have a first basic alarm app, and let's improve it in future PRs ;) |
I think that |
First day of week setting is very likely a future improvement. |
To address this in the short term, I changed the label for the "weekdays" mode to "MON-FRI", so at least it's clear when the alarm will go off. Thanks for bringing this up; I wasn't aware of how much variation there is around the world in the standard work-week. Of course, even in each region there are lots of people who don't work the standard work-week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the qualms I had have been resolved. (But I very much invite others to take a look as well)
src/displayapp/screens/Alarm.cpp
Outdated
lv_obj_set_size(btnHoursDown, 60, 40); | ||
lv_obj_align(btnHoursDown, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, 35); | ||
txtHrDown = lv_label_create(btnHoursDown, nullptr); | ||
lv_label_set_text(txtHrDown, "-"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these lv_label_set_text
functions can be changed to lv_label_set_text_static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/displayapp/screens/Alarm.h
Outdated
uint8_t alarmHours = 0; | ||
uint8_t alarmMinutes = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These get initialised to the AlarmController values in the constructor, so setting them to 0 here can be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
uint8_t hours; | ||
uint8_t minutes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are uninitialized, and should probably be set to around 7 o'clock by default instead of midnight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, initialized hours to 7 and minutes to 0
void AlarmController::SetAlarm(uint8_t alarmHr, uint8_t alarmMin) { | ||
hours = alarmHr; | ||
minutes = alarmMin; | ||
state = AlarmState::Set; | ||
ScheduleAlarm(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I change the time without enabling the alarm, the new time won't be saved. Perhaps this function could just set the time, and ScheduleAlarm() could be made public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - changed SetAlarm to SetAlarmTime and made ScheduleAlarm public.
I realized that StartRingingDisregardSettings() doesn't work, since RunForDuration also checks the notification setting and won't vibrate if notifications are disabled. Maybe I should remove my changes to MotorController and wait for #664 - that looks like a better solution anyway. |
I agree, we can handle the notifications/vibrations in #664 |
Would be really nice if there would be an icon on the watch face if the alarm is set |
I've tested this a little bit, it seems to work, the vibrations could be stronger but that's for another PR, and the alarm should definitely be stored in settings IMO, but that can also come later. |
Thanks again for this Alarm App, @mruss77! For those interested, I can see some nice additions forfuture PRs:
|
Great job @mruss77 !! Hope InfiniTime devs can handle persistent storage for both time/date and alarms, because right now the bluetooth disconnects quite often and the only way to re-pair is rebooting the watch, so re-setting the alarm at each reboot would lead to an unreliable alarm system, as probably people can forget to set it again and... well, be late at work for this. |
This is really great! |
@adocampo - thanks! Yeah, we definitely need to store the alarm. That'll be part of building the more fully functional alarm app. @moriel5 - The alarm works fine with the 12-hour clock, but you have to set the time in 24-hour format (so if you want 5 PM, set it for 17:00). I agree it would be nice to use the 12-hour format on this screen if the user has selected that option, but it only affects the UI, not the functionality. Another to-do for the improved alarm app. |
So pretty much as I had expected. I have no qualms in setting it using 24h, 12h format is simply more comfortable to me (in my country, both are used interchangeably, 24h mostly when displayed, 12h mostly used verbally). |
@mruss77 it seems the alarm does not vibrate when the InfiniTime "DND" setting (notifications disabled) is on - I almost didn't wake up this morning because of that ;) Apart from that, super nice job, I love the app!! <3 |
Sorry if this is not the right place to make this question, but as I'm interested in testing this app, I will ask and I expect someone to point in the right direction. How can I install this on a sealed PT without waiting for the firmware upgrade? |
@adocampo You can build your own firmware package, documentation is available in the repository. |
@ncartron - yes, sorry about that but it's a known issue. That is being fixed in #664. Currently the DND setting disables all vibrations from all apps, including the alarm, metronome, timer, etc. That update will set it to disable only notifications. |
right - thanks for the update @mruss77 , and noted! |
ok - i'll see with @JF002 what the plans are :) |
@ncartron - the change to DND has been merged this afternoon! |
yup, thanks @mruss77 - JF told me already ;) |
I think there's an easy way to make several alarms - just switch, say, three identical screens by horizontal swipes. It shouldn't take too much code, but handy when you have several things not to forget. |
I added a basic alarm app that allows you to set one alarm to go off once, every day, or on weekdays (M-F).
I know there is discussion in issue 366 about a full-featured alarm app with multiple alarms, which looks great. This basic alarm meets my simple need to wake up on time in the morning.
The UI is one screen based off the Timer app UI:
Video of the alarm in action: https://www.youtube.com/watch?v=9U8QRy7Ixpw
I added a method to MotorController to activate the "ringer" (repeating vibrations) even if notifications are turned off in settings. I like to turn off notifications when I go to sleep so I'm not woken up by some random 3 AM email, but I still need the alarm to go off in the morning.
Any comments or suggestions welcome.