summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/StopWatch.h
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2021-07-04 21:23:03 +0300
committerGitHub <noreply@github.com>2021-07-04 20:23:03 +0200
commit61a4642221fc9fcab6889221e7bf9c29778589f2 (patch)
treea25d797be3f0a80575a799f8f019cafb76d03cec /src/displayapp/screens/StopWatch.h
parentab59b9b8301d95206a2f77a4e32e4f6552361a2e (diff)
Improve stopwatch (#432)
* Improve stopwatch more * Make sure sleep gets reenabled * Cleanup and clang-format
Diffstat (limited to 'src/displayapp/screens/StopWatch.h')
-rw-r--r--src/displayapp/screens/StopWatch.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h
index ff604361..e132f158 100644
--- a/src/displayapp/screens/StopWatch.h
+++ b/src/displayapp/screens/StopWatch.h
@@ -8,13 +8,12 @@
#include "portmacro_cmsis.h"
#include <array>
+#include "systemtask/SystemTask.h"
namespace Pinetime::Applications::Screens {
enum class States { Init, Running, Halted };
- enum class Events { Play, Pause, Stop };
-
struct TimeSeparated_t {
int mins;
int secs;
@@ -63,23 +62,28 @@ namespace Pinetime::Applications::Screens {
class StopWatch : public Screen {
public:
- StopWatch(DisplayApp* app);
+ StopWatch(DisplayApp* app, System::SystemTask& systemTask);
~StopWatch() override;
bool Refresh() override;
void playPauseBtnEventHandler(lv_event_t event);
void stopLapBtnEventHandler(lv_event_t event);
+ bool OnButtonPushed() override;
+
+ void reset();
+ void start();
+ void pause();
private:
+ Pinetime::System::SystemTask& systemTask;
+ TickType_t timeElapsed;
bool running;
States currentState;
- Events currentEvent;
TickType_t startTime;
TickType_t oldTimeElapsed;
TimeSeparated_t currentTimeSeparated; // Holds Mins, Secs, millisecs
LapTextBuffer_t<2> lapBuffer;
- int lapNr;
- bool lapPressed;
+ int lapNr = 0;
lv_obj_t *time, *msecTime, *btnPlayPause, *btnStopLap, *txtPlayPause, *txtStopLap;
lv_obj_t *lapOneText, *lapTwoText;
};