blob: 3e8d9e73373c5485eb3eb198a1fe3bbc3e81b80b (
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
65
66
67
68
69
70
71
|
#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"
#include "utility/DirtyValue.h"
namespace Pinetime::Applications {
namespace Screens {
struct TimeSeparated {
uint16_t hours;
uint8_t mins;
uint8_t secs;
uint8_t hundredths;
uint32_t epochSecs;
};
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 OnPause();
void DisplayPaused();
void DisplayStarted();
void DisplayCleared();
void RenderTime();
void RenderPause();
void RenderLaps();
void SetHoursVisible(bool visible);
Pinetime::System::WakeLock wakeLock;
Controllers::StopWatchController& stopWatchController;
TickType_t blinkTime = 0;
uint8_t displayedLaps = 3;
lv_obj_t *time, *msecTime, *btnPlayPause, *btnStopLap, *txtPlayPause, *txtStopLap;
lv_obj_t* lapText;
Utility::DirtyValue<TickType_t> renderedSeconds;
bool hoursVisible = 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;
}
};
}
|