Compare commits

...

3 commits

Author SHA1 Message Date
Jozef Mlich 8914788e62
Merge 5bcaa4f09a into a2356f2f4a 2024-10-03 05:48:50 +00:00
Jozef Mlich 5bcaa4f09a
Merge branch 'main' into main 2024-10-03 07:48:46 +02:00
Jozef Mlich f0e01cb0de Show alarm controller state in status icon 2024-08-24 10:24:09 +02:00
12 changed files with 42 additions and 9 deletions

View file

@ -504,6 +504,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
settingsController, settingsController,
batteryController, batteryController,
bleController, bleController,
alarmController,
dateTimeController, dateTimeController,
filesystem, filesystem,
std::move(apps)); std::move(apps));
@ -558,7 +559,8 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
brightnessController, brightnessController,
motorController, motorController,
settingsController, settingsController,
bleController); bleController,
alarmController);
break; break;
case Apps::Settings: case Apps::Settings:
currentScreen = std::make_unique<Screens::Settings>(this, settingsController); currentScreen = std::make_unique<Screens::Settings>(this, settingsController);

View file

@ -21,6 +21,7 @@ ApplicationList::ApplicationList(DisplayApp* app,
Pinetime::Controllers::Settings& settingsController, Pinetime::Controllers::Settings& settingsController,
const Pinetime::Controllers::Battery& batteryController, const Pinetime::Controllers::Battery& batteryController,
const Pinetime::Controllers::Ble& bleController, const Pinetime::Controllers::Ble& bleController,
const Pinetime::Controllers::AlarmController& alarmController,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
Pinetime::Controllers::FS& filesystem, Pinetime::Controllers::FS& filesystem,
std::array<Tile::Applications, UserAppTypes::Count>&& apps) std::array<Tile::Applications, UserAppTypes::Count>&& apps)
@ -28,6 +29,7 @@ ApplicationList::ApplicationList(DisplayApp* app,
settingsController {settingsController}, settingsController {settingsController},
batteryController {batteryController}, batteryController {batteryController},
bleController {bleController}, bleController {bleController},
alarmController {alarmController},
dateTimeController {dateTimeController}, dateTimeController {dateTimeController},
filesystem {filesystem}, filesystem {filesystem},
apps {std::move(apps)}, apps {std::move(apps)},
@ -59,6 +61,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen(unsigned int screenNum) co
settingsController, settingsController,
batteryController, batteryController,
bleController, bleController,
alarmController,
dateTimeController, dateTimeController,
pageApps); pageApps);
} }

View file

