aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcodingjourney <coding@journey.sk>2024-10-30 21:43:50 +0100
committerJF <JF002@users.noreply.github.com>2025-11-04 21:25:31 +0100
commit08043c30789040e6d50af0bd6864b8b8cf95fecd (patch)
tree04ab9dd55f40e1a049da10e33dea80274d6fe493
parentf1f4c9028e12c9a34bcfd79fd7ba273aebfbbae7 (diff)
common method for entering the Paused state
-rw-r--r--src/displayapp/screens/StopWatch.cpp18
-rw-r--r--src/displayapp/screens/StopWatch.h2
2 files changed, 12 insertions, 8 deletions
diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp
index 5265455b..6fa81652 100644
--- a/src/displayapp/screens/StopWatch.cpp
+++ b/src/displayapp/screens/StopWatch.cpp
@@ -203,11 +203,7 @@ void StopWatch::PlayPauseBtnEventHandler() {
DisplayStarted();
wakeLock.Lock();
} else if (stopWatchController.IsRunning()) {
- stopWatchController.Pause();
- blinkTime = xTaskGetTickCount() + blinkInterval;
- DisplayPaused();
- RenderTime();
- wakeLock.Release();
+ OnPause();
}
}
@@ -224,10 +220,16 @@ void StopWatch::StopLapBtnEventHandler() {
bool StopWatch::OnButtonPushed() {
if (stopWatchController.IsRunning()) {
- stopWatchController.Pause();
- DisplayPaused();
- wakeLock.Release();
+ OnPause();
return true;
}
return false;
}
+
+void StopWatch::OnPause() {
+ stopWatchController.Pause();
+ blinkTime = xTaskGetTickCount() + blinkInterval;
+ RenderTime(); // make sure displayed time is not stale
+ DisplayPaused();
+ wakeLock.Release();
+} \ No newline at end of file
diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h
index b0379654..26cfb43f 100644
--- a/src/displayapp/screens/StopWatch.h
+++ b/src/displayapp/screens/StopWatch.h
@@ -29,6 +29,8 @@ namespace Pinetime::Applications {
bool OnButtonPushed() override;
private:
+ void OnPause();
+
void DisplayPaused();
void DisplayStarted();
void DisplayCleared();