Add status icons widget

This commit is contained in:
Riku Isokoski 2022-07-21 19:27:52 +03:00 committed by JF
parent 77d3239866
commit edba1d9ccf
12 changed files with 151 additions and 69 deletions

View file

@ -406,6 +406,7 @@ list(APPEND SOURCE_FILES
displayapp/Colors.cpp displayapp/Colors.cpp
displayapp/widgets/Counter.cpp displayapp/widgets/Counter.cpp
displayapp/widgets/PageIndicator.cpp displayapp/widgets/PageIndicator.cpp
displayapp/widgets/StatusIcons.cpp
## Settings ## Settings
displayapp/screens/settings/QuickSettings.cpp displayapp/screens/settings/QuickSettings.cpp
@ -611,6 +612,7 @@ set(INCLUDE_FILES
displayapp/Colors.h displayapp/Colors.h
displayapp/widgets/Counter.h displayapp/widgets/Counter.h
displayapp/widgets/PageIndicator.h displayapp/widgets/PageIndicator.h
displayapp/widgets/StatusIcons.h
drivers/St7789.h drivers/St7789.h
drivers/SpiNorFlash.h drivers/SpiNorFlash.h
drivers/SpiMaster.h drivers/SpiMaster.h

View file

@ -311,7 +311,8 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
switch (app) { switch (app) {
case Apps::Launcher: case Apps::Launcher:
currentScreen = std::make_unique<Screens::ApplicationList>(this, settingsController, batteryController, dateTimeController); currentScreen =
std::make_unique<Screens::ApplicationList>(this, settingsController, batteryController, bleController, dateTimeController);
ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break; break;
case Apps::None: case Apps::None:
@ -377,7 +378,8 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
dateTimeController, dateTimeController,
brightnessController, brightnessController,
motorController, motorController,
settingsController); settingsController,
bleController);
ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
break; break;
case Apps::Settings: case Apps::Settings:

View file

@ -21,10 +21,12 @@ auto ApplicationList::CreateScreenList() const {
ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp* app, ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp* app,
Pinetime::Controllers::Settings& settingsController, Pinetime::Controllers::Settings& settingsController,
Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::Battery& batteryController,
Pinetime::Controllers::Ble& bleController,
Controllers::DateTime& dateTimeController) Controllers::DateTime& dateTimeController)
: Screen(app), : Screen(app),
settingsController {settingsController}, settingsController {settingsController},
batteryController {batteryController}, batteryController {batteryController},
bleController {bleController},
dateTimeController {dateTimeController}, dateTimeController {dateTimeController},
screens {app, settingsController.GetAppMenu(), CreateScreenList(), Screens::ScreenListModes::UpDown} { screens {app, settingsController.GetAppMenu(), CreateScreenList(), Screens::ScreenListModes::UpDown} {
} }
@ -43,5 +45,12 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen(unsigned int screenNum) co
apps[i] = applications[screenNum * appsPerScreen + i]; apps[i] = applications[screenNum * appsPerScreen + i];
} }
return std::make_unique<Screens::Tile>(screenNum, nScreens, app, settingsController, batteryController, dateTimeController, apps); return std::make_unique<Screens::Tile>(screenNum,
nScreens,
app,
settingsController,
batteryController,
bleController,
dateTimeController,
apps);
} }

View file

