InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Stopwatch Persistence

Open desttinghim opened this issue 4 years ago • 12 comments

I was using the stopwatch app while to track the cure time of epoxy (I didn't use the timer because I was working on many items in quick succession). I found a few annoyances with the stopwatch while doing so:

  • The current time is not displayed on the stopwatch screen
  • The stopwatch app could not be left without the stopwatch resetting

I was already planning to dig into the code, so I decided this was a great way to introduce myself to it. With this pull request, the following features are added/removed:

  • The current time is displayed on the stopwatch screen
  • The stopwatch will keep running while other screens are visited
  • The physical button no longer acts as a stop button (this is a personal preference)

To make this work I added StopWatchController to hold the state of the stopwatch, the elapsed time and 2 laps. The stopwatch app then uses this data when it's opened to display the correct values.

https://user-images.githubusercontent.com/10042482/138707672-75a924d5-1100-4cc7-a077-293d06c5dfd1.mp4

desttinghim avatar Oct 25 '21 13:10 desttinghim

How about displaying the battery percentage? It is already displayed in the menus and it would fill the empty space on the top right

maksalees avatar Oct 25 '21 20:10 maksalees

I figured out why the CI failed: I didn't run make all, and I didn't know about DisplayAppRecovery. I've just pushed a change that should fix that.

@maksalees Not a bad idea, I think I'll try implementing that.

@kieranc suggested in the pinetime-dev chat room that combining the stopwatch, timer, and alarm controllers could be a good idea. I think the idea has some merit, though I don't think that it will reduce the code much since they are quite different functionally. I think that would make a good follow up PR though.

desttinghim avatar Oct 27 '21 00:10 desttinghim

@maksalees I added the battery icon. It was pretty easy all things considered!

desttinghim avatar Oct 27 '21 01:10 desttinghim

This pr seems to break DFU. I have been able to consistently reproduce this in builds with this pr. I added the following pr's one by one: #698, #720, #557, #821, and after I added this one, DFU stopped working. Maybe it somehow conflicts with them?

Itai-Nelken avatar Dec 01 '21 20:12 Itai-Nelken

I'm not sure. I have to admit I goofed up and forgot to test if the code ran on the device, so I'll need to take some time and do that soon. What do you mean by "break DFU"? I'm not sure how you are using that here.

EDIT: I can't verify this RN (currently at work) but if it's a build issue it might be a conflict with #821, mostly noting so I can try that when I have time.

desttinghim avatar Dec 02 '21 21:12 desttinghim

What do you mean by "break DFU"? I'm not sure how you are using that here.

What is described here: https://github.com/InfiniTimeOrg/InfiniTime/issues/831#issuecomment-984188967 But sometimes the 'Error!' doesn't even show, it just goes back to the watchface.

I'll test develop + this pr and see if it's still an issue.

Itai-Nelken avatar Dec 02 '21 22:12 Itai-Nelken

What do you mean by "break DFU"? I'm not sure how you are using that here.

What is described here: #831 (comment) But sometimes the 'Error!' doesn't even show, it just goes back to the watchface.

I'll test develop + this pr and see if it's still an issue.

Apologies for the delay but I've flashed several DFUs over builds with this PR included and I haven't had any issues.

kieranc avatar Dec 06 '21 21:12 kieranc

I tried develop+this pr and DFU works fine.

Itai-Nelken avatar Dec 09 '21 21:12 Itai-Nelken

something I discovered when I forgot to stop the stopwatch: as the minutes side gets longer, it pushes the seconds out of the screen. maybe a limit to 99:99 minutes should be added and when it's reached, the stopwatch app opens and vibrates a few times to notify the user that it can't count more? (I haven't stopped it yet, it's currently at over 8300 minutes)

Itai-Nelken avatar Feb 02 '22 16:02 Itai-Nelken

maybe you could make the stopwatch number less big so when it attain 99:99 it become 1:00:00 with a final max to 99:99:99 (this time it would be the true max) Not much people will use such stopwatch unless for marathon that are over 1h

trman avatar Feb 02 '22 22:02 trman

@desttinghim Sorry it's taken a long time to review this. If you're still interested in working on this, please rebase this PR on develop. A PR should have minimal changes that are unrelated to the goal, so things like adding the current time, whether or not is a good addition, should not be included in this PR.

Riksu9000 avatar Jun 12 '22 16:06 Riksu9000

@Riksu9000 It's been a while since I've done anything with this. I'll take a look this weekend and see if I can get the code rebased.

desttinghim avatar Jun 13 '22 22:06 desttinghim

Do you still intend to rebase/have the time? I definitely this would be an important improvement if it can get shaped up to get merged in!

yusufmte avatar Oct 31 '22 19:10 yusufmte

I'm currently working on rebasing this and cleaning it up. I hope it'll be ready in a few hours. Edit: it's online, see https://github.com/InfiniTimeOrg/InfiniTime/pull/1410

pptime02 avatar Nov 01 '22 09:11 pptime02