Skip to content

Commit 10beda2

Browse files
committed
InfiniTime FOSDEM 2023 special edition
Add a background image in Digital and Analog watchface. The content of the image is read from /images/fosdem.bin in external storage. Generate fosdem.bin from fosdem.png and add it in the external resource pack.
1 parent e823c8e commit 10beda2

File tree

7 files changed

+33
-4
lines changed

7 files changed

+33
-4
lines changed

src/displayapp/screens/SystemInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen1() {
8080
lv_label_set_text_fmt(label,
8181
"#FFFF00 InfiniTime#\n\n"
8282
"#808080 Version# %ld.%ld.%ld\n"
83+
"#AB1B94 FOSDEM edition#\n"
8384
"#808080 Short Ref# %s\n"
8485
"#808080 Build date#\n"
8586
"%s\n"
86-
"%s\n\n"
87+
"%s\n"
8788
"#808080 Bootloader# %s",
8889
Version::Major(),
8990
Version::Minor(),

src/displayapp/screens/WatchFaceAnalog.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
6161
sMinute = 99;
6262
sSecond = 99;
6363

64-
lv_obj_t* bg_clock_img = lv_img_create(lv_scr_act(), NULL);
65-
lv_img_set_src(bg_clock_img, &bg_clock);
66-
lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0);
64+
bg = lv_img_create(lv_scr_act(), nullptr);
65+
lv_obj_align(bg, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
6766

6867
batteryIcon.Create(lv_scr_act());
6968
lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
@@ -124,6 +123,7 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
124123
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
125124

126125
Refresh();
126+
doNotLoadBg = false;
127127
}
128128

129129
WatchFaceAnalog::~WatchFaceAnalog() {
@@ -186,6 +186,11 @@ void WatchFaceAnalog::SetBatteryIcon() {
186186
}
187187

188188
void WatchFaceAnalog::Refresh() {
189+
if(!bgLoaded && !doNotLoadBg) {
190+
lv_img_set_src(bg, "F:/images/fosdem.bin");
191+
bgLoaded = true;
192+
}
193+
189194
isCharging = batteryController.IsCharging();
190195
if (isCharging.IsUpdated()) {
191196
if (isCharging.Get()) {

src/displayapp/screens/WatchFaceAnalog.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ namespace Pinetime {
7070

7171
BatteryIcon batteryIcon;
7272

73+
lv_obj_t* bg;
74+
bool bgLoaded = false;
75+
bool doNotLoadBg = true;
76+
7377
const Controllers::DateTime& dateTimeController;
7478
Controllers::Battery& batteryController;
7579
Controllers::Ble& bleController;

src/displayapp/screens/WatchFaceDigital.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
3131
motionController {motionController},
3232
statusIcons(batteryController, bleController) {
3333

34+
bg = lv_img_create(lv_scr_act(), nullptr);
35+
lv_obj_align(bg, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
36+
3437
statusIcons.Create();
3538

3639
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
@@ -73,6 +76,7 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
7376

7477
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
7578
Refresh();
79+
doNotLoadBg = false;
7680
}
7781

7882
WatchFaceDigital::~WatchFaceDigital() {
@@ -81,6 +85,11 @@ WatchFaceDigital::~WatchFaceDigital() {
8185
}
8286

8387
void WatchFaceDigital::Refresh() {
88+
if(!bgLoaded && !doNotLoadBg) {
89+
lv_img_set_src(bg, "F:/images/fosdem.bin");
90+
bgLoaded = true;
91+
}
92+
8493
statusIcons.Update();
8594

8695
notificationState = notificationManager.AreNewNotificationsAvailable();

src/displayapp/screens/WatchFaceDigital.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ namespace Pinetime {
6464
lv_obj_t* stepIcon;
6565
lv_obj_t* stepValue;
6666
lv_obj_t* notificationIcon;
67+
lv_obj_t* bg;
68+
bool bgLoaded = false;
69+
bool doNotLoadBg = true;
6770

6871
Controllers::DateTime& dateTimeController;
6972
Controllers::NotificationManager& notificationManager;

src/resources/images.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,12 @@
55
"output_format": "bin",
66
"binary_format": "ARGB8565_RBSWAP",
77
"target_path": "/images/"
8+
},
9+
"fosdem" : {
10+
"sources": "images/fosdem.png",
11+
"color_format": "CF_INDEXED_1_BIT",
12+
"output_format": "bin",
13+
"binary_format": "ARGB8565_RBSWAP",
14+
"target_path": "/images/"
815
}
916
}

src/resources/images/fosdem.png

1.46 KB
Loading

0 commit comments

Comments
 (0)