Skip to content

Commit 8af5e15

Browse files
committed
StarTrek watchface
1 parent 99ec6bc commit 8af5e15

15 files changed

+1322
-1
lines changed

src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ list(APPEND SOURCE_FILES
426426
displayapp/screens/WatchFaceTerminal.cpp
427427
displayapp/screens/WatchFacePineTimeStyle.cpp
428428
displayapp/screens/WatchFaceCasioStyleG7710.cpp
429+
displayapp/screens/WatchFaceStarTrek.cpp
429430

430431
##
431432

src/components/settings/Settings.h

+55-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace Pinetime {
3636
};
3737
enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric };
3838
enum class PTSWeather : uint8_t { On, Off };
39+
enum class StarTrekAnimateType { None, Start, Continuous, All };
3940

4041
struct PineTimeStyle {
4142
Colors ColorTime = Colors::Teal;
@@ -50,6 +51,13 @@ namespace Pinetime {
5051
int colorIndex = 0;
5152
};
5253

54+
struct WatchFaceStarTrek {
55+
bool useSystemFont = false;
56+
StarTrekAnimateType animate = StarTrekAnimateType::All;
57+
bool displaySeconds = false;
58+
bool weather = true;
59+
};
60+
5361
Settings(Pinetime::Controllers::FS& fs);
5462

5563
Settings(const Settings&) = delete;
@@ -154,6 +162,50 @@ namespace Pinetime {
154162
return settings.PTS.weatherEnable;
155163
};
156164

165+
bool GetStarTrekUseSystemFont() const {
166+
return settings.watchFaceStarTrek.useSystemFont;
167+
};
168+
169+
void SetStarTrekUseSystemFont(bool useSystemFont) {
170+
if (useSystemFont != settings.watchFaceStarTrek.useSystemFont) {
171+
settings.watchFaceStarTrek.useSystemFont = useSystemFont;
172+
settingsChanged = true;
173+
}
174+
};
175+
176+
StarTrekAnimateType GetStarTrekAnimate() const {
177+
return settings.watchFaceStarTrek.animate;
178+
};
179+
180+
void SetStarTrekAnimate(StarTrekAnimateType animate) {
181+
if (animate != settings.watchFaceStarTrek.animate) {
182+
settings.watchFaceStarTrek.animate = animate;
183+
settingsChanged = true;
184+
}
185+
};
186+
187+
bool GetStarTrekDisplaySeconds() const {
188+
return settings.watchFaceStarTrek.displaySeconds;
189+
};
190+
191+
void SetStarTrekDisplaySeconds(bool displaySeconds) {
192+
if (displaySeconds != settings.watchFaceStarTrek.displaySeconds) {
193+
settings.watchFaceStarTrek.displaySeconds = displaySeconds;
194+
settingsChanged = true;
195+
}
196+
};
197+
198+
bool GetStarTrekWeather() const {
199+
return settings.watchFaceStarTrek.weather;
200+
};
201+
202+
void SetStarTrekWeather(bool weather) {
203+
if (weather != settings.watchFaceStarTrek.weather) {
204+
settings.watchFaceStarTrek.weather = weather;
205+
settingsChanged = true;
206+
}
207+
};
208+
157209
void SetAppMenu(uint8_t menu) {
158210
appMenu = menu;
159211
};
@@ -301,7 +353,7 @@ namespace Pinetime {
301353
private:
302354
Pinetime::Controllers::FS& fs;
303355

304-
static constexpr uint32_t settingsVersion = 0x0008;
356+
static constexpr uint32_t settingsVersion = 0x0009;
305357

306358
struct SettingsData {
307359
uint32_t version = settingsVersion;
@@ -321,6 +373,8 @@ namespace Pinetime {
321373

322374
WatchFaceInfineat watchFaceInfineat;
323375

376+
WatchFaceStarTrek watchFaceStarTrek;
377+
324378
std::bitset<5> wakeUpMode {0};
325379
uint16_t shakeWakeThreshold = 150;
326380

src/displayapp/UserApps.h

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "displayapp/screens/WatchFaceInfineat.h"
1515
#include "displayapp/screens/WatchFacePineTimeStyle.h"
1616
#include "displayapp/screens/WatchFaceTerminal.h"
17+
#include "displayapp/screens/WatchFaceStarTrek.h"
1718

1819
namespace Pinetime {
1920
namespace Applications {

src/displayapp/apps/Apps.h.in

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ namespace Pinetime {
5252
Terminal,
5353
Infineat,
5454
CasioStyleG7710,
55+
StarTrek,
5556
};
5657

5758
template <Apps>

src/displayapp/apps/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ else()
2727
set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Terminal")
2828
set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Infineat")
2929
set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::CasioStyleG7710")
30+
set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::StarTrek")
3031
set(WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}" CACHE STRING "List of watch faces to build into the firmware")
3132
endif()
3233

src/displayapp/fonts/fonts.json

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
{
99
"file": "FontAwesome5-Solid+Brands+Regular.woff",
1010
"range": "0xf294, 0xf242, 0xf54b, 0xf21e, 0xf1e6, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf06e, 0xf015, 0xf00c, 0xf0f3, 0xf522, 0xf743"
11+
},
12+
{
13+
"file": "material-design-icons/MaterialIcons-Regular.ttf",
14+
"range": "0xe7f6, 0xef44"
1115
}
1216
],
1317
"bpp": 1,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include "lvgl/lvgl.h"
2+
3+
#ifndef LV_ATTRIBUTE_MEM_ALIGN
4+
#define LV_ATTRIBUTE_MEM_ALIGN
5+
#endif
6+
7+
#ifndef LV_ATTRIBUTE_IMG_BRACKET_LEFT
8+
#define LV_ATTRIBUTE_IMG_BRACKET_LEFT
9+
#endif
10+
11+
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BRACKET_LEFT uint8_t bracket_left_map[] = {
12+
0x00, 0x00, 0x00, 0xff, /*Color of index 0*/
13+
0x10, 0x5d, 0xd5, 0xff, /*Color of index 1*/
14+
0xfe, 0xdd, 0x82, 0xff, /*Color of index 2*/
15+
0x6b, 0x61, 0x4a, 0xff, /*Color of index 3*/
16+
17+
0x00, 0xaa, 0xaa, 0xaa, 0x02, 0xaa, 0xaa, 0xaa, 0x02, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0xaa, 0xa8, 0x00, 0x00, 0xaa, 0xa8,
18+
0x00, 0x00, 0xaa, 0xa8, 0x00, 0x00, 0x02, 0xa8, 0x00, 0x00, 0x02, 0xa8, 0x00, 0x00, 0x02, 0xa8, 0x00, 0x00, 0x02, 0xa8, 0x00, 0x00,
19+
0x00, 0x00, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x03, 0xfc,
20+
0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x54, 0x00, 0x00, 0x01, 0x54, 0x00, 0x00, 0x01, 0x54, 0x00, 0x00,
21+
0x01, 0x54, 0x00, 0x00, 0x01, 0x54, 0x00, 0x00, 0x01, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xa8, 0x00, 0x00, 0x02, 0xa8,
22+
0x00, 0x00, 0x02, 0xa8, 0x00, 0x00, 0x02, 0xa8, 0x00, 0x00, 0x02, 0xa8, 0x00, 0x00, 0xaa, 0xa8, 0x00, 0x00, 0xaa, 0xa8, 0x00, 0x00,
23+
0xaa, 0xa8, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x02, 0xaa, 0xaa, 0xaa, 0x02, 0xaa, 0xaa, 0xaa, 0x00, 0xaa, 0xaa, 0xaa,
24+
};
25+
26+
const lv_img_dsc_t bracket_left = {{LV_IMG_CF_INDEXED_2BIT, 0, 0, 16, 38}, 168, bracket_left_map};
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include "lvgl/lvgl.h"
2+
3+
#ifndef LV_ATTRIBUTE_MEM_ALIGN
4+
#define LV_ATTRIBUTE_MEM_ALIGN
5+
#endif
6+
7+
#ifndef LV_ATTRIBUTE_IMG_BRACKET_RIGHT
8+
#define LV_ATTRIBUTE_IMG_BRACKET_RIGHT
9+
#endif
10+
11+
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_BRACKET_RIGHT uint8_t bracket_right_map[] = {
12+
0x00, 0x00, 0x00, 0xff, /*Color of index 0*/
13+
0x10, 0x5d, 0xd5, 0xff, /*Color of index 1*/
14+
0xfe, 0xdd, 0x82, 0xff, /*Color of index 2*/
15+
0x6b, 0x61, 0x4a, 0xff, /*Color of index 3*/
16+
17+
0xaa, 0xaa, 0xaa, 0x00, 0xaa, 0xaa, 0xaa, 0x80, 0xaa, 0xaa, 0xaa, 0x80, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x2a, 0xaa, 0x00, 0x00,
18+
0x2a, 0xaa, 0x00, 0x00, 0x2a, 0xaa, 0x00, 0x00, 0x2a, 0x80, 0x00, 0x00, 0x2a, 0x80, 0x00, 0x00, 0x2a, 0x80, 0x00, 0x00, 0x2a, 0x80,
19+
0x00, 0x00, 0x2a, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x40, 0x00, 0x00, 0x15, 0x40, 0x00, 0x00, 0x15, 0x40, 0x00, 0x00,
20+
0x15, 0x40, 0x00, 0x00, 0x15, 0x40, 0x00, 0x00, 0x15, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x3f, 0xc0,
21+
0x00, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22+
0x2a, 0x80, 0x00, 0x00, 0x2a, 0x80, 0x00, 0x00, 0x2a, 0x80, 0x00, 0x00, 0x2a, 0x80, 0x00, 0x00, 0x2a, 0xaa, 0x00, 0x00, 0x2a, 0xaa,
23+
0x00, 0x00, 0x2a, 0xaa, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x80, 0xaa, 0xaa, 0xaa, 0x80, 0xaa, 0xaa, 0xaa, 0x00,
24+
};
25+
26+
const lv_img_dsc_t bracket_right = {{LV_IMG_CF_INDEXED_2BIT, 0, 0, 16, 38}, 168, bracket_right_map};
Loading

0 commit comments

Comments
 (0)