InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.64k stars 907 forks source link

stopwatch: Add hours tracking #1692

Closed fossison closed 1 year ago

fossison commented 1 year ago

Addresses https://github.com/InfiniTimeOrg/InfiniTime/issues/394

Screenshot of changes

It adds hours without changing any of the existing formatting, but by re-using it as needed.

Once the timer is > 1 hour, the main display becomes Hours:Minutes, and the part beneath becomes Seconds:Milliseconds. Lap timer will display "Hours:Minutes:Seconds.Milliseconds" when a lengthy timer is recorded.

github-actions[bot] commented 1 year ago
Build size and comparison to main: Section Size Difference
text 406632B 176B
data 940B 0B
bss 53560B 0B
Riksu9000 commented 1 year ago

I think I was unclear when writing the comment on the issue. I was thinking that the font would shrink, but not by default. Instead it would shrink once the time to display is large enough. I think with this idea it can be a bit hard to tell what the numbers mean. Also you need to apply a modulo operation to the minutes, otherwise the displayed time will be wrong.

fossison commented 1 year ago

Revision

Revised based on feedback above.

EDIT: Didn't realize I got the screenshot mid update, sorry.

Riksu9000 commented 1 year ago

I set oldTimeElapsed to 3'680'000 to skip ahead. Don't forget to test your code. The following happens because the label is aligned before setting the text to "00:00" in SetInterfaceStopped().

InfiniSim_2023-03-22_131106

fossison commented 1 year ago

I set oldTimeElapsed to 3'680'000 to skip ahead. Don't forget to test your code. The following happens because the label is aligned before setting the text to "00:00" in SetInterfaceStopped().

Thanks for the tip, much easier than what I was doing (or not doing in the case of that last commit lol). All should be fixed now