Skip to content

Commit 3e23ee7

Browse files
jmlichJF002
authored andcommitted
Show alarm controller state in status icon
1 parent d69cfcf commit 3e23ee7

11 files changed

+44
-9
lines changed

src/displayapp/DisplayApp.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
526526
settingsController,
527527
batteryController,
528528
bleController,
529+
alarmController,
529530
dateTimeController,
530531
filesystem,
531532
std::move(apps));
@@ -580,7 +581,8 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
580581
brightnessController,
581582
motorController,
582583
settingsController,
583-
bleController);
584+
bleController,
585+
alarmController);
584586
break;
585587
case Apps::Settings:
586588
currentScreen = std::make_unique<Screens::Settings>(this, settingsController);

src/displayapp/screens/ApplicationList.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ ApplicationList::ApplicationList(DisplayApp* app,
2121
Pinetime::Controllers::Settings& settingsController,
2222
const Pinetime::Controllers::Battery& batteryController,
2323
const Pinetime::Controllers::Ble& bleController,
24+
const Pinetime::Controllers::AlarmController& alarmController,
2425
Controllers::DateTime& dateTimeController,
2526
Pinetime::Controllers::FS& filesystem,
2627
std::array<Tile::Applications, UserAppTypes::Count>&& apps)
2728
: app {app},
2829
settingsController {settingsController},
2930
batteryController {batteryController},
3031
bleController {bleController},
32+
alarmController {alarmController},
3133
dateTimeController {dateTimeController},
3234
filesystem {filesystem},
3335
apps {std::move(apps)},
@@ -59,6 +61,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen(unsigned int screenNum) co
5961
settingsController,
6062
batteryController,
6163
bleController,
64+
alarmController,
6265
dateTimeController,
6366
pageApps);
6467
}

