blob: b0379654ea7aa78a8166f9c9a4be82ba74fe8bdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#pragma once
#include "displayapp/screens/Screen.h"
#include <lvgl/lvgl.h>
#include "components/stopwatch/StopWatchController.h"
#include "systemtask/SystemTask.h"
#include "systemtask/WakeLock.h"
#include "Symbols.h"
namespace Pinetime::Applications {
namespace Screens {
struct TimeSeparated {
int hours;
int mins;
int secs;
int hundredths;
};
class StopWatch : public Screen {
public:
explicit StopWatch(System::SystemTask& systemTask, Controllers::StopWatchController& stopWatchController);
~StopWatch() override;
void Refresh() override;
void PlayPauseBtnEventHandler();
void StopLapBtnEventHandler();
bool OnButtonPushed() override;
private:
void DisplayPaused();
void DisplayStarted();
void DisplayCleared();
void RenderTime();
void RenderPause();
void RenderLaps();
Pinetime::System::WakeLock wakeLock;
Controllers::StopWatchController& stopWatchController;
TickType_t blinkTime = 0;
static constexpr int displayedLaps = 2;
lv_obj_t *time, *msecTime, *btnPlayPause, *btnStopLap, *txtPlayPause, *txtStopLap;
lv_obj_t* lapText;
bool isHoursLabelUpdated = false;
lv_task_t* taskRefresh;
};
}
template <>
struct AppTraits<Apps::StopWatch> {
static constexpr Apps app = Apps::StopWatch;
static constexpr const char* icon = Screens::Symbols::stopWatch;
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::StopWatch(*controllers.systemTask, controllers.stopWatchController);
}
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
return true;
}
};
}
|