@ -18,6 +18,7 @@ namespace Pinetime {
Pinetime::Controllers::Settings& settingsController, Pinetime::Controllers::Settings& settingsController,
const Pinetime::Controllers::Battery& batteryController, const Pinetime::Controllers::Battery& batteryController,
const Pinetime::Controllers::Ble& bleController, const Pinetime::Controllers::Ble& bleController,
const Pinetime::Controllers::AlarmController& alarmController,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
Pinetime::Controllers::FS& filesystem, Pinetime::Controllers::FS& filesystem,
std::array<Tile::Applications, UserAppTypes::Count>&& apps); std::array<Tile::Applications, UserAppTypes::Count>&& apps);
@ -32,6 +33,7 @@ namespace Pinetime {
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
const Pinetime::Controllers::Battery& batteryController; const Pinetime::Controllers::Battery& batteryController;
const Pinetime::Controllers::Ble& bleController; const Pinetime::Controllers::Ble& bleController;
const Pinetime::Controllers::AlarmController& alarmController;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;
Pinetime::Controllers::FS& filesystem; Pinetime::Controllers::FS& filesystem;
std::array<Tile::Applications, UserAppTypes::Count> apps; std::array<Tile::Applications, UserAppTypes::Count> apps;

View file

@ -180,6 +180,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
extern int mallocFailedCount; extern int mallocFailedCount;
extern int stackOverflowCount; extern int stackOverflowCount;
std::unique_ptr<Screen> SystemInfo::CreateScreen3() { std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
lv_mem_monitor_t mon; lv_mem_monitor_t mon;
lv_mem_monitor(&mon); lv_mem_monitor(&mon);

View file

@ -29,9 +29,13 @@ Tile::Tile(uint8_t screenID,
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
const Controllers::Battery& batteryController, const Controllers::Battery& batteryController,
const Controllers::Ble& bleController, const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
std::array<Applications, 6>& applications) std::array<Applications, 6>& applications)
: app {app}, dateTimeController {dateTimeController}, pageIndicator(screenID, numScreens), statusIcons(batteryController, bleController) { : app {app},
dateTimeController {dateTimeController},
pageIndicator(screenID, numScreens),
statusIcons(batteryController, bleController, alarmController) {
settingsController.SetAppMenu(screenID); settingsController.SetAppMenu(screenID);

View file

@ -28,6 +28,7 @@ namespace Pinetime {
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
const Controllers::Battery& batteryController, const Controllers::Battery& batteryController,
const Controllers::Ble& bleController, const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
std::array<Applications, 6>& applications); std::array<Applications, 6>& applications);

View file

@ -18,6 +18,7 @@ using namespace Pinetime::Applications::Screens;
WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
const Controllers::Battery& batteryController, const Controllers::Battery& batteryController,
const Controllers::Ble& bleController, const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController,
Controllers::NotificationManager& notificationManager, Controllers::NotificationManager& notificationManager,
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
Controllers::HeartRateController& heartRateController, Controllers::HeartRateController& heartRateController,
@ -30,7 +31,7 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
heartRateController {heartRateController}, heartRateController {heartRateController},
motionController {motionController}, motionController {motionController},
weatherService {weatherService}, weatherService {weatherService},
statusIcons(batteryController, bleController) { statusIcons(batteryController, bleController, alarmController) {
statusIcons.Create(); statusIcons.Create();

View file

@ -17,6 +17,7 @@ namespace Pinetime {
class Settings; class Settings;
class Battery; class Battery;
class Ble; class Ble;
class AlarmController;
class NotificationManager; class NotificationManager;
class HeartRateController; class HeartRateController;
class MotionController; class MotionController;
@ -30,6 +31,7 @@ namespace Pinetime {
WatchFaceDigital(Controllers::DateTime& dateTimeController, WatchFaceDigital(Controllers::DateTime& dateTimeController,
const Controllers::Battery& batteryController, const Controllers::Battery& batteryController,
const Controllers::Ble& bleController, const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController,
Controllers::NotificationManager& notificationManager, Controllers::NotificationManager& notificationManager,
Controllers::Settings& settingsController, Controllers::Settings& settingsController,
Controllers::HeartRateController& heartRateController, Controllers::HeartRateController& heartRateController,
@ -84,6 +86,7 @@ namespace Pinetime {
return new Screens::WatchFaceDigital(controllers.dateTimeController, return new Screens::WatchFaceDigital(controllers.dateTimeController,
controllers.batteryController, controllers.batteryController,
controllers.bleController, controllers.bleController,
controllers.alarmController,
controllers.notificationManager, controllers.notificationManager,
controllers.settingsController, controllers.settingsController,
controllers.heartRateController, controllers.heartRateController,

View file

@ -33,13 +33,14 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
Controllers::BrightnessController& brightness, Controllers::BrightnessController& brightness,
Controllers::MotorController& motorController, Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController, Pinetime::Controllers::Settings& settingsController,
const Controllers::Ble& bleController) const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController)
: app {app}, : app {app},
dateTimeController {dateTimeController}, dateTimeController {dateTimeController},
brightness {brightness}, brightness {brightness},
motorController {motorController}, motorController {motorController},
settingsController {settingsController}, settingsController {settingsController},
statusIcons(batteryController, bleController) { statusIcons(batteryController, bleController, alarmController) {
statusIcons.Create(); statusIcons.Create();

View file

@ -23,7 +23,8 @@ namespace Pinetime {
Controllers::BrightnessController& brightness, Controllers::BrightnessController& brightness,
Controllers::MotorController& motorController, Controllers::MotorController& motorController,
Pinetime::Controllers::Settings& settingsController, Pinetime::Controllers::Settings& settingsController,
const Controllers::Ble& bleController); const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController);
~QuickSettings() override; ~QuickSettings() override;

View file

@ -1,10 +1,13 @@
#include "displayapp/widgets/StatusIcons.h" #include "displayapp/widgets/StatusIcons.h"
#include "displayapp/screens/Symbols.h" #include "displayapp/screens/Symbols.h"
#include "components/alarm/AlarmController.h"
using namespace Pinetime::Applications::Widgets; using namespace Pinetime::Applications::Widgets;
StatusIcons::StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController) StatusIcons::StatusIcons(const Controllers::Battery& batteryController,
: batteryIcon(true), batteryController {batteryController}, bleController {bleController} { const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController)
: batteryIcon(true), batteryController {batteryController}, bleController {bleController}, alarmController {alarmController} {
} }
void StatusIcons::Create() { void StatusIcons::Create() {
@ -20,6 +23,9 @@ void StatusIcons::Create() {
batteryPlug = lv_label_create(container, nullptr); batteryPlug = lv_label_create(container, nullptr);
lv_label_set_text_static(batteryPlug, Screens::Symbols::plug); lv_label_set_text_static(batteryPlug, Screens::Symbols::plug);
alarmIcon = lv_label_create(container, nullptr);
lv_label_set_text_static(alarmIcon, Screens::Symbols::bell);
batteryIcon.Create(container); batteryIcon.Create(container);
lv_obj_align(container, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); lv_obj_align(container, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
@ -37,6 +43,9 @@ void StatusIcons::Update() {
batteryIcon.SetBatteryPercentage(batteryPercent); batteryIcon.SetBatteryPercentage(batteryPercent);
} }
bool alarmNotSet = (alarmController.State() == Pinetime::Controllers::AlarmController::AlarmState::Not_Set);
lv_obj_set_hidden(alarmIcon, alarmNotSet);
bleState = bleController.IsConnected(); bleState = bleController.IsConnected();
bleRadioEnabled = bleController.IsRadioEnabled(); bleRadioEnabled = bleController.IsRadioEnabled();
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {

View file

@ -5,6 +5,7 @@
#include "displayapp/screens/Screen.h" #include "displayapp/screens/Screen.h"
#include "components/battery/BatteryController.h" #include "components/battery/BatteryController.h"
#include "components/ble/BleController.h" #include "components/ble/BleController.h"
#include "components/alarm/AlarmController.h"
#include "displayapp/screens/BatteryIcon.h" #include "displayapp/screens/BatteryIcon.h"
#include "utility/DirtyValue.h" #include "utility/DirtyValue.h"
@ -13,7 +14,9 @@ namespace Pinetime {
namespace Widgets { namespace Widgets {
class StatusIcons { class StatusIcons {
public: public:
StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController); StatusIcons(const Controllers::Battery& batteryController,
const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController);
void Align(); void Align();
void Create(); void Create();
@ -27,6 +30,7 @@ namespace Pinetime {
Screens::BatteryIcon batteryIcon; Screens::BatteryIcon batteryIcon;
const Pinetime::Controllers::Battery& batteryController; const Pinetime::Controllers::Battery& batteryController;
const Controllers::Ble& bleController; const Controllers::Ble& bleController;
const Controllers::AlarmController& alarmController;
Utility::DirtyValue<uint8_t> batteryPercentRemaining {}; Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
Utility::DirtyValue<bool> powerPresent {}; Utility::DirtyValue<bool> powerPresent {};
@ -34,6 +38,7 @@ namespace Pinetime {
Utility::DirtyValue<bool> bleRadioEnabled {}; Utility::DirtyValue<bool> bleRadioEnabled {};
lv_obj_t* bleIcon; lv_obj_t* bleIcon;
lv_obj_t* alarmIcon;
lv_obj_t* batteryPlug; lv_obj_t* batteryPlug;
lv_obj_t* container; lv_obj_t* container;
}; };