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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#pragma once
#include <cstdint>
#include <bitset>
namespace Pinetime {
namespace Controllers {
class Settings {
public:
enum class ClockType : uint8_t { H24, H12 };
enum class Notification : uint8_t { ON, OFF };
enum class Colors : uint8_t {
White,
Silver,
Gray,
Black,
Red,
Maroon,
Yellow,
Olive,
Lime,
Green,
Cyan,
Teal,
Blue,
Navy,
Magenta,
Purple,
Orange
};
Settings();
void Init();
void SaveSettings();
void SetClockFace(uint8_t face) {
if (face != settings.clockFace) {
settingsChanged = true;
}
settings.clockFace = face;
};
uint8_t GetClockFace() const {
return settings.clockFace;
};
void SetAppMenu(uint8_t menu) {
appMenu = menu;
};
uint8_t GetAppMenu() const {
return appMenu;
};
void SetSettingsMenu(uint8_t menu) {
settingsMenu = menu;
};
uint8_t GetSettingsMenu() const {
return settingsMenu;
};
void SetClockType(ClockType clocktype) {
if (clocktype != settings.clockType) {
settingsChanged = true;
}
settings.clockType = clocktype;
};
ClockType GetClockType() const {
return settings.clockType;
};
void SetNotificationStatus(Notification status) {
if (status != settings.notificationStatus) {
settingsChanged = true;
}
settings.notificationStatus = status;
};
Notification GetNotificationStatus() const {
return settings.notificationStatus;
};
private:
static constexpr uint32_t settingsVersion = 0x4122; // infinitime redux settings
struct SettingsData {
uint32_t version = settingsVersion;
ClockType clockType = ClockType::H24;
Notification notificationStatus = Notification::ON;
uint8_t clockFace = 0;
std::bitset<4> wakeUpMode {0};
};
SettingsData settings;
bool settingsChanged = false;
uint8_t appMenu = 0;
uint8_t settingsMenu = 0;
};
}
}
|