-
-
Notifications
You must be signed in to change notification settings - Fork 959
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
Timer: Remember last timer setting #2013
base: main
Are you sure you want to change the base?
Conversation
Build checks have not completed. Possible reasons for this are:
|
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.
Thanks for this 1st contribution @tausen !
There is no difference between restarting a paused timer and starting a new one, so briefly pausing will also update the suggested new duration
I'm wondering if this would be the expected behavior by the users. Shouldn't the timer be reset to the last settings instead of the last paused value? This is an open question, I'm not really sure about this.
src/displayapp/screens/Timer.cpp
Outdated
@@ -6,6 +6,8 @@ | |||
|
|||
using namespace Pinetime::Applications::Screens; | |||
|
|||
static std::chrono::seconds lastTimer; |
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.
Is the global static variable needed here? Couldn't we add this variable as a member variable of the class?
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.
Had resolved, but latest commit re-introduces this -- if lastTimer
is a member of the Timer app, it'll be destroyed when closing the app... Open for suggestions :)
25a479d
to
ec17031
Compare
Thanks for the feedback! PR updated accordingly.
After some contemplation I've updated the PR to handle pause and stop differently. This ended up a bit more intrusive, but ultimately for the better IMO :) I couldn't really find a good way to fit two buttons in the bottom like in the stopwatch app without things getting tight, so I've re-used the hold action on the start/stop/pause button:
I also had to nudge |
Pushed one more commit (to be squashed or discarded) -- this saves the last timer setting as soon as it's changed instead of when the timer expires or is stopped. The user can now enter the timer app, configure it for some duration, exit the app again (for example to read a notification), then go back to the timer app and not have to re-configure it. |
New to this project and just got my first PineTime, I'm super happy with it! I had a Samsung Watch Active before and it resets to the initial value once the timer expires which to me seems correct. |
Remember last duration used in Timer app. Stop with long press while paused. Reset to zero with long press while stopped.
ld reports "region RAM overflowed with stack" otherwise
Thanks for the input, @thun11o, I believe the behavior with my changes should match what you're used to then :) I've rebased this branch onto the latest main. |
I've started work on a version based on #1971 over here: https://github.com/tausen/InfiniTime/tree/timer-ringing-memory |
Remember last duration used in Timer app. Reset to zero with long press on start button.
Fixes #1991
Tested in InfiniSim and on hardware, seems to work as desired:
A few notes to consider:
std::chrono::seconds
is probably lighter (less memory, fewer divisions/modulo 60), but this is probably more readable? I have no strong opinions here.