aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/stopwatch/StopWatchController.cpp2
-rw-r--r--src/components/stopwatch/StopWatchController.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/components/stopwatch/StopWatchController.cpp b/src/components/stopwatch/StopWatchController.cpp
index 7af80367..311bccc7 100644
--- a/src/components/stopwatch/StopWatchController.cpp
+++ b/src/components/stopwatch/StopWatchController.cpp
@@ -34,7 +34,7 @@ void StopWatchController::Clear() {
void StopWatchController::AddLapToHistory() {
TickType_t lapEnd = GetElapsedTime();
history[0].timeSinceStart = lapEnd;
- history[0].number = ++maxLapNumber;
+ history[0].number = ++maxLapNumber % lapNumberBoundary;
history--;
}
diff --git a/src/components/stopwatch/StopWatchController.h b/src/components/stopwatch/StopWatchController.h
index 800ca1b3..0791701c 100644
--- a/src/components/stopwatch/StopWatchController.h
+++ b/src/components/stopwatch/StopWatchController.h
@@ -55,9 +55,10 @@ namespace Pinetime {
// Maximum number of stored laps
static constexpr int histSize = 2;
+ static constexpr int lapNumberBoundary = 1000;
// Lap storage
Utility::CircularBuffer<LapInfo, histSize> history;
- // Highest lap number; may exceed histSize
+ // Highest lap number; less than lapNumberBoundary, may exceed histSize
int maxLapNumber;
};
}