@ -19,6 +19,7 @@ namespace Pinetime {
explicit ApplicationList(DisplayApp* app, explicit ApplicationList(DisplayApp* app,
Pinetime::Controllers::Settings& settingsController, Pinetime::Controllers::Settings& settingsController,
Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::Battery& batteryController,
Pinetime::Controllers::Ble& bleController,
Controllers::DateTime& dateTimeController); Controllers::DateTime& dateTimeController);
~ApplicationList() override; ~ApplicationList() override;
bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(TouchEvents event) override;
@ -29,6 +30,7 @@ namespace Pinetime {
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
Pinetime::Controllers::Battery& batteryController; Pinetime::Controllers::Battery& batteryController;
Pinetime::Controllers::Ble& bleController;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;
static constexpr int appsPerScreen = 6; static constexpr int appsPerScreen = 6;

View file

@ -1,6 +1,7 @@
#include "displayapp/screens/Tile.h" #include "displayapp/screens/Tile.h"
#include "displayapp/DisplayApp.h" #include "displayapp/DisplayApp.h"
#include "displayapp/screens/BatteryIcon.h" #include "displayapp/screens/BatteryIcon.h"
#include "components/ble/BleController.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
@ -26,22 +27,26 @@ Tile::Tile(uint8_t screenID,
uint8_t numScreens, uint8_t numScreens,
DisplayApp* app, DisplayApp* app,
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
Pinetime::Controllers::Battery& batteryController, Controllers::Battery& batteryController,
Controllers::Ble& bleController,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
std::array<Applications, 6>& applications) std::array<Applications, 6>& applications)
: Screen(app), batteryController {batteryController}, dateTimeController {dateTimeController}, pageIndicator(screenID, numScreens) { : Screen(app),
dateTimeController {dateTimeController},
pageIndicator(screenID, numScreens),
statusIcons(batteryController, bleController) {
settingsController.SetAppMenu(screenID); settingsController.SetAppMenu(screenID);
statusIcons.Create();
lv_obj_align(statusIcons.GetObject(), lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -8, 0);
statusIcons.Align();
// Time // Time
label_time = lv_label_create(lv_scr_act(), nullptr); label_time = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER); lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label_time, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0); lv_obj_align(label_time, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
// Battery
batteryIcon.Create(lv_scr_act());
lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, -8, 0);
pageIndicator.Create(); pageIndicator.Create();
uint8_t btIndex = 0; uint8_t btIndex = 0;
@ -93,7 +98,7 @@ Tile::~Tile() {
void Tile::UpdateScreen() { void Tile::UpdateScreen() {
lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str()); lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str());
batteryIcon.SetBatteryPercentage(batteryController.PercentRemaining()); statusIcons.Update();
} }
void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) { void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) {

View file

@ -7,10 +7,9 @@
#include "displayapp/Apps.h" #include "displayapp/Apps.h"
#include "components/datetime/DateTimeController.h" #include "components/datetime/DateTimeController.h"
#include "components/settings/Settings.h" #include "components/settings/Settings.h"
#include "components/datetime/DateTimeController.h"
#include "components/battery/BatteryController.h" #include "components/battery/BatteryController.h"
#include "displayapp/screens/BatteryIcon.h"
#include "displayapp/widgets/PageIndicator.h" #include "displayapp/widgets/PageIndicator.h"
#include "displayapp/widgets/StatusIcons.h"
namespace Pinetime { namespace Pinetime {
namespace Applications { namespace Applications {
@ -26,7 +25,8 @@ namespace Pinetime {
uint8_t numScreens, uint8_t numScreens,
DisplayApp* app, DisplayApp* app,
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
Pinetime::Controllers::Battery& batteryController, Controllers::Battery& batteryController,
Controllers::Ble& bleController,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
std::array<Applications, 6>& applications); std::array<Applications, 6>& applications);
@ -36,7 +36,6 @@ namespace Pinetime {
void OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId); void OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId);
private: private:
Pinetime::Controllers::Battery& batteryController;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;
lv_task_t* taskUpdate; lv_task_t* taskUpdate;
@ -45,8 +44,7 @@ namespace Pinetime {
lv_obj_t* btnm1; lv_obj_t* btnm1;
Widgets::PageIndicator pageIndicator; Widgets::PageIndicator pageIndicator;
Widgets::StatusIcons statusIcons;
BatteryIcon batteryIcon;
const char* btnmMap[8]; const char* btnmMap[8];
Pinetime::Applications::Apps apps[6]; Pinetime::Applications::Apps apps[6];

View file

@ -3,8 +3,6 @@
#include <date/date.h> #include <date/date.h>
#include <lvgl/lvgl.h> #include <lvgl/lvgl.h>
#include <cstdio> #include <cstdio>
#include "displayapp/screens/BatteryIcon.h"
#include "displayapp/screens/BleIcon.h"
#include "displayapp/screens/NotificationIcon.h" #include "displayapp/screens/NotificationIcon.h"
#include "displayapp/screens/Symbols.h" #include "displayapp/screens/Symbols.h"
#include "components/battery/BatteryController.h" #include "components/battery/BatteryController.h"
@ -13,6 +11,7 @@
#include "components/heartrate/HeartRateController.h" #include "components/heartrate/HeartRateController.h"
#include "components/motion/MotionController.h" #include "components/motion/MotionController.h"
#include "components/settings/Settings.h" #include "components/settings/Settings.h"
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
WatchFaceDigital::WatchFaceDigital(DisplayApp* app, WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
@ -26,25 +25,13 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
: Screen(app), : Screen(app),
currentDateTime {{}}, currentDateTime {{}},
dateTimeController {dateTimeController}, dateTimeController {dateTimeController},
batteryController {batteryController},
bleController {bleController},
notificatioManager {notificatioManager}, notificatioManager {notificatioManager},
settingsController {settingsController}, settingsController {settingsController},
heartRateController {heartRateController}, heartRateController {heartRateController},
motionController {motionController} { motionController {motionController},
statusIcons(batteryController, bleController) {
batteryIcon.Create(lv_scr_act()); statusIcons.Create();
lv_obj_align(batteryIcon.GetObject(), lv_scr_act(), 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(0xFF0000));
lv_label_set_text_static(batteryPlug, Symbols::plug);
lv_obj_align(batteryPlug, batteryIcon.GetObject(), LV_ALIGN_OUT_LEFT_MID, -5, 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));
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); 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_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
@ -94,24 +81,7 @@ WatchFaceDigital::~WatchFaceDigital() {
} }
void WatchFaceDigital::Refresh() { void WatchFaceDigital::Refresh() {
powerPresent = batteryController.IsPowerPresent(); statusIcons.Update();
if (powerPresent.IsUpdated()) {
lv_label_set_text_static(batteryPlug, BatteryIcon::GetPlugIcon(powerPresent.Get()));
}
batteryPercentRemaining = batteryController.PercentRemaining();
if (batteryPercentRemaining.IsUpdated()) {
auto batteryPercent = batteryPercentRemaining.Get();
batteryIcon.SetBatteryPercentage(batteryPercent);
}
bleState = bleController.IsConnected();
bleRadioEnabled = bleController.IsRadioEnabled();
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
}
lv_obj_realign(batteryPlug);
lv_obj_realign(bleIcon);
notificationState = notificatioManager.AreNewNotificationsAvailable(); notificationState = notificatioManager.AreNewNotificationsAvailable();
if (notificationState.IsUpdated()) { if (notificationState.IsUpdated()) {

View file

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <displayapp/screens/BatteryIcon.h>
#include <lvgl/src/lv_core/lv_obj.h> #include <lvgl/src/lv_core/lv_obj.h>
#include <chrono> #include <chrono>
#include <cstdint> #include <cstdint>
@ -8,6 +7,7 @@
#include "displayapp/screens/Screen.h" #include "displayapp/screens/Screen.h"
#include "components/datetime/DateTimeController.h" #include "components/datetime/DateTimeController.h"
#include "components/ble/BleController.h" #include "components/ble/BleController.h"
#include "displayapp/widgets/StatusIcons.h"
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
@ -59,25 +59,20 @@ namespace Pinetime {
lv_obj_t* label_time; lv_obj_t* label_time;
lv_obj_t* label_time_ampm; lv_obj_t* label_time_ampm;
lv_obj_t* label_date; lv_obj_t* label_date;
lv_obj_t* bleIcon;
lv_obj_t* batteryPlug;
lv_obj_t* heartbeatIcon; lv_obj_t* heartbeatIcon;
lv_obj_t* heartbeatValue; lv_obj_t* heartbeatValue;
lv_obj_t* stepIcon; lv_obj_t* stepIcon;
lv_obj_t* stepValue; lv_obj_t* stepValue;
lv_obj_t* notificationIcon; lv_obj_t* notificationIcon;
BatteryIcon batteryIcon;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;
Controllers::Battery& batteryController;
Controllers::Ble& bleController;
Controllers::NotificationManager& notificatioManager; Controllers::NotificationManager& notificatioManager;
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
Controllers::HeartRateController& heartRateController; Controllers::HeartRateController& heartRateController;
Controllers::MotionController& motionController; Controllers::MotionController& motionController;
lv_task_t* taskRefresh; lv_task_t* taskRefresh;
Widgets::StatusIcons statusIcons;
}; };
} }
} }

View file

@ -2,6 +2,7 @@
#include "displayapp/DisplayApp.h" #include "displayapp/DisplayApp.h"
#include "displayapp/screens/Symbols.h" #include "displayapp/screens/Symbols.h"
#include "displayapp/screens/BatteryIcon.h" #include "displayapp/screens/BatteryIcon.h"
#include <components/ble/BleController.h>
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
@ -22,13 +23,16 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
Controllers::BrightnessController& brightness, Controllers::BrightnessController& brightness,
Controllers::MotorController& motorController, Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController) Pinetime::Controllers::Settings& settingsController,
Controllers::Ble& bleController)
: Screen(app), : Screen(app),
batteryController {batteryController},
dateTimeController {dateTimeController}, dateTimeController {dateTimeController},
brightness {brightness}, brightness {brightness},
motorController {motorController}, motorController {motorController},
settingsController {settingsController} { settingsController {settingsController},
statusIcons(batteryController, bleController) {
statusIcons.Create();
// This is the distance (padding) between all objects on this screen. // This is the distance (padding) between all objects on this screen.
static constexpr uint8_t innerDistance = 10; static constexpr uint8_t innerDistance = 10;
@ -38,9 +42,6 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER); lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0); lv_obj_align(label_time, lv_scr_act(), 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);
static constexpr uint8_t barHeight = 20 + innerDistance; static constexpr uint8_t barHeight = 20 + innerDistance;
static constexpr uint8_t buttonHeight = (LV_VER_RES_MAX - barHeight - innerDistance) / 2; static constexpr uint8_t buttonHeight = (LV_VER_RES_MAX - barHeight - innerDistance) / 2;
static constexpr uint8_t buttonWidth = (LV_HOR_RES_MAX - innerDistance) / 2; // wide buttons static constexpr uint8_t buttonWidth = (LV_HOR_RES_MAX - innerDistance) / 2; // wide buttons
@ -117,7 +118,7 @@ QuickSettings::~QuickSettings() {
void QuickSettings::UpdateScreen() { void QuickSettings::UpdateScreen() {
lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str()); lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str());
batteryIcon.SetBatteryPercentage(batteryController.PercentRemaining()); statusIcons.Update();
} }
void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) { void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {

View file

@ -8,7 +8,7 @@
#include "components/motor/MotorController.h" #include "components/motor/MotorController.h"
#include "components/settings/Settings.h" #include "components/settings/Settings.h"
#include "components/battery/BatteryController.h" #include "components/battery/BatteryController.h"
#include <displayapp/screens/BatteryIcon.h> #include "displayapp/widgets/StatusIcons.h"
namespace Pinetime { namespace Pinetime {
@ -22,7 +22,8 @@ namespace Pinetime {
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
Controllers::BrightnessController& brightness, Controllers::BrightnessController& brightness,
Controllers::MotorController& motorController, Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController); Pinetime::Controllers::Settings& settingsController,
Controllers::Ble& bleController);
~QuickSettings() override; ~QuickSettings() override;
@ -31,7 +32,6 @@ namespace Pinetime {
void UpdateScreen(); void UpdateScreen();
private: private:
Pinetime::Controllers::Battery& batteryController;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;
Controllers::BrightnessController& brightness; Controllers::BrightnessController& brightness;
Controllers::MotorController& motorController; Controllers::MotorController& motorController;
@ -40,6 +40,11 @@ namespace Pinetime {
lv_task_t* taskUpdate; lv_task_t* taskUpdate;
lv_obj_t* label_time; lv_obj_t* label_time;
DirtyValue<uint8_t> batteryPercentRemaining {};
DirtyValue<bool> powerPresent {};
DirtyValue<bool> bleState {};
DirtyValue<bool> bleRadioEnabled {};
lv_style_t btn_style; lv_style_t btn_style;
lv_obj_t* btn1; lv_obj_t* btn1;
@ -49,7 +54,7 @@ namespace Pinetime {
lv_obj_t* btn3_lvl; lv_obj_t* btn3_lvl;
lv_obj_t* btn4; lv_obj_t* btn4;
BatteryIcon batteryIcon; Widgets::StatusIcons statusIcons;
}; };
} }
} }

