@@ -15,7 +15,7 @@ namespace Pinetime {
1515 enum class StopWatchStates { Cleared, Running, Paused };
1616
1717 struct LapInfo {
18- int number = 0 ; // Used to label the lap
18+ uint16_t number = 0 ; // Used to label the lap
1919 TickType_t timeSinceStart = 0 ; // Excluding pauses
2020 };
2121
@@ -36,18 +36,18 @@ namespace Pinetime {
3636 void AddLapToHistory ();
3737
3838 // / Returns maxLapNumber
39- int GetMaxLapNumber ();
39+ uint16_t GetMaxLapNumber ();
4040
4141 // / Indexes into lap history, with 0 being the latest lap.
42- std::optional<LapInfo> GetLapFromHistory (int index);
42+ std::optional<LapInfo> GetLapFromHistory (uint8_t index);
4343
4444 bool IsRunning ();
4545 bool IsCleared ();
4646 bool IsPaused ();
4747
4848 private:
4949 // Time at which stopwatch wraps around to zero (1000 hours)
50- static constexpr TickType_t elapsedTimeBoundary = ( TickType_t) configTICK_RATE_HZ * 60 * 60 * 1000 ;
50+ static constexpr TickType_t elapsedTimeBoundary = static_cast < TickType_t>( configTICK_RATE_HZ) * 60 * 60 * 1000 ;
5151 // Current state of stopwatch
5252 StopWatchStates currentState = StopWatchStates::Cleared;
5353 // Start time of current duration
@@ -56,13 +56,13 @@ namespace Pinetime {
5656 TickType_t timeElapsedPreviously;
5757
5858 // Maximum number of stored laps
59- static constexpr int histSize = 4 ;
59+ static constexpr uint8_t histSize = 4 ;
6060 // Value at which lap numbers wrap around to zero
61- static constexpr int lapNumberBoundary = 1000 ;
61+ static constexpr uint16_t lapNumberBoundary = 1000 ;
6262 // Lap storage
6363 Utility::CircularBuffer<LapInfo, histSize> history;
6464 // Highest lap number; less than lapNumberBoundary, may exceed histSize
65- int maxLapNumber;
65+ uint16_t maxLapNumber;
6666 };
6767 }
6868}
0 commit comments