From 487205ef6a8e81fe887a1fcd72fee9c4de33c81f Mon Sep 17 00:00:00 2001 From: codingjourney Date: Sat, 30 Nov 2024 22:23:31 +0100 Subject: length of lap list adapting to available space --- src/components/stopwatch/StopWatchController.cpp | 2 +- src/components/stopwatch/StopWatchController.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/stopwatch/StopWatchController.cpp b/src/components/stopwatch/StopWatchController.cpp index 64261055..4979ee68 100644 --- a/src/components/stopwatch/StopWatchController.cpp +++ b/src/components/stopwatch/StopWatchController.cpp @@ -33,9 +33,9 @@ void StopWatchController::Clear() { void StopWatchController::AddLapToHistory() { TickType_t lapEnd = GetElapsedTime(); + history--; history[0].timeSinceStart = lapEnd; history[0].number = ++maxLapNumber % lapNumberBoundary; - history--; } int StopWatchController::GetMaxLapNumber() { diff --git a/src/components/stopwatch/StopWatchController.h b/src/components/stopwatch/StopWatchController.h index 6aaec2b2..210cbeaa 100644 --- a/src/components/stopwatch/StopWatchController.h +++ b/src/components/stopwatch/StopWatchController.h @@ -56,7 +56,7 @@ namespace Pinetime { TickType_t timeElapsedPreviously; // Maximum number of stored laps - static constexpr int histSize = 2; + static constexpr int histSize = 4; // Value at which lap numbers wrap around to zero static constexpr int lapNumberBoundary = 1000; // Lap storage -- cgit v1.2.3-70-g09d2