View file

@ -0,0 +1,55 @@
#include "displayapp/widgets/StatusIcons.h"
#include "displayapp/screens/Symbols.h"
using namespace Pinetime::Applications::Widgets;
StatusIcons::StatusIcons(Controllers::Battery& batteryController, Controllers::Ble& bleController)
: batteryController {batteryController}, bleController {bleController} {
}
void StatusIcons::Align() {
lv_obj_t* lastIcon = batteryIcon.GetObject();
for (auto& icon : icons) {
if (!lv_obj_get_hidden(icon)) {
lv_obj_align(icon, lastIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
lastIcon = icon;
}
}
}
void StatusIcons::Create() {
batteryIcon.Create(lv_scr_act());
lv_obj_align(batteryIcon.GetObject(), lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
icons[Icons::BatteryPlug] = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icons[Icons::BatteryPlug], LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFF0000));
lv_label_set_text_static(icons[Icons::BatteryPlug], Screens::Symbols::plug);
icons[Icons::BleIcon] = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icons[Icons::BleIcon], LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x0082FC));
lv_label_set_text_static(icons[Icons::BleIcon], Screens::Symbols::bluetooth);
Align();
}
void StatusIcons::Update() {
powerPresent = batteryController.IsPowerPresent();
if (powerPresent.IsUpdated()) {
lv_obj_set_hidden(icons[Icons::BatteryPlug], !powerPresent.Get());
}
batteryPercentRemaining = batteryController.PercentRemaining();
if (batteryPercentRemaining.IsUpdated()) {
auto batteryPercent = batteryPercentRemaining.Get();
batteryIcon.SetBatteryPercentage(batteryPercent);
}
bleState = bleController.IsConnected();
bleRadioEnabled = bleController.IsRadioEnabled();
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
lv_obj_set_hidden(icons[Icons::BleIcon], !bleState.Get());
}
Align();
}

View file

@ -0,0 +1,38 @@
#pragma once
#include <lvgl/lvgl.h>
#include "displayapp/screens/Screen.h"
#include "components/battery/BatteryController.h"
#include "components/ble/BleController.h"
#include "displayapp/screens/BatteryIcon.h"
namespace Pinetime {
namespace Applications {
namespace Widgets {
class StatusIcons {
public:
StatusIcons(Controllers::Battery& batteryController, Controllers::Ble& bleController);
void Align();
void Create();
lv_obj_t* GetObject() {
return batteryIcon.GetObject();
}
void Update();
private:
Screens::BatteryIcon batteryIcon;
Pinetime::Controllers::Battery& batteryController;
Controllers::Ble& bleController;
Screens::DirtyValue<uint8_t> batteryPercentRemaining {};
Screens::DirtyValue<bool> powerPresent {};
Screens::DirtyValue<bool> bleState {};
Screens::DirtyValue<bool> bleRadioEnabled {};
enum Icons { BatteryPlug, BleIcon };
lv_obj_t* icons[2];
};
}
}
}