diff options
| author | codingjourney <coding@journey.sk> | 2024-11-28 05:19:34 +0100 |
|---|---|---|
| committer | JF <JF002@users.noreply.github.com> | 2025-11-04 21:25:31 +0100 |
| commit | f720a7fb3ce40880319ceba79eb00a9699dbc1ef (patch) | |
| tree | 345a695b5a02c756617c6f37628961993720d72c /src/components | |
| parent | 5c2d4a515112f8ba6a23f34d59c8a481368a1e79 (diff) | |
upper bound for lap numbers
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/stopwatch/StopWatchController.cpp | 2 | ||||
| -rw-r--r-- | src/components/stopwatch/StopWatchController.h | 3 |
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; }; } |
