Skip to content

Commit b221cc1

Browse files
committed
Stopwatch: improve variable naming
msec => hundredths
1 parent 7caeecc commit b221cc1

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/displayapp/screens/StopWatch.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ namespace {
1616
TimeSeparated_t convertTicksToTimeSegments(const TickType_t timeElapsed) {
1717
const int timeElapsedMillis = (static_cast<float>(timeElapsed) / static_cast<float>(configTICK_RATE_HZ)) * 1000;
1818

19-
const int milliSecs = (timeElapsedMillis % 1000) / 10; // Get only the first two digits and ignore the last
19+
const int hundredths = (timeElapsedMillis % 1000) / 10; // Get only the first two digits and ignore the last
2020
const int secs = (timeElapsedMillis / 1000) % 60;
2121
const int mins = (timeElapsedMillis / 1000) / 60;
22-
return TimeSeparated_t {mins, secs, milliSecs};
22+
return TimeSeparated_t {mins, secs, hundredths};
2323
}
2424

2525
TickType_t calculateDelta(const TickType_t startTime, const TickType_t currentTime) {
@@ -141,14 +141,14 @@ bool StopWatch::Refresh() {
141141
currentTimeSeparated = convertTicksToTimeSegments((oldTimeElapsed + timeElapsed));
142142

143143
lv_label_set_text_fmt(time, "%02d:%02d", currentTimeSeparated.mins, currentTimeSeparated.secs);
144-
lv_label_set_text_fmt(msecTime, "%02d", currentTimeSeparated.msecs);
144+
lv_label_set_text_fmt(msecTime, "%02d", currentTimeSeparated.hundredths);
145145

146146
if (lapPressed == true) {
147147
if (lapBuffer[1]) {
148-
lv_label_set_text_fmt(lapOneText, "#2%d %2d:%02d.%02d", (lapNr - 1), lapBuffer[1]->mins, lapBuffer[1]->secs, lapBuffer[1]->msecs);
148+
lv_label_set_text_fmt(lapOneText, "#2%d %2d:%02d.%02d", (lapNr - 1), lapBuffer[1]->mins, lapBuffer[1]->secs, lapBuffer[1]->hundredths);
149149
}
150150
if (lapBuffer[0]) {
151-
lv_label_set_text_fmt(lapTwoText, "#2%d %2d:%02d.%02d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->msecs);
151+
lv_label_set_text_fmt(lapTwoText, "#2%d %2d:%02d.%02d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->hundredths);
152152
}
153153
// Reset the bool to avoid setting the text in each cycle until there is a change
154154
lapPressed = false;

src/displayapp/screens/StopWatch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Pinetime::Applications::Screens {
1818
struct TimeSeparated_t {
1919
int mins;
2020
int secs;
21-
int msecs;
21+
int hundredths;
2222
};
2323

2424
// A simple buffer to hold the latest two laps
@@ -66,7 +66,7 @@ namespace Pinetime::Applications::Screens {
6666
StopWatch(DisplayApp* app);
6767
~StopWatch() override;
6868
bool Refresh() override;
69-
69+
7070
void playPauseBtnEventHandler(lv_event_t event);
7171
void stopLapBtnEventHandler(lv_event_t event);
7272

0 commit comments

Comments
 (0)