src/displayapp/screens/ApplicationList.h

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Pinetime {
1818
Pinetime::Controllers::Settings& settingsController,
1919
const Pinetime::Controllers::Battery& batteryController,
2020
const Pinetime::Controllers::Ble& bleController,
21+
const Pinetime::Controllers::AlarmController& alarmController,
2122
Controllers::DateTime& dateTimeController,
2223
Pinetime::Controllers::FS& filesystem,
2324
std::array<Tile::Applications, UserAppTypes::Count>&& apps);
@@ -32,6 +33,7 @@ namespace Pinetime {
3233
Controllers::Settings& settingsController;
3334
const Pinetime::Controllers::Battery& batteryController;
3435
const Pinetime::Controllers::Ble& bleController;
36+
const Pinetime::Controllers::AlarmController& alarmController;
3537
Controllers::DateTime& dateTimeController;
3638
Pinetime::Controllers::FS& filesystem;
3739
std::array<Tile::Applications, UserAppTypes::Count> apps;

src/displayapp/screens/Tile.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ Tile::Tile(uint8_t screenID,
2929
Controllers::Settings& settingsController,
3030
const Controllers::Battery& batteryController,
3131
const Controllers::Ble& bleController,
32+
const Controllers::AlarmController& alarmController,
3233
Controllers::DateTime& dateTimeController,
3334
std::array<Applications, 6>& applications)
34-
: app {app}, dateTimeController {dateTimeController}, pageIndicator(screenID, numScreens), statusIcons(batteryController, bleController) {
35+
: app {app},
36+
dateTimeController {dateTimeController},
37+
pageIndicator(screenID, numScreens),
38+
statusIcons(batteryController, bleController, alarmController) {
3539

3640
settingsController.SetAppMenu(screenID);
3741

src/displayapp/screens/Tile.h

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace Pinetime {
2828
Controllers::Settings& settingsController,
2929
const Controllers::Battery& batteryController,
3030
const Controllers::Ble& bleController,
31+
const Controllers::AlarmController& alarmController,
3132
Controllers::DateTime& dateTimeController,
3233
std::array<Applications, 6>& applications);
3334

src/displayapp/screens/WatchFaceDigital.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ using namespace Pinetime::Applications::Screens;
1919
WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
2020
const Controllers::Battery& batteryController,
2121
const Controllers::Ble& bleController,
22+
const Controllers::AlarmController& alarmController,
2223
Controllers::NotificationManager& notificationManager,
2324
Controllers::Settings& settingsController,
2425
Controllers::HeartRateController& heartRateController,
@@ -31,7 +32,7 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
3132
heartRateController {heartRateController},
3233
motionController {motionController},
3334
weatherService {weatherService},
34-
statusIcons(batteryController, bleController) {
35+
statusIcons(batteryController, bleController, alarmController) {
3536

3637
statusIcons.Create();
3738

src/displayapp/screens/WatchFaceDigital.h

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Pinetime {
1717
class Settings;
1818
class Battery;
1919
class Ble;
20+
class AlarmController;
2021
class NotificationManager;
2122
class HeartRateController;
2223
class MotionController;
@@ -30,6 +31,7 @@ namespace Pinetime {
3031
WatchFaceDigital(Controllers::DateTime& dateTimeController,
3132
const Controllers::Battery& batteryController,
3233
const Controllers::Ble& bleController,
34+
const Controllers::AlarmController& alarmController,
3335
Controllers::NotificationManager& notificationManager,
3436
Controllers::Settings& settingsController,
3537
Controllers::HeartRateController& heartRateController,
@@ -84,6 +86,7 @@ namespace Pinetime {
8486
return new Screens::WatchFaceDigital(controllers.dateTimeController,
8587
controllers.batteryController,
8688
controllers.bleController,
89+
controllers.alarmController,
8790
controllers.notificationManager,
8891
controllers.settingsController,
8992
controllers.heartRateController,

src/displayapp/screens/settings/QuickSettings.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
3333
Controllers::BrightnessController& brightness,
3434
Controllers::MotorController& motorController,
3535
Pinetime::Controllers::Settings& settingsController,
36-
const Controllers::Ble& bleController)
36+
const Controllers::Ble& bleController,
37+
const Controllers::AlarmController& alarmController)
3738
: app {app},
3839
dateTimeController {dateTimeController},
3940
brightness {brightness},
4041
motorController {motorController},
4142
settingsController {settingsController},
42-
statusIcons(batteryController, bleController) {
43+
statusIcons(batteryController, bleController, alarmController) {
4344

4445
statusIcons.Create();
4546

src/displayapp/screens/settings/QuickSettings.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ namespace Pinetime {
2323
Controllers::BrightnessController& brightness,
2424
Controllers::MotorController& motorController,
2525
Pinetime::Controllers::Settings& settingsController,
26-
const Controllers::Ble& bleController);
26+
const Controllers::Ble& bleController,
27+
const Controllers::AlarmController& alarmController);
2728

2829
~QuickSettings() override;
2930

src/displayapp/widgets/StatusIcons.cpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#include "displayapp/widgets/StatusIcons.h"
22
#include "displayapp/screens/Symbols.h"
3+
#include "components/alarm/AlarmController.h"
34

45
using namespace Pinetime::Applications::Widgets;
56

6-
StatusIcons::StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController)
7-
: batteryIcon(true), batteryController {batteryController}, bleController {bleController} {
7+
StatusIcons::StatusIcons(const Controllers::Battery& batteryController,
8+
const Controllers::Ble& bleController,
9+
const Controllers::AlarmController& alarmController)
10+
: batteryIcon(true), batteryController {batteryController}, bleController {bleController}, alarmController {alarmController} {
811
}
912

1013
void StatusIcons::Create() {
@@ -20,6 +23,9 @@ void StatusIcons::Create() {
2023
batteryPlug = lv_label_create(container, nullptr);
2124
lv_label_set_text_static(batteryPlug, Screens::Symbols::plug);
2225

26+
alarmIcon = lv_label_create(container, nullptr);
27+
lv_label_set_text_static(alarmIcon, Screens::Symbols::bell);
28+
2329
batteryIcon.Create(container);
2430

2531
lv_obj_align(container, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
@@ -37,6 +43,11 @@ void StatusIcons::Update() {
3743
batteryIcon.SetBatteryPercentage(batteryPercent);
3844
}
3945

46+
alarmEnabled = alarmController.IsEnabled();
47+
if (alarmEnabled.IsUpdated()) {
48+
lv_obj_set_hidden(alarmIcon, !alarmEnabled.Get());
49+
}
50+
4051
bleState = bleController.IsConnected();
4152
bleRadioEnabled = bleController.IsRadioEnabled();
4253
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {

src/displayapp/widgets/StatusIcons.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "displayapp/screens/Screen.h"
66
#include "components/battery/BatteryController.h"
77
#include "components/ble/BleController.h"
8+
#include "components/alarm/AlarmController.h"
89
#include "displayapp/screens/BatteryIcon.h"
910
#include "utility/DirtyValue.h"
1011

@@ -13,7 +14,9 @@ namespace Pinetime {
1314
namespace Widgets {
1415
class StatusIcons {
1516
public:
16-
StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController);
17+
StatusIcons(const Controllers::Battery& batteryController,
18+
const Controllers::Ble& bleController,
19+
const Controllers::AlarmController& alarmController);
1720
void Align();
1821
void Create();
1922

@@ -27,13 +30,16 @@ namespace Pinetime {
2730
Screens::BatteryIcon batteryIcon;
2831
const Pinetime::Controllers::Battery& batteryController;
2932
const Controllers::Ble& bleController;
33+
const Controllers::AlarmController& alarmController;
3034

3135
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
3236
Utility::DirtyValue<bool> powerPresent {};
3337
Utility::DirtyValue<bool> bleState {};
3438
Utility::DirtyValue<bool> bleRadioEnabled {};
39+
Utility::DirtyValue<bool> alarmEnabled {};
3540

3641
lv_obj_t* bleIcon;
42+
lv_obj_t* alarmIcon;
3743
lv_obj_t* batteryPlug;
3844
lv_obj_t* container;
3945
};

0 commit comments

Comments
 (0)