diff options
| author | codingjourney <coding@journey.sk> | 2024-10-26 20:36:39 +0200 |
|---|---|---|
| committer | JF <JF002@users.noreply.github.com> | 2025-11-04 21:25:31 +0100 |
| commit | f5a5600b79972dd7ce644f27b9217a58cbbb91ea (patch) | |
| tree | cdda14a7bf76d74fe5bfefa42c9d312bb8316caa /src/components/stopwatch/StopWatchController.cpp | |
| parent | d927a228477519bd3784650cefdceecbc500e75d (diff) | |
improved naming of lap-related fields and methods
Diffstat (limited to 'src/components/stopwatch/StopWatchController.cpp')
| -rw-r--r-- | src/components/stopwatch/StopWatchController.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/components/stopwatch/StopWatchController.cpp b/src/components/stopwatch/StopWatchController.cpp index d8e48588..7af80367 100644 --- a/src/components/stopwatch/StopWatchController.cpp +++ b/src/components/stopwatch/StopWatchController.cpp @@ -22,31 +22,31 @@ void StopWatchController::Clear() { currentState = StopWatchStates::Cleared; timeElapsedPreviously = 0; - for (int i = 0; i < lapCapacity; i++) { - laps[i].count = 0; - laps[i].time = 0; + for (int i = 0; i < histSize; i++) { + history[i].number = 0; + history[i].timeSinceStart = 0; } - lapCount = 0; + maxLapNumber = 0; } // Lap -void StopWatchController::PushLap() { +void StopWatchController::AddLapToHistory() { TickType_t lapEnd = GetElapsedTime(); - laps[0].time = lapEnd; - laps[0].count = ++lapCount; - laps--; + history[0].timeSinceStart = lapEnd; + history[0].number = ++maxLapNumber; + history--; } -int StopWatchController::GetLapCount() { - return lapCount; +int StopWatchController::GetMaxLapNumber() { + return maxLapNumber; } -std::optional<LapInfo> StopWatchController::LastLap(int lap) { - if (lap < 0 || lap >= lapCapacity || laps[lap].count == 0) { +std::optional<LapInfo> StopWatchController::GetLapFromHistory(int index) { + if (index < 0 || index >= histSize || history[index].number == 0) { return {}; } - return laps[lap]; + return history[index]; } // Data / State acess |
