Skip to content

Commit 931723c

Browse files
codingjourneyJF002
authored andcommitted
fixed irregular pause mode blinking at clock wraparound
1 parent 88ba670 commit 931723c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/displayapp/screens/StopWatch.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ void StopWatch::RenderTime() {
159159

160160
void StopWatch::RenderPause() {
161161
const TickType_t currentTime = xTaskGetTickCount();
162-
if (currentTime > blinkTime) {
163-
blinkTime = currentTime + blinkInterval;
162+
if (currentTime - lastBlinkTime > blinkInterval) {
163+
lastBlinkTime = currentTime;
164164
if (lv_obj_get_state(time, LV_LABEL_PART_MAIN) == LV_STATE_DEFAULT) {
165165
lv_obj_set_state(time, LV_STATE_DISABLED);
166166
lv_obj_set_state(msecTime, LV_STATE_DISABLED);
@@ -253,7 +253,7 @@ bool StopWatch::OnButtonPushed() {
253253

254254
void StopWatch::OnPause() {
255255
stopWatchController.Pause();
256-
blinkTime = xTaskGetTickCount() + blinkInterval;
256+
lastBlinkTime = xTaskGetTickCount();
257257
RenderTime(); // make sure displayed time is not stale
258258
DisplayPaused();
259259
wakeLock.Release();

src/displayapp/screens/StopWatch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace Pinetime::Applications {
4545

4646
Pinetime::System::WakeLock wakeLock;
4747
Controllers::StopWatchController& stopWatchController;
48-
TickType_t blinkTime = 0;
48+
TickType_t lastBlinkTime = 0;
4949
uint8_t displayedLaps = 3;
5050
lv_obj_t *time, *msecTime, *btnPlayPause, *btnStopLap, *txtPlayPause, *txtStopLap;
5151
lv_obj_t* lapText;

0 commit comments

Comments
 (0)