From 9f69179fa3907dd4a6be1c520f9e7a7ef252c43c Mon Sep 17 00:00:00 2001 From: Michele Bini Date: Thu, 31 Mar 2022 12:11:51 +0200 Subject: fix for previous commit diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index faca4da..ec4f87c 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -18,11 +18,11 @@ j,k,l, \ m,n,o \ ) { \ - 0xF3, \ - 0xB0 | (i<<2) | (j << 1) | k, \ - 0xB0 | (l<<5) | (m<<4) | (n<<3) | (o<<2) | (a<<1) | b, \ - 0xB0 | (c<<5) | (d<<4) | (e<<3) | (f<<2) | (g<<1) | h, \ - 0 \ + ((char)( 0xF3 )), \ + ((char)( 0xB0 | (i<<2) | (j<<1) | k )), \ + ((char)( 0x80 | (l<<5) | (m<<4) | (n<<3) | (o<<2) | (a<<1) | b )), \ + ((char)( 0x80 | (c<<5) | (d<<4) | (e<<3) | (f<<2) | (g<<1) | h )), \ + 0 \ } #define X 1 @@ -33,42 +33,42 @@ namespace Pinetime { namespace Screens { namespace Symbols { static constexpr const char* none = ""; - static constexpr const char* batteryFull = + static constexpr const char batteryFull[] = // "\xEF\x89\x80"; G(_, X, _, X, X, X, X, X, X, X, X, X, X, X, X); - static constexpr const char* batteryEmpty = + static constexpr const char batteryEmpty[] = // "\xEF\x89\x84"; G(_, X, _, X, _, X, X, _, X, - X, _, X, + X, _, X, // l is ignored! X, X, X); - static constexpr const char* batteryThreeQuarter = + static constexpr const char batteryThreeQuarter[] = // Was: "\xEF\x89\x81"; G(_, X, _, X, X, X, X, _, X, X, X, X, X, X, X); - static constexpr const char* batteryHalf = + static constexpr const char batteryHalf[] = // Was: "\xEF\x89\x82"; G(_, X, _, X, _, X, X, X, X, X, X, X, X, X, X); - static constexpr const char* batteryOneQuarter = + static constexpr const char batteryOneQuarter[] = // Was: "\xEF\x89\x83"; G(_, X, _, X, _, X, X, _, X, X, X, X, X, X, X); - static constexpr const char* heartBeat = + static constexpr const char heartBeat[] = // Was: "\xEF\x88\x9E" G(_, _, _, X, _, X, @@ -77,7 +77,13 @@ namespace Pinetime { _, _, _); static constexpr const char* bluetoothFull = "\xEF\x8A\x93"; static constexpr const char* bluetooth = "\xEF\x8A\x94"; - static constexpr const char* plug = "\xEF\x87\xA6"; + static constexpr const char plug[] = + // "\xEF\x87\xA6"; + G(X, _, X, + X, X, X, + X, X, X, + _, X, _, + _, X, _); static constexpr const char* shoe = "\xEF\x95\x8B"; static constexpr const char* clock = "\xEF\x80\x97"; static constexpr const char* info = "\xEF\x84\xA9"; @@ -125,3 +131,7 @@ namespace Pinetime { } } } + +#undef G +#undef X +#undef _ diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 7c57d15..553feae 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -31,14 +31,13 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, motionController {motionController} { batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_fmt(batteryIcon, "B##%%"); - lv_obj_set_style_local_text_font(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont15); + lv_label_set_text_static(batteryIcon, Symbols::batteryFull); lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); batteryPlug = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00)); - lv_label_set_text_static(batteryPlug, ""); - lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); + lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFF0000)); + lv_label_set_text_static(batteryPlug, Symbols::plug); + lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, 0, 0); bleIcon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x0082FC)); @@ -88,7 +87,7 @@ WatchFaceDigital::~WatchFaceDigital() { void WatchFaceDigital::Refresh() { powerPresent = batteryController.IsPowerPresent(); if (powerPresent.IsUpdated()) { - lv_label_set_text_static(batteryPlug, (powerPresent.Get() ? "PWR" : "")); + lv_label_set_text_static(batteryPlug, BatteryIcon::GetPlugIcon(powerPresent.Get())); } batteryPercentRemaining = batteryController.PercentRemaining(); @@ -99,7 +98,7 @@ void WatchFaceDigital::Refresh() { } else { lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); } - lv_label_set_text_fmt(batteryIcon, "B%d%%", batteryPercent); + lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); } bleState = bleController.IsConnected(); -- cgit v0.10.2