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

Added Trip meter to Steps app #764

Merged
merged 6 commits into from
Dec 30, 2021
Merged

Conversation

stephanie-eng
Copy link
Contributor

Fixes #694

  • Added a lap button (similar to the lap button in Stopwatch) to reset the step counter.
  • Added a total step count in that does not get reset in the bottom right corner.
  • Moved/shrank existing Steps UI to fit the new button and total step count
  • Added a variable to MotionController to save the steps since the last lap.

Note that using the lap button does not reset the progress to the daily step goal. The progress bar uses the total step count.

The image below demos the new button after fresh boot with (1) 0 steps, (2) the watch after taking some steps (step count and total updated and equal), (3) pressing the lap button (step count reset, no change to total), and (4) after walking again (step count and total updated, but not equal).

image

I also checked that large step counts do not cause display issues.

image

@Riksu9000
Copy link
Contributor

Since this doesn't, and probably shouldn't count laps, it should be thought of as a trip counter instead. While the daily step count resets automatically every day, the trip count would only reset when the user presses a reset button.

I think the UI should be tweaked to better accommodate the new features.

Here's an example of something I came up with quickly.

Untitled

@stephanie-eng
Copy link
Contributor Author

Thanks for your input. I've changed the lap button to a trip reset button and made the UI changes. The below image shows the new behaviour:

  1. The watch after fresh boot, no steps taken. Steps and trip meter are both 0.
  2. The watch after taking 36 steps, trip meter matches step count
  3. Pressing the reset button resets the trip meter to 0, without changing the step count. Progress bar for step goal also remains unchanged.
  4. Setting the time to before midnight to reset the daily step count
  5. Step count in the UI is shown to be 0
  6. Step count after midnight in the step app: step count reset to 0, but trip meter remains unchanged from 36. Progress bar for step goal is reset to 0.
  7. Taking an additional 20 steps increments step count to 20, and trip meter to 56 (36 steps from yesterday + 20 from the new day)
  8. Trip meter can be set back to 0 with the reset button

image

@Riksu9000
Copy link
Contributor

I think there's an issue with this. The trip steps are only updated when the app is open, so if the app isn't opened, the trip doesn't increase. If at 4 in your newest example we take more steps, so let's say it's at 50 when the steps reset, the trip would still be 36, when it should be 50 right? If I don't check the app for multiple days, it misses the steps from those days. I think the trip counter should be updated similar to how new steps are added.

@stephanie-eng
Copy link
Contributor Author

Good point - thanks for the catch. I've changed the trip meter to update with the steps rather than from the app. I also found a bug in my logic for detecting new days and fixed that as well.

@markmatney
Copy link

Cool feature! A couple other ideas/suggestions:

  • I think the trip counter should also reset when the main counter resets, since (according to my understanding) InfiniTime uses "midnight" as a proxy for "user is sleeping" (which I hope becomes configurable at some point)
  • I wonder if the UI would look better if:
    • the trip value is left-padded with spaces so that it is right-aligned with the goal value, e.g.
      Goal: 10000
      Trip:    36
      
    • there is a bit more space below the word "Steps"
  • I also think it would be cool if the trip value is displayed on the progress meter along with the main counter

@Riksu9000
Copy link
Contributor

think the trip counter should also reset when the main counter resets, since (according to my understanding) InfiniTime uses "midnight" as a proxy for "user is sleeping" (which I hope becomes configurable at some point)

Someone might be on a trip for multiple days and wants to know all the steps taken during that time. Also if they both reset at the same time, they always show the same value by default. There's really no reason to reset it automatically.

the trip value is left-padded with spaces so that it is right-aligned with the goal value

Seems like a good idea. I wonder if the numbers should be limited to some maximum value, like six numbers?

I also think it would be cool if the trip value is displayed on the progress meter along with the main counter

The arc widget can't show two arcs, but maybe another arc could be placed on top? How would the progress be calculated though? It doesn't really make sense to compare the trip to the daily goal.

@markmatney
Copy link

