summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-04-13 18:53:14 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-04-13 18:53:14 (GMT)
commit27fa6bba08766831fe143fe5ca13767bedcd9072 (patch)
treed3ec0a05dfaaae60346bca4413b312daa859b4e4
parenta13d55356ef069e33e3afdaffe5f67c7e9e55027 (diff)
Revert "Leftover modifications from previous commit!"
This reverts commit a13d55356ef069e33e3afdaffe5f67c7e9e55027.
-rw-r--r--src/components/ble/NimbleController.cpp2
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp11
-rw-r--r--src/displayapp/screens/WatchFaceDigital.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp
index 4b08e9a..5236619 100644
--- a/src/components/ble/NimbleController.cpp
+++ b/src/components/ble/NimbleController.cpp
@@ -37,6 +37,7 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
dfuService {systemTask, bleController, spiNorFlash},
currentTimeClient {dateTimeController},
+ anService {systemTask, notificationManager},
currentTimeService {dateTimeController},
batteryInformationService {batteryController},
serviceDiscovery({&currentTimeClient}) {
@@ -77,6 +78,7 @@ void NimbleController::Init() {
deviceInformationService.Init();
currentTimeClient.Init();
currentTimeService.Init();
+ anService.Init();
dfuService.Init();
batteryInformationService.Init();
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index 4c0ae84..6d80742 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -5,6 +5,7 @@
#include <cstdio>
#include "displayapp/screens/BatteryIcon.h"
#include "displayapp/screens/BleIcon.h"
+#include "displayapp/screens/NotificationIcon.h"
#include "displayapp/screens/Symbols.h"
#include "components/battery/BatteryController.h"
#include "components/ble/BleController.h"
@@ -43,6 +44,11 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
lv_label_set_text_static(bleIcon, Symbols::bluetooth);
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
+ notificationIcon = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
+ lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
+ lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
+
label_date = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(label_date, nullptr, LV_ALIGN_CENTER, 0, 60);
lv_obj_set_auto_realign(label_date, true);
@@ -100,6 +106,11 @@ void WatchFaceDigital::Refresh() {
lv_obj_realign(batteryPlug);
lv_obj_realign(bleIcon);
+ notificationState = notificatioManager.AreNewNotificationsAvailable();
+ if (notificationState.IsUpdated()) {
+ lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
+ }
+
currentDateTime = dateTimeController.CurrentDateTime();
if (currentDateTime.IsUpdated()) {
diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h
index b44e517..eb95e6f 100644
--- a/src/displayapp/screens/WatchFaceDigital.h
+++ b/src/displayapp/screens/WatchFaceDigital.h
@@ -50,6 +50,7 @@ namespace Pinetime {
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
DirtyValue<bool> motionSensorOk {};
DirtyValue<uint32_t> stepCount {};
+ DirtyValue<bool> notificationState {};
lv_obj_t* label_time;
lv_obj_t* label_time_pm;
@@ -60,6 +61,7 @@ namespace Pinetime {
lv_obj_t* batteryPlug;
lv_obj_t* stepIcon;
lv_obj_t* stepValue;
+ lv_obj_t* notificationIcon;
Controllers::DateTime& dateTimeController;
Controllers::Battery& batteryController;