Skip to content

Commit

Permalink
lap times without leading zeroes
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjourney committed Dec 14, 2024
1 parent 135e5f8 commit 5c2dba1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/displayapp/screens/StopWatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,24 @@ void StopWatch::RenderLaps() {
if (lap) {
TimeSeparated laptime = ConvertTicksToTimeSegments(lap->timeSinceStart);
char buffer[19];
if (laptime.hours == 0) {
snprintf(buffer, sizeof(buffer), "\n#%-3d %2d:%02d.%02d", lap->number, laptime.mins, laptime.secs, laptime.hundredths);
} else {
snprintf(buffer,
sizeof(buffer),
"\n#%-3d %3d:%02d:%02d.%02d",
if (laptime.hours > 0) {
snprintf(buffer, sizeof(buffer), "\n#%-3d %3d:%02d:%02d.%02d",
lap->number,
laptime.hours,
laptime.mins,
laptime.secs,
laptime.hundredths);
} else if (laptime.mins > 0) {
snprintf(buffer, sizeof(buffer), "\n#%-3d %2d:%02d.%02d",
lap->number,
laptime.mins,
laptime.secs,
laptime.hundredths);
} else {
snprintf(buffer, sizeof(buffer), "\n#%-3d %2d.%02d",
lap->number,
laptime.secs,
laptime.hundredths);
}
lv_label_ins_text(lapText, LV_LABEL_POS_LAST, buffer);
}
Expand Down

0 comments on commit 5c2dba1

Please sign in to comment.