Someone might be on a trip for multiple days and wants to know all the steps taken during that time.

I hadn't thought of that. Good point. Requiring a manual reset would support both the single day and multi day use case. That would be identical to the UI of the trip meter on a car odometer, I guess.

It doesn't really make sense to compare the trip to the daily goal.

I might see myself wanting to compare the trip to the current daily progress. If I have two logical "activities" in my day which both require walking, I could think of current_daily_progress - trip as a measure of the first activity, and then simply trip as a measure of the second activity. Being able to get a sense of how the two compare, at a glance, might be valuable to me.

Back to your idea though, I suppose for the multi day use case, the "goal" could be interpreted as the trip goal instead of the daily goal, in which case being able to compare the two at a glance might make more sense. The arcs might be displayed concentrically so that they can both be seen at all times, regardless of whether the trip count is smaller or larger than the current daily progress.

@stephanie-eng stephanie-eng changed the title Added "Lap" button to Steps app Added Trip meter to Steps app Oct 22, 2021
@stephanie-eng
Copy link
Contributor Author

Changed the text to left pad + added some more space between the step count and the text. I think it looks pretty good now - check out the picture below:

image

Note that the padding is for 5 characters, so if you set your step goal to 100 000+, the alignment will not work. I figure that having a goal of 100 000+ daily steps is pretty ambitious. We can pad for 6 digits, but that makes the text pretty wide and I don't think that looks as nice.

I think there are some good ideas for additional features in this thread .However, to make the review process simpler, I would prefer to keep one feature per PR, and merge this first before adding more features to it.

src/displayapp/screens/Steps.cpp Outdated Show resolved Hide resolved
src/displayapp/screens/Steps.h Outdated Show resolved Hide resolved
src/components/motion/MotionController.h Outdated Show resolved Hide resolved
@stephanie-eng
Copy link
Contributor Author

Thanks for the review - I've incorporated your suggested changes from above.

@Riksu9000 Riksu9000 self-assigned this Oct 27, 2021
Copy link
Collaborator

@Avamander Avamander left a comment

Choose a reason for hiding this comment

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

Looks good style and format-wise. Needs testing on a physical device.

@stephanie-eng
Copy link
Contributor Author

To produce the above screenshots, I did test the code with a physical device. If anyone else would like to try it as another point of data, that could be good.

As an aside, clang-format didn't initially work with VSCode in the container out of the box for me - I had to tweak some settings to get it to use the right executable and format on save. I can create a separate issue to document this.

FintasticMan added a commit to FintasticMan/InfiniTime that referenced this pull request Dec 13, 2021
Squashed commit of the following:

commit 4b4f1a2
Author: Stephanie <[email protected]>
Date:   Sun Oct 31 11:53:13 2021 -0400

    Ran clang-format

commit cd747a2
Author: Stephanie <[email protected]>
Date:   Sat Oct 23 13:41:10 2021 -0400

    Renamed confusing variables and general cleanup

commit 308ddde
Author: Stephanie <[email protected]>
Date:   Fri Oct 22 19:21:51 2021 -0400

    Changed text to left pad

commit 5098895
Author: Stephanie <[email protected]>
Date:   Thu Oct 21 23:37:35 2021 -0400

    Moved trip meter update to MotionController and changed trip meter logic

commit 3a20b48
Author: Stephanie <[email protected]>
Date:   Wed Oct 20 14:29:10 2021 -0400

    Changed lap counter to trip meter

commit 09e29a5
Author: Stephanie <[email protected]>
Date:   Tue Oct 19 23:42:48 2021 -0400

    Added "lap" button to step counter
@JF002 JF002 added this to the 1.8.0 milestone Dec 30, 2021
@JF002
Copy link
Collaborator

JF002 commented Dec 30, 2021

@stephanie-eng Thank you for this nice first PR! It's very well documented with test cases and pictures! I would be happy if we received more PR like this one as it makes the review much easier!

@JF002 JF002 merged commit e0013e7 into InfiniTimeOrg:develop Dec 30, 2021
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.

Manual step counter reset
5 participants