Skip to content

Commit

Permalink
InfiniTime FOSDEM 2023 special edition
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JF002 committed Jan 22, 2023
1 parent e823c8e commit 10beda2
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/displayapp/screens/SystemInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen1() {
lv_label_set_text_fmt(label,
"#FFFF00 InfiniTime#\n\n"
"#808080 Version# %ld.%ld.%ld\n"
"#AB1B94 FOSDEM edition#\n"
"#808080 Short Ref# %s\n"
"#808080 Build date#\n"
"%s\n"
"%s\n\n"
"%s\n"
"#808080 Bootloader# %s",
Version::Major(),
Version::Minor(),
Expand Down
11 changes: 8 additions & 3 deletions src/displayapp/screens/WatchFaceAnalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
sMinute = 99;
sSecond = 99;

lv_obj_t* bg_clock_img = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(bg_clock_img, &bg_clock);
lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0);
bg = lv_img_create(lv_scr_act(), nullptr);
lv_obj_align(bg, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);

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

Refresh();
doNotLoadBg = false;
}

WatchFaceAnalog::~WatchFaceAnalog() {
Expand Down Expand Up @@ -186,6 +186,11 @@ void WatchFaceAnalog::SetBatteryIcon() {
}

void WatchFaceAnalog::Refresh() {
if(!bgLoaded && !doNotLoadBg) {
lv_img_set_src(bg, "F:/images/fosdem.bin");
bgLoaded = true;
}

isCharging = batteryController.IsCharging();
if (isCharging.IsUpdated()) {
if (isCharging.Get()) {
Expand Down
4 changes: 4 additions & 0 deletions src/displayapp/screens/WatchFaceAnalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ namespace Pinetime {

BatteryIcon batteryIcon;

lv_obj_t* bg;
bool bgLoaded = false;
bool doNotLoadBg = true;

const Controllers::DateTime& dateTimeController;
Controllers::Battery& batteryController;
Controllers::Ble& bleController;
Expand Down
9 changes: 9 additions & 0 deletions src/displayapp/screens/WatchFaceDigital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
motionController {motionController},
statusIcons(batteryController, bleController) {

bg = lv_img_create(lv_scr_act(), nullptr);
lv_obj_align(bg, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);

statusIcons.Create();

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

taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
Refresh();
doNotLoadBg = false;
}

WatchFaceDigital::~WatchFaceDigital() {
Expand All @@ -81,6 +85,11 @@ WatchFaceDigital::~WatchFaceDigital() {
}

void WatchFaceDigital::Refresh() {
if(!bgLoaded && !doNotLoadBg) {
lv_img_set_src(bg, "F:/images/fosdem.bin");
bgLoaded = true;
}

statusIcons.Update();

notificationState = notificationManager.AreNewNotificationsAvailable();
Expand Down
3 changes: 3 additions & 0 deletions src/displayapp/screens/WatchFaceDigital.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ namespace Pinetime {
lv_obj_t* stepIcon;
lv_obj_t* stepValue;
lv_obj_t* notificationIcon;
lv_obj_t* bg;
bool bgLoaded = false;
bool doNotLoadBg = true;

Controllers::DateTime& dateTimeController;
Controllers::NotificationManager& notificationManager;
Expand Down
7 changes: 7 additions & 0 deletions src/resources/images.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
"output_format": "bin",
"binary_format": "ARGB8565_RBSWAP",
"target_path": "/images/"
},
"fosdem" : {
"sources": "images/fosdem.png",
"color_format": "CF_INDEXED_1_BIT",
"output_format": "bin",
"binary_format": "ARGB8565_RBSWAP",
"target_path": "/images/"
}
}
Binary file added src/resources/images/fosdem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 10beda2

Please sign in to comment.