summaryrefslogtreecommitdiff
path: root/src/displayapp/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens')
-rw-r--r--src/displayapp/screens/ApplicationList.cpp78
-rw-r--r--src/displayapp/screens/ApplicationList.h32
-rw-r--r--src/displayapp/screens/BatteryIcon.cpp19
-rw-r--r--src/displayapp/screens/BatteryIcon.h4
-rw-r--r--src/displayapp/screens/BatteryInfo.cpp88
-rw-r--r--src/displayapp/screens/BatteryInfo.h41
-rw-r--r--src/displayapp/screens/BleIcon.cpp6
-rw-r--r--src/displayapp/screens/Brightness.cpp61
-rw-r--r--src/displayapp/screens/Brightness.h32
-rw-r--r--src/displayapp/screens/Clock.cpp89
-rw-r--r--src/displayapp/screens/Clock.h67
-rw-r--r--src/displayapp/screens/DropDownDemo.cpp34
-rw-r--r--src/displayapp/screens/DropDownDemo.h20
-rw-r--r--src/displayapp/screens/FirmwareUpdate.cpp17
-rw-r--r--src/displayapp/screens/FirmwareUpdate.h35
-rw-r--r--src/displayapp/screens/FirmwareValidation.cpp34
-rw-r--r--src/displayapp/screens/FirmwareValidation.h42
-rw-r--r--src/displayapp/screens/FlashLight.cpp39
-rw-r--r--src/displayapp/screens/FlashLight.h30
-rw-r--r--src/displayapp/screens/HeartRate.cpp43
-rw-r--r--src/displayapp/screens/HeartRate.h9
-rw-r--r--src/displayapp/screens/InfiniPaint.cpp11
-rw-r--r--src/displayapp/screens/InfiniPaint.h1
-rw-r--r--src/displayapp/screens/Label.cpp14
-rw-r--r--src/displayapp/screens/Label.h27
-rw-r--r--src/displayapp/screens/List.cpp50
-rw-r--r--src/displayapp/screens/List.h58
-rw-r--r--src/displayapp/screens/Meter.cpp20
-rw-r--r--src/displayapp/screens/Meter.h20
-rw-r--r--src/displayapp/screens/Motion.cpp10
-rw-r--r--src/displayapp/screens/Motion.h13
-rw-r--r--src/displayapp/screens/Music.cpp117
-rw-r--r--src/displayapp/screens/Music.h57
-rw-r--r--src/displayapp/screens/Navigation.cpp22
-rw-r--r--src/displayapp/screens/Navigation.h196
-rw-r--r--src/displayapp/screens/NotificationIcon.cpp6
-rw-r--r--src/displayapp/screens/Notifications.cpp114
-rw-r--r--src/displayapp/screens/Notifications.h61
-rw-r--r--src/displayapp/screens/Paddle.cpp237
-rw-r--r--src/displayapp/screens/Paddle.h64
-rw-r--r--src/displayapp/screens/Screen.h98
-rw-r--r--src/displayapp/screens/ScreenList.h160
-rw-r--r--src/displayapp/screens/StopWatch.cpp37
-rw-r--r--src/displayapp/screens/StopWatch.h4
-rw-r--r--src/displayapp/screens/Symbols.h17
-rw-r--r--src/displayapp/screens/SystemInfo.cpp275
-rw-r--r--src/displayapp/screens/SystemInfo.h56
-rw-r--r--src/displayapp/screens/Tile.cpp66
-rw-r--r--src/displayapp/screens/Tile.h72
-rw-r--r--src/displayapp/screens/Twos.cpp146
-rw-r--r--src/displayapp/screens/Twos.h42
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.cpp111
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.h103
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp133
-rw-r--r--src/displayapp/screens/WatchFaceDigital.h97
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp89
-rw-r--r--src/displayapp/screens/settings/QuickSettings.h72
-rw-r--r--src/displayapp/screens/settings/SettingDisplay.cpp62
-rw-r--r--src/displayapp/screens/settings/SettingDisplay.h22
-rw-r--r--src/displayapp/screens/settings/SettingTimeFormat.cpp48
-rw-r--r--src/displayapp/screens/settings/SettingTimeFormat.h22
-rw-r--r--src/displayapp/screens/settings/SettingWakeUp.cpp64
-rw-r--r--src/displayapp/screens/settings/SettingWakeUp.h22
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.cpp38
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.h22
-rw-r--r--src/displayapp/screens/settings/Settings.cpp57
-rw-r--r--src/displayapp/screens/settings/Settings.h29
67 files changed, 1953 insertions, 1929 deletions
diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp
index 056d128c..7e38b3f4 100644
--- a/src/displayapp/screens/ApplicationList.cpp
+++ b/src/displayapp/screens/ApplicationList.cpp
@@ -8,31 +8,34 @@
using namespace Pinetime::Applications::Screens;
-ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::Settings &settingsController,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController) :
- Screen(app),
- settingsController{settingsController},
- batteryController{batteryController},
- dateTimeController{dateTimeController},
- screens{app,
- settingsController.GetAppMenu(),
- {
- [this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen2(); },
- //[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); }
- },
- Screens::ScreenListModes::UpDown
- } {}
-
+ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp* app,
+ Pinetime::Controllers::Settings& settingsController,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController)
+ : Screen(app),
+ settingsController {settingsController},
+ batteryController {batteryController},
+ dateTimeController {dateTimeController},
+ screens {app,
+ settingsController.GetAppMenu(),
+ {
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen1();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen2();
+ },
+ //[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); }
+ },
+ Screens::ScreenListModes::UpDown} {
+}
ApplicationList::~ApplicationList() {
lv_obj_clean(lv_scr_act());
}
bool ApplicationList::Refresh() {
- if(running)
+ if (running)
running = screens.Refresh();
return running;
}
@@ -42,31 +45,27 @@ bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
- std::array<Screens::Tile::Applications, 6> applications {
- {
- {Symbols::stopWatch, Apps::StopWatch},
- {Symbols::music, Apps::Music},
- {Symbols::map, Apps::Navigation},
- {Symbols::shoe, Apps::Motion},
- {Symbols::heartBeat, Apps::HeartRate},
- {"", Apps::None},
- }
- };
+ std::array<Screens::Tile::Applications, 6> applications {{
+ {Symbols::stopWatch, Apps::StopWatch},
+ {Symbols::music, Apps::Music},
+ {Symbols::map, Apps::Navigation},
+ {Symbols::shoe, Apps::Motion},
+ {Symbols::heartBeat, Apps::HeartRate},
+ {"", Apps::None},
+ }};
return std::make_unique<Screens::Tile>(0, 2, app, settingsController, batteryController, dateTimeController, applications);
}
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
- std::array<Screens::Tile::Applications, 6> applications {
- {
- {Symbols::paintbrush, Apps::Paint},
- {Symbols::paddle, Apps::Paddle},
- {"2", Apps::Twos},
- {"", Apps::None},
- {"", Apps::None},
- {"", Apps::None},
- }
- };
+ std::array<Screens::Tile::Applications, 6> applications {{
+ {Symbols::paintbrush, Apps::Paint},
+ {Symbols::paddle, Apps::Paddle},
+ {"2", Apps::Twos},
+ {"", Apps::None},
+ {"", Apps::None},
+ {"", Apps::None},
+ }};
return std::make_unique<Screens::Tile>(1, 2, app, settingsController, batteryController, dateTimeController, applications);
}
@@ -84,4 +83,3 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
return std::make_unique<Screens::Tile>(2, 3, app, settingsController, batteryController, dateTimeController, applications);
}*/
-
diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h
index e334ccde..88534ec4 100644
--- a/src/displayapp/screens/ApplicationList.h
+++ b/src/displayapp/screens/ApplicationList.h
@@ -12,24 +12,24 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class ApplicationList : public Screen {
- public:
- explicit ApplicationList(DisplayApp* app,
- Pinetime::Controllers::Settings &settingsController,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController);
- ~ApplicationList() override;
- bool Refresh() override;
- bool OnTouchEvent(TouchEvents event) override;
- private:
+ public:
+ explicit ApplicationList(DisplayApp* app,
+ Pinetime::Controllers::Settings& settingsController,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController);
+ ~ApplicationList() override;
+ bool Refresh() override;
+ bool OnTouchEvent(TouchEvents event) override;
- Controllers::Settings& settingsController;
- Pinetime::Controllers::Battery& batteryController;
- Controllers::DateTime& dateTimeController;
+ private:
+ Controllers::Settings& settingsController;
+ Pinetime::Controllers::Battery& batteryController;
+ Controllers::DateTime& dateTimeController;
- ScreenList<2> screens;
- std::unique_ptr<Screen> CreateScreen1();
- std::unique_ptr<Screen> CreateScreen2();
- //std::unique_ptr<Screen> CreateScreen3();
+ ScreenList<2> screens;
+ std::unique_ptr<Screen> CreateScreen1();
+ std::unique_ptr<Screen> CreateScreen2();
+ // std::unique_ptr<Screen> CreateScreen3();
};
}
}
diff --git a/src/displayapp/screens/BatteryIcon.cpp b/src/displayapp/screens/BatteryIcon.cpp
index 455b0c6d..6b54a305 100644
--- a/src/displayapp/screens/BatteryIcon.cpp
+++ b/src/displayapp/screens/BatteryIcon.cpp
@@ -4,10 +4,14 @@
using namespace Pinetime::Applications::Screens;
const char* BatteryIcon::GetBatteryIcon(int batteryPercent) {
- if(batteryPercent > 90) return Symbols::batteryFull;
- if(batteryPercent > 75) return Symbols::batteryThreeQuarter;
- if(batteryPercent > 50) return Symbols::batteryHalf;
- if(batteryPercent > 25) return Symbols::batteryOneQuarter;
+ if (batteryPercent > 90)
+ return Symbols::batteryFull;
+ if (batteryPercent > 75)
+ return Symbols::batteryThreeQuarter;
+ if (batteryPercent > 50)
+ return Symbols::batteryHalf;
+ if (batteryPercent > 25)
+ return Symbols::batteryOneQuarter;
return Symbols::batteryEmpty;
}
@@ -15,8 +19,9 @@ const char* BatteryIcon::GetUnknownIcon() {
return Symbols::batteryEmpty;
}
-const char *BatteryIcon::GetPlugIcon(bool isCharging) {
- if(isCharging)
+const char* BatteryIcon::GetPlugIcon(bool isCharging) {
+ if (isCharging)
return Symbols::plug;
- else return "";
+ else
+ return "";
}
diff --git a/src/displayapp/screens/BatteryIcon.h b/src/displayapp/screens/BatteryIcon.h
index 006e5621..9c192ff7 100644
--- a/src/displayapp/screens/BatteryIcon.h
+++ b/src/displayapp/screens/BatteryIcon.h
@@ -6,8 +6,8 @@ namespace Pinetime {
class BatteryIcon {
public:
static const char* GetUnknownIcon();
- static const char* GetBatteryIcon(int batteryPercent);
- static const char* GetPlugIcon(bool isCharging);
+ static const char* GetBatteryIcon(int batteryPercent);
+ static const char* GetPlugIcon(bool isCharging);
};
}
}
diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp
index ae39138f..1ab8b0ad 100644
--- a/src/displayapp/screens/BatteryInfo.cpp
+++ b/src/displayapp/screens/BatteryInfo.cpp
@@ -4,22 +4,18 @@
using namespace Pinetime::Applications::Screens;
-static void lv_update_task(struct _lv_task_t *task) {
- auto user_data = static_cast<BatteryInfo *>(task->user_data);
+static void lv_update_task(struct _lv_task_t* task) {
+ auto user_data = static_cast<BatteryInfo*>(task->user_data);
user_data->UpdateScreen();
}
-static void lv_anim_task(struct _lv_task_t *task) {
- auto user_data = static_cast<BatteryInfo *>(task->user_data);
+static void lv_anim_task(struct _lv_task_t* task) {
+ auto user_data = static_cast<BatteryInfo*>(task->user_data);
user_data->UpdateAnim();
}
-BatteryInfo::BatteryInfo(
- Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::Battery& batteryController) :
- Screen(app),
- batteryController{batteryController}
-{
+BatteryInfo::BatteryInfo(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Battery& batteryController)
+ : Screen(app), batteryController {batteryController} {
batteryPercent = batteryController.PercentRemaining();
batteryVoltage = batteryController.Voltage();
@@ -32,37 +28,38 @@ BatteryInfo::BatteryInfo(
lv_obj_set_style_local_radius(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, lv_color_hex(0x222222));
lv_obj_set_style_local_bg_opa(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_OPA_100);
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, lv_color_hex(0xFF0000));
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, lv_color_hex(0xFF0000));
lv_bar_set_value(charging_bar, batteryPercent, LV_ANIM_OFF);
- status = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(status,"Reading Battery status");
+ status = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(status, "Reading Battery status");
lv_label_set_align(status, LV_LABEL_ALIGN_CENTER);
lv_obj_align(status, charging_bar, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
-
+
percent = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(percent, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
- if ( batteryPercent >= 0) {
- lv_label_set_text_fmt(percent,"%02i%%", batteryPercent);
+ if (batteryPercent >= 0) {
+ lv_label_set_text_fmt(percent, "%02i%%", batteryPercent);
} else {
- lv_label_set_text(percent,"--%");
+ lv_label_set_text(percent, "--%");
}
lv_label_set_align(percent, LV_LABEL_ALIGN_LEFT);
lv_obj_align(percent, nullptr, LV_ALIGN_CENTER, 0, -60);
// hack to not use the flot functions from printf
uint8_t batteryVoltageBytes[2];
- batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); //truncate whole numbers
- batteryVoltageBytes[0] = static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); //remove whole part of flt and shift 2 places over
+ batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); // truncate whole numbers
+ batteryVoltageBytes[0] =
+ static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); // remove whole part of flt and shift 2 places over
//
- voltage = lv_label_create(lv_scr_act(), nullptr);
+ voltage = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(voltage, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xC6A600));
- lv_label_set_text_fmt(voltage,"%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]);
+ lv_label_set_text_fmt(voltage, "%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]);
lv_label_set_align(voltage, LV_LABEL_ALIGN_CENTER);
lv_obj_align(voltage, nullptr, LV_ALIGN_CENTER, 0, 95);
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
@@ -73,7 +70,6 @@ BatteryInfo::BatteryInfo(
UpdateScreen();
}
-
BatteryInfo::~BatteryInfo() {
lv_task_del(taskUpdate);
lv_task_del(taskAnim);
@@ -83,9 +79,9 @@ BatteryInfo::~BatteryInfo() {
void BatteryInfo::UpdateAnim() {
batteryPercent = batteryController.PercentRemaining();
- if ( batteryPercent >= 0 ) {
- if ( batteryController.IsCharging() ) {
- animation +=1;
+ if (batteryPercent >= 0) {
+ if (batteryController.IsCharging() and batteryPercent < 100) {
+ animation += 1;
if (animation >= 100) {
animation = 0;
}
@@ -110,35 +106,39 @@ void BatteryInfo::UpdateScreen() {
batteryPercent = batteryController.PercentRemaining();
batteryVoltage = batteryController.Voltage();
- if ( batteryPercent >= 0 ) {
- if ( batteryController.IsCharging() ) {
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, lv_color_hex(0xFF0000));
- lv_label_set_text_static(status,"Battery charging");
-
+ if (batteryPercent >= 0) {
+ if (batteryController.IsCharging() and batteryPercent < 100) {
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED);
+ lv_label_set_text_static(status, "Battery charging");
+ } else if (batteryPercent == 100) {
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_BLUE);
+ lv_label_set_text_static(status, "Battery is fully charged");
+ } else if (batteryPercent < 10) {
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
+ lv_label_set_text_static(status, "Battery is low");
} else {
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
- lv_label_set_text_static(status,"Battery discharging");
+ lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_GREEN);
+ lv_label_set_text_static(status, "Battery discharging");
}
-
- lv_label_set_text_fmt(percent,"%02i%%", batteryPercent);
-
+
+ lv_label_set_text_fmt(percent, "%02i%%", batteryPercent);
+
} else {
- lv_label_set_text_static(status,"Reading Battery status");
- lv_label_set_text(percent,"--%");
+ lv_label_set_text_static(status, "Reading Battery status");
+ lv_label_set_text(percent, "--%");
}
lv_obj_align(status, charging_bar, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
// hack to not use the flot functions from printf
uint8_t batteryVoltageBytes[2];
- batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); //truncate whole numbers
- batteryVoltageBytes[0] = static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); //remove whole part of flt and shift 2 places over
+ batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); // truncate whole numbers
+ batteryVoltageBytes[0] =
+ static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); // remove whole part of flt and shift 2 places over
//
- lv_label_set_text_fmt(voltage,"%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]);
-
+ lv_label_set_text_fmt(voltage, "%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]);
}
bool BatteryInfo::Refresh() {
-
+
return running;
}
-
diff --git a/src/displayapp/screens/BatteryInfo.h b/src/displayapp/screens/BatteryInfo.h
index 206f1ab0..8805db58 100644
--- a/src/displayapp/screens/BatteryInfo.h
+++ b/src/displayapp/screens/BatteryInfo.h
@@ -6,7 +6,6 @@
#include "Screen.h"
#include <lvgl/lvgl.h>
-
namespace Pinetime {
namespace Controllers {
class Battery;
@@ -15,34 +14,30 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class BatteryInfo : public Screen{
- public:
- BatteryInfo(DisplayApp* app,
- Pinetime::Controllers::Battery& batteryController);
- ~BatteryInfo() override;
-
- bool Refresh() override;
-
-
- void UpdateScreen();
- void UpdateAnim();
+ class BatteryInfo : public Screen {
+ public:
+ BatteryInfo(DisplayApp* app, Pinetime::Controllers::Battery& batteryController);
+ ~BatteryInfo() override;
- private:
+ bool Refresh() override;
- Pinetime::Controllers::Battery& batteryController;
+ void UpdateScreen();
+ void UpdateAnim();
- lv_obj_t* voltage;
- lv_obj_t* percent;
- lv_obj_t* charging_bar;
- lv_obj_t* status;
+ private:
+ Pinetime::Controllers::Battery& batteryController;
- lv_task_t* taskUpdate;
- lv_task_t* taskAnim;
+ lv_obj_t* voltage;
+ lv_obj_t* percent;
+ lv_obj_t* charging_bar;
+ lv_obj_t* status;
- int8_t animation = 0;
- int8_t batteryPercent = -1;
- float batteryVoltage = 0.0f;
+ lv_task_t* taskUpdate;
+ lv_task_t* taskAnim;
+ int8_t animation = 0;
+ int8_t batteryPercent = -1;
+ float batteryVoltage = 0.0f;
};
}
}
diff --git a/src/displayapp/screens/BleIcon.cpp b/src/displayapp/screens/BleIcon.cpp
index 1bbbd053..da3d15e7 100644
--- a/src/displayapp/screens/BleIcon.cpp
+++ b/src/displayapp/screens/BleIcon.cpp
@@ -3,6 +3,8 @@
using namespace Pinetime::Applications::Screens;
const char* BleIcon::GetIcon(bool isConnected) {
- if(isConnected) return Symbols::bluetooth;
- else return "";
+ if (isConnected)
+ return Symbols::bluetooth;
+ else
+ return "";
} \ No newline at end of file
diff --git a/src/displayapp/screens/Brightness.cpp b/src/displayapp/screens/Brightness.cpp
index 38469cf5..47c10561 100644
--- a/src/displayapp/screens/Brightness.cpp
+++ b/src/displayapp/screens/Brightness.cpp
@@ -3,14 +3,15 @@
using namespace Pinetime::Applications::Screens;
-void slider_event_cb(lv_obj_t * slider, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
+void slider_event_cb(lv_obj_t* slider, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
auto* brightnessSlider = static_cast<Brightness*>(slider->user_data);
brightnessSlider->OnValueChanged();
}
}
-Brightness::Brightness(Pinetime::Applications::DisplayApp *app, Controllers::BrightnessController& brightness) : Screen(app), brightness{brightness} {
+Brightness::Brightness(Pinetime::Applications::DisplayApp* app, Controllers::BrightnessController& brightness)
+ : Screen(app), brightness {brightness} {
slider = lv_slider_create(lv_scr_act(), nullptr);
lv_obj_set_user_data(slider, this);
lv_obj_set_width(slider, LV_DPI * 2);
@@ -33,13 +34,18 @@ bool Brightness::Refresh() {
return running;
}
-const char *Brightness::LevelToString(Pinetime::Controllers::BrightnessController::Levels level) {
- switch(level) {
- case Pinetime::Controllers::BrightnessController::Levels::Off: return "Off";
- case Pinetime::Controllers::BrightnessController::Levels::Low: return "Low";
- case Pinetime::Controllers::BrightnessController::Levels::Medium: return "Medium";
- case Pinetime::Controllers::BrightnessController::Levels::High: return "High";
- default : return "???";
+const char* Brightness::LevelToString(Pinetime::Controllers::BrightnessController::Levels level) {
+ switch (level) {
+ case Pinetime::Controllers::BrightnessController::Levels::Off:
+ return "Off";
+ case Pinetime::Controllers::BrightnessController::Levels::Low:
+ return "Low";
+ case Pinetime::Controllers::BrightnessController::Levels::Medium:
+ return "Medium";
+ case Pinetime::Controllers::BrightnessController::Levels::High:
+ return "High";
+ default:
+ return "???";
}
}
@@ -48,29 +54,40 @@ void Brightness::OnValueChanged() {
}
void Brightness::SetValue(uint8_t value) {
- switch(value) {
- case 0: brightness.Set(Controllers::BrightnessController::Levels::Low); break;
- case 1: brightness.Set(Controllers::BrightnessController::Levels::Medium); break;
- case 2: brightness.Set(Controllers::BrightnessController::Levels::High); break;
+ switch (value) {
+ case 0:
+ brightness.Set(Controllers::BrightnessController::Levels::Low);
+ break;
+ case 1:
+ brightness.Set(Controllers::BrightnessController::Levels::Medium);
+ break;
+ case 2:
+ brightness.Set(Controllers::BrightnessController::Levels::High);
+ break;
}
lv_label_set_text(slider_label, LevelToString(brightness.Level()));
}
uint8_t Brightness::LevelToInt(Pinetime::Controllers::BrightnessController::Levels level) {
- switch(level) {
- case Pinetime::Controllers::BrightnessController::Levels::Off: return 0;
- case Pinetime::Controllers::BrightnessController::Levels::Low: return 0;
- case Pinetime::Controllers::BrightnessController::Levels::Medium: return 1;
- case Pinetime::Controllers::BrightnessController::Levels::High: return 2;
- default : return 0;
+ switch (level) {
+ case Pinetime::Controllers::BrightnessController::Levels::Off:
+ return 0;
+ case Pinetime::Controllers::BrightnessController::Levels::Low:
+ return 0;
+ case Pinetime::Controllers::BrightnessController::Levels::Medium:
+ return 1;
+ case Pinetime::Controllers::BrightnessController::Levels::High:
+ return 2;
+ default:
+ return 0;
}
}
bool Brightness::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- switch(event) {
+ switch (event) {
case TouchEvents::SwipeLeft:
brightness.Lower();
- if ( brightness.Level() == Pinetime::Controllers::BrightnessController::Levels::Off) {
+ if (brightness.Level() == Pinetime::Controllers::BrightnessController::Levels::Off) {
brightness.Set(Controllers::BrightnessController::Levels::Low);
}
SetValue();
diff --git a/src/displayapp/screens/Brightness.h b/src/displayapp/screens/Brightness.h
index 60b33cfd..9ee33753 100644
--- a/src/displayapp/screens/Brightness.h
+++ b/src/displayapp/screens/Brightness.h
@@ -9,25 +9,25 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class Brightness : public Screen {
- public:
- Brightness(DisplayApp* app, Controllers::BrightnessController& brightness);
- ~Brightness() override;
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
+ public:
+ Brightness(DisplayApp* app, Controllers::BrightnessController& brightness);
+ ~Brightness() override;
+ bool Refresh() override;
- void OnValueChanged();
- private:
-
- Controllers::BrightnessController& brightness;
+ bool OnTouchEvent(TouchEvents event) override;
- lv_obj_t * slider_label;
- lv_obj_t * slider;
+ void OnValueChanged();
- const char* LevelToString(Controllers::BrightnessController::Levels level);
- uint8_t LevelToInt(Controllers::BrightnessController::Levels level);
- void SetValue(uint8_t value);
- void SetValue();
+ private:
+ Controllers::BrightnessController& brightness;
+
+ lv_obj_t* slider_label;
+ lv_obj_t* slider;
+
+ const char* LevelToString(Controllers::BrightnessController::Levels level);
+ uint8_t LevelToInt(Controllers::BrightnessController::Levels level);
+ void SetValue(uint8_t value);
+ void SetValue();
};
}
}
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp
index c218aa5c..14299840 100644
--- a/src/displayapp/screens/Clock.cpp
+++ b/src/displayapp/screens/Clock.cpp
@@ -15,45 +15,48 @@
#include "WatchFaceDigital.h"
#include "WatchFaceAnalog.h"
-
using namespace Pinetime::Applications::Screens;
Clock::Clock(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController,
- Controllers::HeartRateController& heartRateController,
- Controllers::MotionController& motionController) : Screen(app),
- dateTimeController{dateTimeController}, batteryController{batteryController},
- bleController{bleController}, notificatioManager{notificatioManager},
- settingsController{settingsController},
- heartRateController{heartRateController},
- motionController{motionController},
- screens{app,
- settingsController.GetClockFace(),
- {
- [this]() -> std::unique_ptr<Screen> { return WatchFaceDigitalScreen(); },
- [this]() -> std::unique_ptr<Screen> { return WatchFaceAnalogScreen(); },
- // Examples for more watch faces
- //[this]() -> std::unique_ptr<Screen> { return WatchFaceMinimalScreen(); },
- //[this]() -> std::unique_ptr<Screen> { return WatchFaceCustomScreen(); }
- },
- Screens::ScreenListModes::LongPress
- } {
-
- settingsController.SetAppMenu(0);
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController,
+ Controllers::HeartRateController& heartRateController,
+ Controllers::MotionController& motionController)
+ : Screen(app),
+ dateTimeController {dateTimeController},
+ batteryController {batteryController},
+ bleController {bleController},
+ notificatioManager {notificatioManager},
+ settingsController {settingsController},
+ heartRateController {heartRateController},
+ motionController {motionController},
+ screens {app,
+ settingsController.GetClockFace(),
+ {
+ [this]() -> std::unique_ptr<Screen> {
+ return WatchFaceDigitalScreen();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return WatchFaceAnalogScreen();
+ },
+ // Examples for more watch faces
+ //[this]() -> std::unique_ptr<Screen> { return WatchFaceMinimalScreen(); },
+ //[this]() -> std::unique_ptr<Screen> { return WatchFaceCustomScreen(); }
+ },
+ Screens::ScreenListModes::LongPress} {
- }
+ settingsController.SetAppMenu(0);
+}
Clock::~Clock() {
lv_obj_clean(lv_scr_act());
}
-
-bool Clock::Refresh() {
- screens.Refresh();
+bool Clock::Refresh() {
+ screens.Refresh();
return running;
}
@@ -61,21 +64,31 @@ bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return screens.OnTouchEvent(event);
}
-std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
- return std::make_unique<Screens::WatchFaceDigital>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController, motionController);
+std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
+ return std::make_unique<Screens::WatchFaceDigital>(app,
+ dateTimeController,
+ batteryController,
+ bleController,
+ notificatioManager,
+ settingsController,
+ heartRateController,
+ motionController);
}
-std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
- return std::make_unique<Screens::WatchFaceAnalog>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
+std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
+ return std::make_unique<Screens::WatchFaceAnalog>(
+ app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
}
/*
// Examples for more watch faces
-std::unique_ptr<Screen> Clock::WatchFaceMinimalScreen() {
- return std::make_unique<Screens::WatchFaceMinimal>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
+std::unique_ptr<Screen> Clock::WatchFaceMinimalScreen() {
+ return std::make_unique<Screens::WatchFaceMinimal>(app, dateTimeController, batteryController, bleController, notificatioManager,
+settingsController);
}
-std::unique_ptr<Screen> Clock::WatchFaceCustomScreen() {
- return std::make_unique<Screens::WatchFaceCustom>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
+std::unique_ptr<Screen> Clock::WatchFaceCustomScreen() {
+ return std::make_unique<Screens::WatchFaceCustom>(app, dateTimeController, batteryController, bleController, notificatioManager,
+settingsController);
}
*/ \ No newline at end of file
diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h
index 1a4e0ebd..9879985f 100644
--- a/src/displayapp/screens/Clock.h
+++ b/src/displayapp/screens/Clock.h
@@ -23,42 +23,37 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class Clock : public Screen {
- public:
- Clock(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController,
- Controllers::HeartRateController& heartRateController,
- Controllers::MotionController& motionController);
- ~Clock() override;
-
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
-
- private:
-
- Controllers::DateTime& dateTimeController;
- Controllers::Battery& batteryController;
- Controllers::Ble& bleController;
- Controllers::NotificationManager& notificatioManager;
- Controllers::Settings& settingsController;
- Controllers::HeartRateController& heartRateController;
- Controllers::MotionController& motionController;
-
-
- ScreenList<2> screens;
- std::unique_ptr<Screen> WatchFaceDigitalScreen();
- std::unique_ptr<Screen> WatchFaceAnalogScreen();
-
- // Examples for more watch faces
- //std::unique_ptr<Screen> WatchFaceMinimalScreen();
- //std::unique_ptr<Screen> WatchFaceCustomScreen();
-
-
-
+ public:
+ Clock(DisplayApp* app,
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController,
+ Controllers::HeartRateController& heartRateController,
+ Controllers::MotionController& motionController);
+ ~Clock() override;
+
+ bool Refresh() override;
+
+ bool OnTouchEvent(TouchEvents event) override;
+
+ private:
+ Controllers::DateTime& dateTimeController;
+ Controllers::Battery& batteryController;
+ Controllers::Ble& bleController;
+ Controllers::NotificationManager& notificatioManager;
+ Controllers::Settings& settingsController;
+ Controllers::HeartRateController& heartRateController;
+ Controllers::MotionController& motionController;
+
+ ScreenList<2> screens;
+ std::unique_ptr<Screen> WatchFaceDigitalScreen();
+ std::unique_ptr<Screen> WatchFaceAnalogScreen();
+
+ // Examples for more watch faces
+ // std::unique_ptr<Screen> WatchFaceMinimalScreen();
+ // std::unique_ptr<Screen> WatchFaceCustomScreen();
};
}
}
diff --git a/src/displayapp/screens/DropDownDemo.cpp b/src/displayapp/screens/DropDownDemo.cpp
index c3ec5d7d..9043c20d 100644
--- a/src/displayapp/screens/DropDownDemo.cpp
+++ b/src/displayapp/screens/DropDownDemo.cpp
@@ -5,20 +5,21 @@
using namespace Pinetime::Applications::Screens;
-DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp *app) : Screen(app) {
+DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp* app) : Screen(app) {
// Create the dropdown object, with many item, and fix its height
ddlist = lv_ddlist_create(lv_scr_act(), nullptr);
- lv_ddlist_set_options(ddlist, "Apple\n"
- "Banana\n"
- "Orange\n"
- "Melon\n"
- "Grape\n"
- "Raspberry\n"
- "A\n"
- "B\n"
- "C\n"
- "D\n"
- "E");
+ lv_ddlist_set_options(ddlist,
+ "Apple\n"
+ "Banana\n"
+ "Orange\n"
+ "Melon\n"
+ "Grape\n"
+ "Raspberry\n"
+ "A\n"
+ "B\n"
+ "C\n"
+ "D\n"
+ "E");
lv_ddlist_set_fix_width(ddlist, 150);
lv_ddlist_set_draw_arrow(ddlist, true);
lv_ddlist_set_fix_height(ddlist, 150);
@@ -32,12 +33,12 @@ DropDownDemo::~DropDownDemo() {
}
bool DropDownDemo::Refresh() {
- auto* list = static_cast<lv_ddlist_ext_t *>(ddlist->ext_attr);
+ auto* list = static_cast<lv_ddlist_ext_t*>(ddlist->ext_attr);
// Switch touchmode to Polling if the dropdown is opened. This will allow to scroll inside the
// dropdown while it is opened.
// Disable the polling mode when the dropdown is closed to be able to handle the gestures.
- if(list->opened)
+ if (list->opened)
app->SetTouchMode(DisplayApp::TouchModes::Polling);
else
app->SetTouchMode(DisplayApp::TouchModes::Gestures);
@@ -47,11 +48,10 @@ bool DropDownDemo::Refresh() {
bool DropDownDemo::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
// If the dropdown is opened, notify Display app that it doesn't need to handle the event
// (this will prevent displayApp from going back to the menu or clock scree).
- auto* list = static_cast<lv_ddlist_ext_t *>(ddlist->ext_attr);
- if(list->opened) {
+ auto* list = static_cast<lv_ddlist_ext_t*>(ddlist->ext_attr);
+ if (list->opened) {
return true;
} else {
return false;
}
}
-
diff --git a/src/displayapp/screens/DropDownDemo.h b/src/displayapp/screens/DropDownDemo.h
index 821ae528..ff388c57 100644
--- a/src/displayapp/screens/DropDownDemo.h
+++ b/src/displayapp/screens/DropDownDemo.h
@@ -9,18 +9,18 @@ namespace Pinetime {
namespace Screens {
class DropDownDemo : public Screen {
- public:
- DropDownDemo(DisplayApp* app);
- ~DropDownDemo() override;
+ public:
+ DropDownDemo(DisplayApp* app);
+ ~DropDownDemo() override;
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
+ bool Refresh() override;
- private:
- lv_obj_t * ddlist;
-
- bool isDropDownOpened = false;
+ bool OnTouchEvent(TouchEvents event) override;
+
+ private:
+ lv_obj_t* ddlist;
+
+ bool isDropDownOpened = false;
};
}
}
diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp
index e894850e..4086b152 100644
--- a/src/displayapp/screens/FirmwareUpdate.cpp
+++ b/src/displayapp/screens/FirmwareUpdate.cpp
@@ -5,9 +5,14 @@
using namespace Pinetime::Applications::Screens;
+FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Ble& bleController)
+ : Screen(app), bleController {bleController} {
-FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Ble& bleController) :
- Screen(app), bleController{bleController} {
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
+ lv_obj_set_size(backgroundLabel, 240, 240);
+ lv_obj_set_pos(backgroundLabel, 0, 0);
+ lv_label_set_text_static(backgroundLabel, "");
titleLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(titleLabel, "Firmware update");
@@ -32,21 +37,21 @@ FirmwareUpdate::~FirmwareUpdate() {
}
bool FirmwareUpdate::Refresh() {
- switch(bleController.State()) {
+ switch (bleController.State()) {
default:
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Idle:
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Running:
- if(state != States::Running)
+ if (state != States::Running)
state = States::Running;
return DisplayProgression();
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated:
- if(state != States::Validated) {
+ if (state != States::Validated) {
UpdateValidated();
state = States::Validated;
}
return running;
case Pinetime::Controllers::Ble::FirmwareUpdateStates::Error:
- if(state != States::Error) {
+ if (state != States::Error) {
UpdateError();
state = States::Error;
}
diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h
index 27be3631..f4d34df0 100644
--- a/src/displayapp/screens/FirmwareUpdate.h
+++ b/src/displayapp/screens/FirmwareUpdate.h
@@ -10,29 +10,28 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class FirmwareUpdate : public Screen{
- public:
- FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController);
- ~FirmwareUpdate() override;
+ class FirmwareUpdate : public Screen {
+ public:
+ FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController);
+ ~FirmwareUpdate() override;
- bool Refresh() override;
-
+ bool Refresh() override;
- private:
- enum class States { Idle, Running, Validated, Error };
- Pinetime::Controllers::Ble& bleController;
- lv_obj_t* bar1;
- lv_obj_t* percentLabel;
- lv_obj_t* titleLabel;
- mutable char percentStr[10];
-
- States state;
+ private:
+ enum class States { Idle, Running, Validated, Error };
+ Pinetime::Controllers::Ble& bleController;
+ lv_obj_t* bar1;
+ lv_obj_t* percentLabel;
+ lv_obj_t* titleLabel;
+ mutable char percentStr[10];
- bool DisplayProgression() const;
+ States state;
- void UpdateValidated();
+ bool DisplayProgression() const;
- void UpdateError();
+ void UpdateValidated();
+
+ void UpdateError();
};
}
}
diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp
index f78b1a67..873a22f5 100644
--- a/src/displayapp/screens/FirmwareValidation.cpp
+++ b/src/displayapp/screens/FirmwareValidation.cpp
@@ -7,23 +7,20 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event)
- {
- FirmwareValidation* screen = static_cast<FirmwareValidation *>(obj->user_data);
+ static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) {
+ FirmwareValidation* screen = static_cast<FirmwareValidation*>(obj->user_data);
screen->OnButtonEvent(obj, event);
}
}
-FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::FirmwareValidator &validator)
- : Screen{app}, validator{validator} {
+FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator)
+ : Screen {app}, validator {validator} {
labelVersionInfo = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(labelVersionInfo, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_label_set_text(labelVersionInfo, "Version : ");
lv_label_set_align(labelVersionInfo, LV_LABEL_ALIGN_LEFT);
-
labelVersionValue = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(labelVersionValue, labelVersionInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
lv_label_set_recolor(labelVersionValue, true);
@@ -36,11 +33,10 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app,
lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK);
lv_obj_set_width(labelIsValidated, 240);
- if(validator.IsValidated())
+ if (validator.IsValidated())
lv_label_set_text(labelIsValidated, "You have already\n#00ff00 validated# this firmware#");
else {
- lv_label_set_text(labelIsValidated,
- "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
+ lv_label_set_text(labelIsValidated, "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
buttonValidate = lv_btn_create(lv_scr_act(), nullptr);
lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
@@ -49,20 +45,19 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app,
lv_obj_set_style_local_bg_color(buttonValidate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x009900));
labelButtonValidate = lv_label_create(buttonValidate, nullptr);
- lv_label_set_text_static(labelButtonValidate, "Validate");
+ lv_label_set_text_static(labelButtonValidate, "Validate");
buttonReset = lv_btn_create(lv_scr_act(), nullptr);
buttonReset->user_data = this;
lv_obj_align(buttonReset, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
lv_obj_set_style_local_bg_color(buttonReset, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x990000));
lv_obj_set_event_cb(buttonReset, ButtonEventHandler);
-
+
labelButtonReset = lv_label_create(buttonReset, nullptr);
- lv_label_set_text_static(labelButtonReset, "Reset");
- }
+ lv_label_set_text_static(labelButtonReset, "Reset");
+ }
}
-
FirmwareValidation::~FirmwareValidation() {
lv_obj_clean(lv_scr_act());
}
@@ -71,12 +66,11 @@ bool FirmwareValidation::Refresh() {
return running;
}
-void FirmwareValidation::OnButtonEvent(lv_obj_t *object, lv_event_t event) {
- if(object == buttonValidate && event == LV_EVENT_PRESSED) {
+void FirmwareValidation::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
+ if (object == buttonValidate && event == LV_EVENT_PRESSED) {
validator.Validate();
- running = false;
- } else if(object == buttonReset && event == LV_EVENT_PRESSED) {
+ running = false;
+ } else if (object == buttonReset && event == LV_EVENT_PRESSED) {
validator.Reset();
}
-
}
diff --git a/src/displayapp/screens/FirmwareValidation.h b/src/displayapp/screens/FirmwareValidation.h
index b83f8238..67662fd9 100644
--- a/src/displayapp/screens/FirmwareValidation.h
+++ b/src/displayapp/screens/FirmwareValidation.h
@@ -11,28 +11,26 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class FirmwareValidation : public Screen{
- public:
- FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator);
- ~FirmwareValidation() override;
-
- bool Refresh() override;
-
-
- void OnButtonEvent(lv_obj_t *object, lv_event_t event);
-
- private:
- Pinetime::Controllers::FirmwareValidator& validator;
-
- lv_obj_t* labelVersionInfo;
- lv_obj_t* labelVersionValue;
- char version[9];
- lv_obj_t* labelIsValidated;
- lv_obj_t* buttonValidate;
- lv_obj_t* labelButtonValidate;
- lv_obj_t* buttonReset;
- lv_obj_t* labelButtonReset;
-
+ class FirmwareValidation : public Screen {
+ public:
+ FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator);
+ ~FirmwareValidation() override;
+
+ bool Refresh() override;
+
+ void OnButtonEvent(lv_obj_t* object, lv_event_t event);
+
+ private:
+ Pinetime::Controllers::FirmwareValidator& validator;
+
+ lv_obj_t* labelVersionInfo;
+ lv_obj_t* labelVersionValue;
+ char version[9];
+ lv_obj_t* labelIsValidated;
+ lv_obj_t* buttonValidate;
+ lv_obj_t* labelButtonValidate;
+ lv_obj_t* buttonReset;
+ lv_obj_t* labelButtonReset;
};
}
}
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index 0ef1b333..4568db40 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -5,46 +5,43 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- FlashLight* screen = static_cast<FlashLight *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ FlashLight* screen = static_cast<FlashLight*>(obj->user_data);
screen->OnClickEvent(obj, event);
}
}
-FlashLight::FlashLight(
- Pinetime::Applications::DisplayApp *app,
- System::SystemTask &systemTask,
- Controllers::BrightnessController& brightness) :
- Screen(app),
- systemTask{systemTask},
- brightness{brightness}
-
+FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app,
+ System::SystemTask& systemTask,
+ Controllers::BrightnessController& brightness)
+ : Screen(app),
+ systemTask {systemTask},
+ brightness {brightness}
+
{
brightness.Backup();
brightness.Set(Controllers::BrightnessController::Levels::High);
// Set the background
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
-
- flashLight = lv_label_create(lv_scr_act(), NULL);
+
+ flashLight = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
lv_obj_set_style_local_text_font(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
lv_label_set_text_static(flashLight, Symbols::highlight);
lv_obj_align(flashLight, NULL, LV_ALIGN_CENTER, 0, 0);
- backgroundAction = lv_label_create(lv_scr_act(), nullptr);
+ backgroundAction = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundAction, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundAction, 240, 240);
lv_obj_set_pos(backgroundAction, 0, 0);
lv_label_set_text(backgroundAction, "");
lv_obj_set_click(backgroundAction, true);
- backgroundAction->user_data = this;
+ backgroundAction->user_data = this;
lv_obj_set_event_cb(backgroundAction, event_handler);
-
- systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
+ systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
}
-
FlashLight::~FlashLight() {
lv_obj_clean(lv_scr_act());
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
@@ -52,19 +49,18 @@ FlashLight::~FlashLight() {
systemTask.PushMessage(Pinetime::System::SystemTask::Messages::EnableSleeping);
}
-void FlashLight::OnClickEvent(lv_obj_t *obj, lv_event_t event) {
- if(obj == backgroundAction) {
+void FlashLight::OnClickEvent(lv_obj_t* obj, lv_event_t event) {
+ if (obj == backgroundAction) {
if (event == LV_EVENT_CLICKED) {
isOn = !isOn;
- if ( isOn ) {
+ if (isOn) {
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
} else {
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF));
}
-
}
}
}
@@ -76,4 +72,3 @@ bool FlashLight::Refresh() {
bool FlashLight::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return true;
}
-
diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h
index c62472ab..a862ffdb 100644
--- a/src/displayapp/screens/FlashLight.h
+++ b/src/displayapp/screens/FlashLight.h
@@ -6,30 +6,28 @@
#include "systemtask/SystemTask.h"
#include "components/brightness/BrightnessController.h"
-
namespace Pinetime {
-
+
namespace Applications {
namespace Screens {
- class FlashLight : public Screen{
- public:
- FlashLight(DisplayApp* app, System::SystemTask &systemTask, Controllers::BrightnessController& brightness);
- ~FlashLight() override;
+ class FlashLight : public Screen {
+ public:
+ FlashLight(DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightness);
+ ~FlashLight() override;
- bool Refresh() override;
-
- bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
- void OnClickEvent(lv_obj_t *obj, lv_event_t event);
+ bool Refresh() override;
- private:
- Pinetime::System::SystemTask& systemTask;
- Controllers::BrightnessController& brightness;
+ bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
+ void OnClickEvent(lv_obj_t* obj, lv_event_t event);
- lv_obj_t* flashLight;
- lv_obj_t* backgroundAction;
- bool isOn = true;
+ private:
+ Pinetime::System::SystemTask& systemTask;
+ Controllers::BrightnessController& brightness;
+ lv_obj_t* flashLight;
+ lv_obj_t* backgroundAction;
+ bool isOn = true;
};
}
}
diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp
index 0bc3c352..90f6bc26 100644
--- a/src/displayapp/screens/HeartRate.cpp
+++ b/src/displayapp/screens/HeartRate.cpp
@@ -7,7 +7,7 @@
using namespace Pinetime::Applications::Screens;
namespace {
- const char *ToString(Pinetime::Controllers::HeartRateController::States s) {
+ const char* ToString(Pinetime::Controllers::HeartRateController::States s) {
switch (s) {
case Pinetime::Controllers::HeartRateController::States::NotEnoughData:
return "Not enough data,\nplease wait...";
@@ -21,31 +21,37 @@ namespace {
return "";
}
- static void btnStartStopEventHandler(lv_obj_t *obj, lv_event_t event) {
- HeartRate *screen = static_cast<HeartRate *>(obj->user_data);
+ static void btnStartStopEventHandler(lv_obj_t* obj, lv_event_t event) {
+ HeartRate* screen = static_cast<HeartRate*>(obj->user_data);
screen->OnStartStopEvent(event);
}
}
-HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::HeartRateController& heartRateController, System::SystemTask &systemTask) :
- Screen(app), heartRateController{heartRateController}, systemTask{systemTask} {
-
+HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app,
+ Controllers::HeartRateController& heartRateController,
+ System::SystemTask& systemTask)
+ : Screen(app), heartRateController {heartRateController}, systemTask {systemTask} {
+ bool isHrRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
label_hr = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
- lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
+
+ if (isHrRunning)
+ lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
+ else
+ lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
+
lv_label_set_text(label_hr, "000");
- lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40);
+ lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40);
label_bpm = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(label_bpm, "Heart rate BPM");
+ lv_label_set_text(label_bpm, "Heart rate BPM");
lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20);
-
label_status = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
lv_label_set_text(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData));
-
+
lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
btn_startStop = lv_btn_create(lv_scr_act(), nullptr);
@@ -55,7 +61,9 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::Heart
lv_obj_align(btn_startStop, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
label_startStop = lv_label_create(btn_startStop, nullptr);
- UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
+ UpdateStartStopButton(isHrRunning);
+ if (isHrRunning)
+ systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
}
HeartRate::~HeartRate() {
@@ -66,10 +74,10 @@ HeartRate::~HeartRate() {
bool HeartRate::Refresh() {
auto state = heartRateController.State();
- switch(state) {
+ switch (state) {
case Controllers::HeartRateController::States::NoTouch:
case Controllers::HeartRateController::States::NotEnoughData:
- //case Controllers::HeartRateController::States::Stopped:
+ // case Controllers::HeartRateController::States::Stopped:
lv_label_set_text(label_hr, "000");
break;
default:
@@ -84,13 +92,12 @@ bool HeartRate::Refresh() {
void HeartRate::OnStartStopEvent(lv_event_t event) {
if (event == LV_EVENT_CLICKED) {
- if(heartRateController.State() == Controllers::HeartRateController::States::Stopped) {
+ if (heartRateController.State() == Controllers::HeartRateController::States::Stopped) {
heartRateController.Start();
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
- }
- else {
+ } else {
heartRateController.Stop();
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
systemTask.PushMessage(Pinetime::System::SystemTask::Messages::EnableSleeping);
@@ -100,7 +107,7 @@ void HeartRate::OnStartStopEvent(lv_event_t event) {
}
void HeartRate::UpdateStartStopButton(bool isRunning) {
- if(isRunning)
+ if (isRunning)
lv_label_set_text(label_startStop, "Stop");
else
lv_label_set_text(label_startStop, "Start");
diff --git a/src/displayapp/screens/HeartRate.h b/src/displayapp/screens/HeartRate.h
index c8f36999..a23c5af8 100644
--- a/src/displayapp/screens/HeartRate.h
+++ b/src/displayapp/screens/HeartRate.h
@@ -15,13 +15,13 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class HeartRate : public Screen{
+ class HeartRate : public Screen {
public:
- HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController, System::SystemTask &systemTask);
+ HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController, System::SystemTask& systemTask);
~HeartRate() override;
bool Refresh() override;
-
+
void OnStartStopEvent(lv_event_t event);
private:
@@ -33,9 +33,6 @@ namespace Pinetime {
lv_obj_t* label_status;
lv_obj_t* btn_startStop;
lv_obj_t* label_startStop;
-
-
-
};
}
}
diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp
index b6a7e3e4..32240084 100644
--- a/src/displayapp/screens/InfiniPaint.cpp
+++ b/src/displayapp/screens/InfiniPaint.cpp
@@ -4,7 +4,7 @@
using namespace Pinetime::Applications::Screens;
-InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} {
+InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} {
app->SetTouchMode(DisplayApp::TouchModes::Polling);
std::fill(b, b + bufferSize, selectColor);
}
@@ -20,8 +20,8 @@ bool InfiniPaint::Refresh() {
}
bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- switch(event) {
- case Pinetime::Applications::TouchEvents::LongTap:
+ switch (event) {
+ case Pinetime::Applications::TouchEvents::LongTap:
switch (color) {
case 0:
selectColor = LV_COLOR_MAGENTA;
@@ -47,13 +47,13 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
case 7:
selectColor = LV_COLOR_BLACK;
break;
-
+
default:
color = 0;
break;
}
- std::fill(b, b + bufferSize, selectColor);
+ std::fill(b, b + bufferSize, selectColor);
color++;
return true;
default:
@@ -72,4 +72,3 @@ bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) {
lvgl.FlushDisplay(&area, b);
return true;
}
-
diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h
index da9c39ba..6251752a 100644
--- a/src/displayapp/screens/InfiniPaint.h
+++ b/src/displayapp/screens/InfiniPaint.h
@@ -31,7 +31,6 @@ namespace Pinetime {
lv_color_t b[bufferSize];
lv_color_t selectColor = LV_COLOR_WHITE;
uint8_t color = 2;
-
};
}
}
diff --git a/src/displayapp/screens/Label.cpp b/src/displayapp/screens/Label.cpp
index cc268775..0132dbd2 100644
--- a/src/displayapp/screens/Label.cpp
+++ b/src/displayapp/screens/Label.cpp
@@ -2,24 +2,21 @@
using namespace Pinetime::Applications::Screens;
-Label::Label(uint8_t screenID, uint8_t numScreens,
- Pinetime::Applications::DisplayApp *app, lv_obj_t* labelText) :
- Screen(app),
- labelText{labelText} {
-
- if ( numScreens > 1 ) {
+Label::Label(uint8_t screenID, uint8_t numScreens, Pinetime::Applications::DisplayApp* app, lv_obj_t* labelText)
+ : Screen(app), labelText {labelText} {
+
+ if (numScreens > 1) {
pageIndicatorBasePoints[0].x = 240 - 1;
pageIndicatorBasePoints[0].y = 6;
pageIndicatorBasePoints[1].x = 240 - 1;
pageIndicatorBasePoints[1].y = 240 - 6;
-
+
pageIndicatorBase = lv_line_create(lv_scr_act(), NULL);
lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2);
-
uint16_t indicatorSize = 228 / numScreens;
uint16_t indicatorPos = indicatorSize * screenID;
@@ -34,7 +31,6 @@ Label::Label(uint8_t screenID, uint8_t numScreens,
lv_obj_set_style_local_line_rounded(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicator, pageIndicatorPoints, 2);
}
-
}
Label::~Label() {
diff --git a/src/displayapp/screens/Label.h b/src/displayapp/screens/Label.h
index a1bcba95..62b80bec 100644
--- a/src/displayapp/screens/Label.h
+++ b/src/displayapp/screens/Label.h
@@ -8,23 +8,20 @@ namespace Pinetime {
namespace Screens {
class Label : public Screen {
- public:
- Label( uint8_t screenID, uint8_t numScreens,
- DisplayApp* app, lv_obj_t* labelText );
- ~Label() override;
-
- bool Refresh() override;
-
+ public:
+ Label(uint8_t screenID, uint8_t numScreens, DisplayApp* app, lv_obj_t* labelText);
+ ~Label() override;
- private:
+ bool Refresh() override;
- bool running = true;
-
- lv_obj_t * labelText = nullptr;
- lv_point_t pageIndicatorBasePoints[2];
- lv_point_t pageIndicatorPoints[2];
- lv_obj_t* pageIndicatorBase;
- lv_obj_t* pageIndicator;
+ private:
+ bool running = true;
+
+ lv_obj_t* labelText = nullptr;
+ lv_point_t pageIndicatorBasePoints[2];
+ lv_point_t pageIndicatorPoints[2];
+ lv_obj_t* pageIndicatorBase;
+ lv_obj_t* pageIndicator;
};
}
}
diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp
index 87cfa6db..b4f4d2cf 100644
--- a/src/displayapp/screens/List.cpp
+++ b/src/displayapp/screens/List.cpp
@@ -5,39 +5,37 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event) {
- List* screen = static_cast<List *>(obj->user_data);
+ static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) {
+ List* screen = static_cast<List*>(obj->user_data);
screen->OnButtonEvent(obj, event);
}
}
-List::List(uint8_t screenID, uint8_t numScreens,
- DisplayApp* app,
- Controllers::Settings &settingsController,
- std::array<Applications, MAXLISTITEMS>& applications) :
- Screen(app),
- settingsController{settingsController}
-{
+List::List(uint8_t screenID,
+ uint8_t numScreens,
+ DisplayApp* app,
+ Controllers::Settings& settingsController,
+ std::array<Applications, MAXLISTITEMS>& applications)
+ : Screen(app), settingsController {settingsController} {
// Set the background to Black
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0, 0, 0));
settingsController.SetSettingsMenu(screenID);
- if ( numScreens > 1 ) {
+ if (numScreens > 1) {
pageIndicatorBasePoints[0].x = 240 - 1;
pageIndicatorBasePoints[0].y = 6;
pageIndicatorBasePoints[1].x = 240 - 1;
pageIndicatorBasePoints[1].y = 240 - 6;
-
+
pageIndicatorBase = lv_line_create(lv_scr_act(), NULL);
lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2);
-
uint16_t indicatorSize = 228 / numScreens;
uint16_t indicatorPos = indicatorSize * screenID;
@@ -53,10 +51,9 @@ List::List(uint8_t screenID, uint8_t numScreens,
lv_line_set_points(pageIndicator, pageIndicatorPoints, 2);
}
-
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
+ // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
@@ -67,12 +64,12 @@ List::List(uint8_t screenID, uint8_t numScreens,
lv_obj_set_height(container1, LV_VER_RES);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * labelBt;
- lv_obj_t * labelBtIco;
+ lv_obj_t* labelBt;
+ lv_obj_t* labelBtIco;
- for(int i = 0; i < MAXLISTITEMS; i++) {
+ for (int i = 0; i < MAXLISTITEMS; i++) {
apps[i] = applications[i].application;
- if ( applications[i].application != Apps::None) {
+ if (applications[i].application != Apps::None) {
itemApps[i] = lv_btn_create(container1, nullptr);
lv_obj_set_style_local_bg_opa(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
@@ -91,19 +88,17 @@ List::List(uint8_t screenID, uint8_t numScreens,
labelBt = lv_label_create(itemApps[i], nullptr);
lv_label_set_text_fmt(labelBt, " %s", applications[i].name);
-
}
}
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, LV_HOR_RES, LV_VER_RES);
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text_static(backgroundLabel, "");
-
}
-List::~List() {
+List::~List() {
lv_obj_clean(lv_scr_act());
}
@@ -112,15 +107,14 @@ bool List::Refresh() {
return running;
}
-void List::OnButtonEvent(lv_obj_t * object, lv_event_t event) {
- if ( event == LV_EVENT_RELEASED ) {
- for(int i = 0; i < MAXLISTITEMS; i++) {
- if ( apps[i] != Apps::None && object == itemApps[i] ) {
- app->StartApp(apps[i], DisplayApp::FullRefreshDirections::Down);
+void List::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_RELEASED) {
+ for (int i = 0; i < MAXLISTITEMS; i++) {
+ if (apps[i] != Apps::None && object == itemApps[i]) {
+ app->StartApp(apps[i], DisplayApp::FullRefreshDirections::Up);
running = false;
return;
}
}
}
}
-
diff --git a/src/displayapp/screens/List.h b/src/displayapp/screens/List.h
index 739a91c3..a45fd1d3 100644
--- a/src/displayapp/screens/List.h
+++ b/src/displayapp/screens/List.h
@@ -13,36 +13,34 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class List : public Screen {
- public:
- struct Applications {
- const char* icon;
- const char* name;
- Pinetime::Applications::Apps application;
- };
-
- explicit List(uint8_t screenID, uint8_t numScreens,
- DisplayApp* app,
- Controllers::Settings& settingsController,
- std::array<Applications, MAXLISTITEMS>& applications);
- ~List() override;
-
- bool Refresh() override;
-
-
- void OnButtonEvent(lv_obj_t *object, lv_event_t event);
-
- private:
-
- Controllers::Settings& settingsController;
- Pinetime::Applications::Apps apps[MAXLISTITEMS];
-
- lv_obj_t * itemApps[MAXLISTITEMS];
-
- lv_point_t pageIndicatorBasePoints[2];
- lv_point_t pageIndicatorPoints[2];
- lv_obj_t* pageIndicatorBase;
- lv_obj_t* pageIndicator;
-
+ public:
+ struct Applications {
+ const char* icon;
+ const char* name;
+ Pinetime::Applications::Apps application;
+ };
+
+ explicit List(uint8_t screenID,
+ uint8_t numScreens,
+ DisplayApp* app,
+ Controllers::Settings& settingsController,
+ std::array<Applications, MAXLISTITEMS>& applications);
+ ~List() override;
+
+ bool Refresh() override;
+
+ void OnButtonEvent(lv_obj_t* object, lv_event_t event);
+
+ private:
+ Controllers::Settings& settingsController;
+ Pinetime::Applications::Apps apps[MAXLISTITEMS];
+
+ lv_obj_t* itemApps[MAXLISTITEMS];
+
+ lv_point_t pageIndicatorBasePoints[2];
+ lv_point_t pageIndicatorPoints[2];
+ lv_obj_t* pageIndicatorBase;
+ lv_obj_t* pageIndicator;
};
}
}
diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp
index 2c042cac..e0dbdfad 100644
--- a/src/displayapp/screens/Meter.cpp
+++ b/src/displayapp/screens/Meter.cpp
@@ -4,35 +4,33 @@
using namespace Pinetime::Applications::Screens;
-
-Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) {
+Meter::Meter(Pinetime::Applications::DisplayApp* app) : Screen(app) {
/*Create a line meter */
lmeter = lv_linemeter_create(lv_scr_act(), nullptr);
- lv_linemeter_set_range(lmeter, 0, 60); /*Set the range*/
- lv_linemeter_set_value(lmeter, value); /*Set the current value*/
+ lv_linemeter_set_range(lmeter, 0, 60); /*Set the range*/
+ lv_linemeter_set_value(lmeter, value); /*Set the current value*/
lv_linemeter_set_angle_offset(lmeter, 180);
- lv_linemeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/
+ lv_linemeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/
- lv_obj_set_style_local_scale_end_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(255,0,0));
- lv_obj_set_style_local_scale_grad_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(160,0,0));
+ lv_obj_set_style_local_scale_end_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(255, 0, 0));
+ lv_obj_set_style_local_scale_grad_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(160, 0, 0));
lv_obj_set_style_local_line_width(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2);
lv_obj_set_style_local_line_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_SILVER);
lv_obj_set_size(lmeter, 200, 200);
lv_obj_align(lmeter, nullptr, LV_ALIGN_CENTER, 0, 0);
-
}
Meter::~Meter() {
-
lv_obj_clean(lv_scr_act());
}
bool Meter::Refresh() {
- lv_linemeter_set_value(lmeter, value++); /*Set the current value*/
- if(value>=60) value = 0;
+ lv_linemeter_set_value(lmeter, value++); /*Set the current value*/
+ if (value >= 60)
+ value = 0;
return running;
}
diff --git a/src/displayapp/screens/Meter.h b/src/displayapp/screens/Meter.h
index 6a1fc3bf..24af15ad 100644
--- a/src/displayapp/screens/Meter.h
+++ b/src/displayapp/screens/Meter.h
@@ -9,20 +9,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class Meter : public Screen{
- public:
- Meter(DisplayApp* app);
- ~Meter() override;
+ class Meter : public Screen {
+ public:
+ Meter(DisplayApp* app);
+ ~Meter() override;
- bool Refresh() override;
+ bool Refresh() override;
- private:
- lv_style_t style_lmeter;
- lv_obj_t * lmeter;
-
- uint32_t value=0;
-
+ private:
+ lv_style_t style_lmeter;
+ lv_obj_t* lmeter;
+ uint32_t value = 0;
};
}
}
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp
index ed4b8198..e7196267 100644
--- a/src/displayapp/screens/Motion.cpp
+++ b/src/displayapp/screens/Motion.cpp
@@ -6,14 +6,14 @@ using namespace Pinetime::Applications::Screens;
extern lv_font_t jetbrains_mono_extrabold_compressed;
extern lv_font_t jetbrains_mono_bold_20;
-
-Motion::Motion(Pinetime::Applications::DisplayApp *app, Controllers::MotionController& motionController) : Screen(app), motionController{motionController} {
+Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionController& motionController)
+ : Screen(app), motionController {motionController} {
chart = lv_chart_create(lv_scr_act(), NULL);
lv_obj_set_size(chart, 240, 240);
lv_obj_align(chart, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
- lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
- //lv_chart_set_series_opa(chart, LV_OPA_70); /*Opacity of the data series*/
- //lv_chart_set_series_width(chart, 4); /*Line width and point radious*/
+ lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
+ // lv_chart_set_series_opa(chart, LV_OPA_70); /*Opacity of the data series*/
+ // lv_chart_set_series_width(chart, 4); /*Line width and point radious*/
lv_chart_set_range(chart, -1100, 1100);
lv_chart_set_update_mode(chart, LV_CHART_UPDATE_MODE_SHIFT);
diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h
index ad1341a8..11007866 100644
--- a/src/displayapp/screens/Motion.h
+++ b/src/displayapp/screens/Motion.h
@@ -12,7 +12,7 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class Motion : public Screen{
+ class Motion : public Screen {
public:
Motion(DisplayApp* app, Controllers::MotionController& motionController);
~Motion() override;
@@ -22,17 +22,16 @@ namespace Pinetime {
private:
Controllers::MotionController& motionController;
- lv_obj_t * chart;
- lv_chart_series_t * ser1;
- lv_chart_series_t * ser2;
- lv_chart_series_t * ser3;
+ lv_obj_t* chart;
+ lv_chart_series_t* ser1;
+ lv_chart_series_t* ser2;
+ lv_chart_series_t* ser3;
lv_obj_t* labelStep;
lv_obj_t* labelStepValue;
static constexpr uint8_t nbStepsBufferSize = 9;
- char nbStepsBuffer[nbStepsBufferSize+1];
+ char nbStepsBuffer[nbStepsBufferSize + 1];
bool running = true;
-
};
}
}
diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp
index 373d084e..9f10f508 100644
--- a/src/displayapp/screens/Music.cpp
+++ b/src/displayapp/screens/Music.cpp
@@ -26,8 +26,8 @@
using namespace Pinetime::Applications::Screens;
-static void event_handler(lv_obj_t *obj, lv_event_t event) {
- Music *screen = static_cast<Music *>(obj->user_data);
+static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ Music* screen = static_cast<Music*>(obj->user_data);
screen->OnObjectEvent(obj, event);
}
@@ -38,7 +38,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
* @param img pointer to an image object
* @param data the image array
*/
-inline void lv_img_set_src_arr(lv_obj_t *img, const lv_img_dsc_t *src_img) {
+inline void lv_img_set_src_arr(lv_obj_t* img, const lv_img_dsc_t* src_img) {
lv_img_set_src(img, src_img);
}
@@ -47,51 +47,66 @@ inline void lv_img_set_src_arr(lv_obj_t *img, const lv_img_dsc_t *src_img) {
*
* TODO: Investigate Apple Media Service and AVRCPv1.6 support for seamless integration
*/
-Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::MusicService &music) : Screen(app), musicService(music) {
- lv_obj_t *label;
-
+Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::MusicService& music) : Screen(app), musicService(music) {
+ lv_obj_t* label;
+
btnVolDown = lv_btn_create(lv_scr_act(), nullptr);
btnVolDown->user_data = this;
lv_obj_set_event_cb(btnVolDown, event_handler);
- lv_obj_set_size(btnVolDown, LV_HOR_RES / 3, 80);
- lv_obj_align(btnVolDown, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
+ lv_obj_set_size(btnVolDown, 65, 75);
+ lv_obj_align(btnVolDown, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 15, -10);
+ lv_obj_set_style_local_radius(btnVolDown, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
+ lv_obj_set_style_local_bg_color(btnVolDown, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
+ lv_obj_set_style_local_bg_opa(btnVolDown, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
label = lv_label_create(btnVolDown, nullptr);
lv_label_set_text(label, Symbols::volumDown);
lv_obj_set_hidden(btnVolDown, !displayVolumeButtons);
-
+
btnVolUp = lv_btn_create(lv_scr_act(), nullptr);
btnVolUp->user_data = this;
lv_obj_set_event_cb(btnVolUp, event_handler);
- lv_obj_set_size(btnVolUp, LV_HOR_RES / 3, 80);
- lv_obj_align(btnVolUp, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
+ lv_obj_set_size(btnVolUp, 65, 75);
+ lv_obj_align(btnVolUp, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, -15, -10);
+ lv_obj_set_style_local_radius(btnVolUp, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
+ lv_obj_set_style_local_bg_color(btnVolUp, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
+ lv_obj_set_style_local_bg_opa(btnVolUp, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
label = lv_label_create(btnVolUp, nullptr);
lv_label_set_text(label, Symbols::volumUp);
- lv_obj_set_hidden(btnVolDown, !displayVolumeButtons);
-
+ lv_obj_set_hidden(btnVolUp, !displayVolumeButtons);
+
btnPrev = lv_btn_create(lv_scr_act(), nullptr);
btnPrev->user_data = this;
lv_obj_set_event_cb(btnPrev, event_handler);
- lv_obj_set_size(btnPrev, LV_HOR_RES / 3, 80);
- lv_obj_align(btnPrev, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
+ lv_obj_set_size(btnPrev, 65, 75);
+ lv_obj_align(btnPrev, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 15, -10);
+ lv_obj_set_style_local_radius(btnPrev, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
+ lv_obj_set_style_local_bg_color(btnPrev, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
+ lv_obj_set_style_local_bg_opa(btnPrev, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
label = lv_label_create(btnPrev, nullptr);
lv_label_set_text(label, Symbols::stepBackward);
-
+
btnNext = lv_btn_create(lv_scr_act(), nullptr);
btnNext->user_data = this;
lv_obj_set_event_cb(btnNext, event_handler);
- lv_obj_set_size(btnNext, LV_HOR_RES / 3, 80);
- lv_obj_align(btnNext, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
+ lv_obj_set_size(btnNext, 65, 75);
+ lv_obj_align(btnNext, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, -15, -10);
+ lv_obj_set_style_local_radius(btnNext, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
+ lv_obj_set_style_local_bg_color(btnNext, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
+ lv_obj_set_style_local_bg_opa(btnNext, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
label = lv_label_create(btnNext, nullptr);
lv_label_set_text(label, Symbols::stepForward);
-
+
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
btnPlayPause->user_data = this;
lv_obj_set_event_cb(btnPlayPause, event_handler);
- lv_obj_set_size(btnPlayPause, LV_HOR_RES / 3, 80);
- lv_obj_align(btnPlayPause, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
+ lv_obj_set_size(btnPlayPause, 65, 75);
+ lv_obj_align(btnPlayPause, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, -10);
+ lv_obj_set_style_local_radius(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
+ lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
+ lv_obj_set_style_local_bg_opa(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
lv_label_set_text(txtPlayPause, Symbols::play);
-
+
txtTrackDuration = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtTrackDuration, LV_LABEL_LONG_SROLL);
lv_obj_align(txtTrackDuration, nullptr, LV_ALIGN_IN_TOP_LEFT, 12, 20);
@@ -107,30 +122,29 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus
lv_label_set_anim_speed(txtArtist, 1);
lv_obj_align(txtArtist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT);
lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID);
- lv_obj_set_width(txtArtist, LV_HOR_RES-12);
+ lv_obj_set_width(txtArtist, LV_HOR_RES - 12);
lv_label_set_text(txtArtist, "Artist Name");
-
txtTrack = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL_CIRC);
lv_label_set_anim_speed(txtTrack, 1);
lv_obj_align(txtTrack, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 2 * FONT_HEIGHT + LINE_PAD);
lv_label_set_align(txtTrack, LV_ALIGN_IN_LEFT_MID);
- lv_obj_set_width(txtTrack, LV_HOR_RES-12);
+ lv_obj_set_width(txtTrack, LV_HOR_RES - 12);
lv_label_set_text(txtTrack, "This is a very long getTrack name");
/** Init animation */
imgDisc = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src_arr(imgDisc, &disc);
lv_obj_align(imgDisc, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 15);
-
+
imgDiscAnim = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src_arr(imgDiscAnim, &disc_f_1);
lv_obj_align(imgDiscAnim, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15 - 32, 15);
-
+
frameB = false;
-
+
musicService.event(Controllers::MusicService::EVENT_MUSIC_OPEN);
}
@@ -144,22 +158,22 @@ bool Music::Refresh() {
currentLength = 0;
lv_label_set_text(txtArtist, artist.data());
}
-
+
if (track != musicService.getTrack()) {
track = musicService.getTrack();
currentLength = 0;
lv_label_set_text(txtTrack, track.data());
}
-
+
if (album != musicService.getAlbum()) {
album = musicService.getAlbum();
currentLength = 0;
}
-
+
if (playing != musicService.isPlaying()) {
playing = musicService.isPlaying();
}
-
+
// Because we increment this ourselves,
// we can't compare with the old data directly
// have to update it when there's actually new data
@@ -169,26 +183,26 @@ bool Music::Refresh() {
lastLength = currentLength;
UpdateLength();
}
-
+
if (totalLength != musicService.getTrackLength()) {
totalLength = musicService.getTrackLength();
UpdateLength();
}
-
+
if (playing == Pinetime::Controllers::MusicService::MusicStatus::Playing) {
lv_label_set_text(txtPlayPause, Symbols::pause);
if (xTaskGetTickCount() - 1024 >= lastIncrement) {
-
+
if (frameB) {
lv_img_set_src(imgDiscAnim, &disc_f_1);
} else {
lv_img_set_src(imgDiscAnim, &disc_f_2);
}
frameB = !frameB;
-
+
if (currentLength < totalLength) {
- currentLength += static_cast<int>((static_cast<float>(xTaskGetTickCount() - lastIncrement) / 1024.0f) *
- musicService.getPlaybackSpeed());
+ currentLength +=
+ static_cast<int>((static_cast<float>(xTaskGetTickCount() - lastIncrement) / 1024.0f) * musicService.getPlaybackSpeed());
} else {
// Let's assume the getTrack finished, paused when the timer ends
// and there's no new getTrack being sent to us
@@ -196,13 +210,13 @@ bool Music::Refresh() {
playing = false;
}
lastIncrement = xTaskGetTickCount();
-
+
UpdateLength();
}
} else {
lv_label_set_text(txtPlayPause, Symbols::play);
}
-
+
return running;
}
@@ -211,26 +225,26 @@ void Music::UpdateLength() {
lv_label_set_text(txtTrackDuration, "Inf/Inf");
} else if (totalLength > (99 * 60)) {
char timer[12];
- sprintf(timer, "%02d:%02d/%02d:%02d",
+ sprintf(timer,
+ "%02d:%02d/%02d:%02d",
(currentLength / (60 * 60)) % 100,
((currentLength % (60 * 60)) / 60) % 100,
(totalLength / (60 * 60)) % 100,
- ((totalLength % (60 * 60)) / 60) % 100
- );
+ ((totalLength % (60 * 60)) / 60) % 100);
lv_label_set_text(txtTrackDuration, timer);
} else {
char timer[12];
- sprintf(timer, "%02d:%02d/%02d:%02d",
+ sprintf(timer,
+ "%02d:%02d/%02d:%02d",
(currentLength / 60) % 100,
(currentLength % 60) % 100,
(totalLength / 60) % 100,
- (totalLength % 60) % 100
- );
+ (totalLength % 60) % 100);
lv_label_set_text(txtTrackDuration, timer);
}
}
-void Music::OnObjectEvent(lv_obj_t *obj, lv_event_t event) {
+void Music::OnObjectEvent(lv_obj_t* obj, lv_event_t event) {
if (event == LV_EVENT_CLICKED) {
if (obj == btnVolDown) {
musicService.event(Controllers::MusicService::EVENT_MUSIC_VOLDOWN);
@@ -241,12 +255,12 @@ void Music::OnObjectEvent(lv_obj_t *obj, lv_event_t event) {
} else if (obj == btnPlayPause) {
if (playing == Pinetime::Controllers::MusicService::MusicStatus::Playing) {
musicService.event(Controllers::MusicService::EVENT_MUSIC_PAUSE);
-
+
// Let's assume it stops playing instantly
playing = Controllers::MusicService::NotPlaying;
} else {
musicService.event(Controllers::MusicService::EVENT_MUSIC_PLAY);
-
+
// Let's assume it starts playing instantly
// TODO: In the future should check for BT connection for better UX
playing = Controllers::MusicService::Playing;
@@ -257,14 +271,13 @@ void Music::OnObjectEvent(lv_obj_t *obj, lv_event_t event) {
}
}
-
bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
switch (event) {
case TouchEvents::SwipeUp: {
displayVolumeButtons = true;
lv_obj_set_hidden(btnVolDown, !displayVolumeButtons);
lv_obj_set_hidden(btnVolUp, !displayVolumeButtons);
-
+
lv_obj_set_hidden(btnNext, displayVolumeButtons);
lv_obj_set_hidden(btnPrev, displayVolumeButtons);
return true;
@@ -273,7 +286,7 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
displayVolumeButtons = false;
lv_obj_set_hidden(btnNext, displayVolumeButtons);
lv_obj_set_hidden(btnPrev, displayVolumeButtons);
-
+
lv_obj_set_hidden(btnVolDown, !displayVolumeButtons);
lv_obj_set_hidden(btnVolUp, !displayVolumeButtons);
return true;
diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h
index 55859811..ef8f1fec 100644
--- a/src/displayapp/screens/Music.h
+++ b/src/displayapp/screens/Music.h
@@ -31,44 +31,42 @@ namespace Pinetime {
namespace Screens {
class Music : public Screen {
public:
- Music(DisplayApp *app, Pinetime::Controllers::MusicService &music);
-
+ Music(DisplayApp* app, Pinetime::Controllers::MusicService& music);
+
~Music() override;
-
+
bool Refresh() override;
-
-
-
- void OnObjectEvent(lv_obj_t *obj, lv_event_t event);
-
+
+ void OnObjectEvent(lv_obj_t* obj, lv_event_t event);
+
private:
bool OnTouchEvent(TouchEvents event);
-
+
void UpdateLength();
-
- lv_obj_t *btnPrev;
- lv_obj_t *btnPlayPause;
- lv_obj_t *btnNext;
- lv_obj_t *btnVolDown;
- lv_obj_t *btnVolUp;
- lv_obj_t *txtArtist;
- lv_obj_t *txtTrack;
- lv_obj_t *txtPlayPause;
-
- lv_obj_t *imgDisc;
- lv_obj_t *imgDiscAnim;
- lv_obj_t *txtTrackDuration;
-
+
+ lv_obj_t* btnPrev;
+ lv_obj_t* btnPlayPause;
+ lv_obj_t* btnNext;
+ lv_obj_t* btnVolDown;
+ lv_obj_t* btnVolUp;
+ lv_obj_t* txtArtist;
+ lv_obj_t* txtTrack;
+ lv_obj_t* txtPlayPause;
+
+ lv_obj_t* imgDisc;
+ lv_obj_t* imgDiscAnim;
+ lv_obj_t* txtTrackDuration;
+
/** For the spinning disc animation */
bool frameB;
-
+
bool displayVolumeButtons = false;
- Pinetime::Controllers::MusicService &musicService;
-
+ Pinetime::Controllers::MusicService& musicService;
+
std::string artist;
std::string album;
std::string track;
-
+
/** Total length in seconds */
int totalLength;
/** Current length in seconds */
@@ -77,11 +75,10 @@ namespace Pinetime {
int lastLength;
/** Last time an animation update or timer was incremented */
TickType_t lastIncrement = 0;
-
+
bool playing;
-
+
/** Watchapp */
-
};
}
}
diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp
index cfe60e23..b5ce8b83 100644
--- a/src/displayapp/screens/Navigation.cpp
+++ b/src/displayapp/screens/Navigation.cpp
@@ -28,19 +28,19 @@ LV_FONT_DECLARE(lv_font_navi_80)
* Navigation watchapp
*
*/
-Navigation::Navigation(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::NavigationService &nav) : Screen(app), navService(nav) {
+Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::NavigationService& nav)
+ : Screen(app), navService(nav) {
- imgFlag = lv_label_create(lv_scr_act(), nullptr);
+ imgFlag = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_navi_80);
lv_obj_set_style_local_text_color(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
lv_label_set_text(imgFlag, iconForName("flag"));
lv_obj_align(imgFlag, nullptr, LV_ALIGN_CENTER, 0, -60);
-
txtNarrative = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_BREAK);
lv_obj_set_width(txtNarrative, LV_HOR_RES);
- lv_label_set_text(txtNarrative, "Welcome to navigation!");
+ lv_label_set_text(txtNarrative, "Navigation");
lv_label_set_align(txtNarrative, LV_LABEL_ALIGN_CENTER);
lv_obj_align(txtNarrative, nullptr, LV_ALIGN_CENTER, 0, 10);
@@ -50,14 +50,14 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp *app, Pinetime::Contro
lv_obj_set_width(txtManDist, LV_HOR_RES);
lv_label_set_text(txtManDist, "--M");
lv_label_set_align(txtManDist, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 60);
+ lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 60);
- //Route Progress
+ // Route Progress
barProgress = lv_bar_create(lv_scr_act(), nullptr);
lv_obj_set_size(barProgress, 200, 20);
lv_obj_align(barProgress, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, -10);
lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_BG, LV_STATE_DEFAULT, lv_color_hex(0x222222));
- lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_ORANGE);
+ lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_bar_set_anim_time(barProgress, 500);
lv_bar_set_range(barProgress, 0, 100);
lv_bar_set_value(barProgress, 0, LV_ANIM_OFF);
@@ -72,7 +72,7 @@ bool Navigation::Refresh() {
if (m_flag != navService.getFlag()) {
m_flag = navService.getFlag();
lv_label_set_text(imgFlag, iconForName(m_flag));
- //lv_img_set_src_arr(imgFlag, iconForName(m_flag));
+ // lv_img_set_src_arr(imgFlag, iconForName(m_flag));
}
if (m_narrative != navService.getNarrative()) {
@@ -88,10 +88,10 @@ bool Navigation::Refresh() {
if (m_progress != navService.getProgress()) {
m_progress = navService.getProgress();
lv_bar_set_value(barProgress, m_progress, LV_ANIM_OFF);
- if ( m_progress > 90 ) {
- lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_RED);
+ if (m_progress > 90) {
+ lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED);
} else {
- lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_ORANGE);
+ lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
}
}
diff --git a/src/displayapp/screens/Navigation.h b/src/displayapp/screens/Navigation.h
index 53108f98..46816c33 100644
--- a/src/displayapp/screens/Navigation.h
+++ b/src/displayapp/screens/Navigation.h
@@ -23,7 +23,6 @@
#include "Screen.h"
#include <array>
-
namespace Pinetime {
namespace Controllers {
class NavigationService;
@@ -33,19 +32,18 @@ namespace Pinetime {
namespace Screens {
class Navigation : public Screen {
public:
- Navigation(DisplayApp *app, Pinetime::Controllers::NavigationService &nav);
+ Navigation(DisplayApp* app, Pinetime::Controllers::NavigationService& nav);
~Navigation() override;
bool Refresh() override;
-
- private:
- lv_obj_t *imgFlag;
- lv_obj_t *txtNarrative;
- lv_obj_t *txtManDist;
- lv_obj_t *barProgress;
+ private:
+ lv_obj_t* imgFlag;
+ lv_obj_t* txtNarrative;
+ lv_obj_t* txtManDist;
+ lv_obj_t* barProgress;
- Pinetime::Controllers::NavigationService &navService;
+ Pinetime::Controllers::NavigationService& navService;
std::string m_flag;
std::string m_narrative;
@@ -53,97 +51,97 @@ namespace Pinetime {
int m_progress;
/** Watchapp */
-
+
const char* iconForName(std::string icon);
-
- std::array<std::pair<std::string, const char*>, 89 > m_iconMap = { {
- {"arrive-left" ,"\xEE\xA4\x81" },
- {"arrive-right" ,"\xEE\xA4\x82" },
- {"arrive-straight" ,"\xEE\xA4\x80" },
- {"arrive" ,"\xEE\xA4\x80" },
- {"close" ,"\xEE\xA4\x83" },
- {"continue-left" ,"\xEE\xA4\x85" },
- {"continue-right" ,"\xEE\xA4\x86" },
- {"continue-slight-left" ,"\xEE\xA4\x87" },
- {"continue-slight-right" ,"\xEE\xA4\x88" },
- {"continue-straight" ,"\xEE\xA4\x84" },
- {"continue-uturn" ,"\xEE\xA4\x89" },
- {"continue" ,"\xEE\xA4\x84" },
- {"depart-left" ,"\xEE\xA4\x8B" },
- {"depart-right" ,"\xEE\xA4\x8C" },
- {"depart-straight" ,"\xEE\xA4\x8A" },
- {"end-of-road-left" ,"\xEE\xA4\x8D" },
- {"end-of-road-right" ,"\xEE\xA4\x8E" },
- {"ferry" ,"\xEE\xA4\x8F" },
- {"flag" ,"\xEE\xA4\x90" },
- {"fork-left" ,"\xEE\xA4\x92" },
- {"fork-right" ,"\xEE\xA4\x93" },
- {"fork-slight-left" ,"\xEE\xA4\x94" },
- {"fork-slight-right" ,"\xEE\xA4\x95" },
- {"fork-straight" ,"\xEE\xA4\x96" },
- {"invalid" ,"\xEE\xA4\x84" },
- {"invalid-left" ,"\xEE\xA4\x85" },
- {"invalid-right" ,"\xEE\xA4\x86" },
- {"invalid-slight-left" ,"\xEE\xA4\x87" },
- {"invalid-slight-right" ,"\xEE\xA4\x88" },
- {"invalid-straight" ,"\xEE\xA4\x84" },
- {"invalid-uturn" ,"\xEE\xA4\x89" },
- {"merge-left" ,"\xEE\xA4\x97" },
- {"merge-right" ,"\xEE\xA4\x98" },
- {"merge-slight-left" ,"\xEE\xA4\x99" },
- {"merge-slight-right" ,"\xEE\xA4\x9A" },
- {"merge-straight" ,"\xEE\xA4\x84" },
- {"new-name-left" ,"\xEE\xA4\x85" },
- {"new-name-right" ,"\xEE\xA4\x86" },
- {"new-name-sharp-left" ,"\xEE\xA4\x9B" },
- {"new-name-sharp-right" ,"\xEE\xA4\x9C" },
- {"new-name-slight-left" ,"\xEE\xA4\x87" },
- {"new-name-slight-right" ,"\xEE\xA4\x88" },
- {"new-name-straight" ,"\xEE\xA4\x84" },
- {"notification-left" ,"\xEE\xA4\x85" },
- {"notification-right" ,"\xEE\xA4\x86" },
- {"notification-sharp-left" ,"\xEE\xA4\x9B" },
- {"notification-sharp-right" ,"\xEE\xA4\xA5" },
- {"notification-slight-left" ,"\xEE\xA4\x87" },
- {"notification-slight-right" ,"\xEE\xA4\x88" },
- {"notification-straight" ,"\xEE\xA4\x84" },
- {"off-ramp-left" ,"\xEE\xA4\x9D" },
- {"off-ramp-right" ,"\xEE\xA4\x9E" },
- {"off-ramp-slight-left" ,"\xEE\xA4\x9F" },
- {"off-ramp-slight-right" ,"\xEE\xA4\xA0" },
- {"on-ramp-left" ,"\xEE\xA4\x85" },
- {"on-ramp-right" ,"\xEE\xA4\x86" },
- {"on-ramp-sharp-left" ,"\xEE\xA4\x9B" },
- {"on-ramp-sharp-right" ,"\xEE\xA4\xA5" },
- {"on-ramp-slight-left" ,"\xEE\xA4\x87" },
- {"on-ramp-slight-right" ,"\xEE\xA4\x88" },
- {"on-ramp-straight" ,"\xEE\xA4\x84" },
- {"rotary" ,"\xEE\xA4\xA1" },
- {"rotary-left" ,"\xEE\xA4\xA2" },
- {"rotary-right" ,"\xEE\xA4\xA3" },
- {"rotary-sharp-left" ,"\xEE\xA4\xA4" },
- {"rotary-sharp-right" ,"\xEE\xA4\xA5" },
- {"rotary-slight-left" ,"\xEE\xA4\xA6" },
- {"rotary-slight-right" ,"\xEE\xA4\xA7" },
- {"rotary-straight" ,"\xEE\xA4\xA8" },
- {"roundabout" ,"\xEE\xA4\xA1" },
- {"roundabout-left" ,"\xEE\xA4\xA2" },
- {"roundabout-right" ,"\xEE\xA4\xA3" },
- {"roundabout-sharp-left" ,"\xEE\xA4\xA4" },
- {"roundabout-sharp-right" ,"\xEE\xA4\xA5" },
- {"roundabout-slight-left" ,"\xEE\xA4\xA6" },
- {"roundabout-slight-right" ,"\xEE\xA4\xA7" },
- {"roundabout-straight" ,"\xEE\xA4\xA8" },
- {"turn-left" ,"\xEE\xA4\x85" },
- {"turn-right" ,"\xEE\xA4\x86" },
- {"turn-sharp-left" ,"\xEE\xA4\x9B" },
- {"turn-sharp-right" ,"\xEE\xA4\xA5" },
- {"turn-slight-left" ,"\xEE\xA4\x87" },
- {"turn-slight-right" ,"\xEE\xA4\x88" },
- {"turn-straight" ,"\xEE\xA4\x84" },
- {"updown" ,"\xEE\xA4\xA9" },
- {"uturn" ,"\xEE\xA4\x89" },
- } };
+
+ std::array<std::pair<std::string, const char*>, 89> m_iconMap = {{
+ {"arrive-left", "\xEE\xA4\x81"},
+ {"arrive-right", "\xEE\xA4\x82"},
+ {"arrive-straight", "\xEE\xA4\x80"},
+ {"arrive", "\xEE\xA4\x80"},
+ {"close", "\xEE\xA4\x83"},
+ {"continue-left", "\xEE\xA4\x85"},
+ {"continue-right", "\xEE\xA4\x86"},
+ {"continue-slight-left", "\xEE\xA4\x87"},
+ {"continue-slight-right", "\xEE\xA4\x88"},
+ {"continue-straight", "\xEE\xA4\x84"},
+ {"continue-uturn", "\xEE\xA4\x89"},
+ {"continue", "\xEE\xA4\x84"},
+ {"depart-left", "\xEE\xA4\x8B"},
+ {"depart-right", "\xEE\xA4\x8C"},
+ {"depart-straight", "\xEE\xA4\x8A"},
+ {"end-of-road-left", "\xEE\xA4\x8D"},
+ {"end-of-road-right", "\xEE\xA4\x8E"},
+ {"ferry", "\xEE\xA4\x8F"},
+ {"flag", "\xEE\xA4\x90"},
+ {"fork-left", "\xEE\xA4\x92"},
+ {"fork-right", "\xEE\xA4\x93"},
+ {"fork-slight-left", "\xEE\xA4\x94"},
+ {"fork-slight-right", "\xEE\xA4\x95"},
+ {"fork-straight", "\xEE\xA4\x96"},
+ {"invalid", "\xEE\xA4\x84"},
+ {"invalid-left", "\xEE\xA4\x85"},
+ {"invalid-right", "\xEE\xA4\x86"},
+ {"invalid-slight-left", "\xEE\xA4\x87"},
+ {"invalid-slight-right", "\xEE\xA4\x88"},
+ {"invalid-straight", "\xEE\xA4\x84"},
+ {"invalid-uturn", "\xEE\xA4\x89"},
+ {"merge-left", "\xEE\xA4\x97"},
+ {"merge-right", "\xEE\xA4\x98"},
+ {"merge-slight-left", "\xEE\xA4\x99"},
+ {"merge-slight-right", "\xEE\xA4\x9A"},
+ {"merge-straight", "\xEE\xA4\x84"},
+ {"new-name-left", "\xEE\xA4\x85"},
+ {"new-name-right", "\xEE\xA4\x86"},
+ {"new-name-sharp-left", "\xEE\xA4\x9B"},
+ {"new-name-sharp-right", "\xEE\xA4\x9C"},
+ {"new-name-slight-left", "\xEE\xA4\x87"},
+ {"new-name-slight-right", "\xEE\xA4\x88"},
+ {"new-name-straight", "\xEE\xA4\x84"},
+ {"notification-left", "\xEE\xA4\x85"},
+ {"notification-right", "\xEE\xA4\x86"},
+ {"notification-sharp-left", "\xEE\xA4\x9B"},
+ {"notification-sharp-right", "\xEE\xA4\xA5"},
+ {"notification-slight-left", "\xEE\xA4\x87"},
+ {"notification-slight-right", "\xEE\xA4\x88"},
+ {"notification-straight", "\xEE\xA4\x84"},
+ {"off-ramp-left", "\xEE\xA4\x9D"},
+ {"off-ramp-right", "\xEE\xA4\x9E"},
+ {"off-ramp-slight-left", "\xEE\xA4\x9F"},
+ {"off-ramp-slight-right", "\xEE\xA4\xA0"},
+ {"on-ramp-left", "\xEE\xA4\x85"},
+ {"on-ramp-right", "\xEE\xA4\x86"},
+ {"on-ramp-sharp-left", "\xEE\xA4\x9B"},
+ {"on-ramp-sharp-right", "\xEE\xA4\xA5"},
+ {"on-ramp-slight-left", "\xEE\xA4\x87"},
+ {"on-ramp-slight-right", "\xEE\xA4\x88"},
+ {"on-ramp-straight", "\xEE\xA4\x84"},
+ {"rotary", "\xEE\xA4\xA1"},
+ {"rotary-left", "\xEE\xA4\xA2"},
+ {"rotary-right", "\xEE\xA4\xA3"},
+ {"rotary-sharp-left", "\xEE\xA4\xA4"},
+ {"rotary-sharp-right", "\xEE\xA4\xA5"},
+ {"rotary-slight-left", "\xEE\xA4\xA6"},
+ {"rotary-slight-right", "\xEE\xA4\xA7"},
+ {"rotary-straight", "\xEE\xA4\xA8"},
+ {"roundabout", "\xEE\xA4\xA1"},
+ {"roundabout-left", "\xEE\xA4\xA2"},
+ {"roundabout-right", "\xEE\xA4\xA3"},
+ {"roundabout-sharp-left", "\xEE\xA4\xA4"},
+ {"roundabout-sharp-right", "\xEE\xA4\xA5"},
+ {"roundabout-slight-left", "\xEE\xA4\xA6"},
+ {"roundabout-slight-right", "\xEE\xA4\xA7"},
+ {"roundabout-straight", "\xEE\xA4\xA8"},
+ {"turn-left", "\xEE\xA4\x85"},
+ {"turn-right", "\xEE\xA4\x86"},
+ {"turn-sharp-left", "\xEE\xA4\x9B"},
+ {"turn-sharp-right", "\xEE\xA4\xA5"},
+ {"turn-slight-left", "\xEE\xA4\x87"},
+ {"turn-slight-right", "\xEE\xA4\x88"},
+ {"turn-straight", "\xEE\xA4\x84"},
+ {"updown", "\xEE\xA4\xA9"},
+ {"uturn", "\xEE\xA4\x89"},
+ }};
};
}
}
diff --git a/src/displayapp/screens/NotificationIcon.cpp b/src/displayapp/screens/NotificationIcon.cpp
index 64898c2c..d8792f9d 100644
--- a/src/displayapp/screens/NotificationIcon.cpp
+++ b/src/displayapp/screens/NotificationIcon.cpp
@@ -3,6 +3,8 @@
using namespace Pinetime::Applications::Screens;
const char* NotificationIcon::GetIcon(bool newNotificationAvailable) {
- if(newNotificationAvailable) return Symbols::info;
- else return "";
+ if (newNotificationAvailable)
+ return Symbols::info;
+ else
+ return "";
} \ No newline at end of file
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index 33cebe86..f0fd2f66 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -8,34 +8,34 @@ using namespace Pinetime::Applications::Screens;
extern lv_font_t jetbrains_mono_extrabold_compressed;
extern lv_font_t jetbrains_mono_bold_20;
-Notifications::Notifications(DisplayApp *app,
- Pinetime::Controllers::NotificationManager &notificationManager,
+Notifications::Notifications(DisplayApp* app,
+ Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
- Modes mode) :
- Screen(app), notificationManager{notificationManager}, alertNotificationService{alertNotificationService}, mode{mode} {
+ Modes mode)
+ : Screen(app), notificationManager {notificationManager}, alertNotificationService {alertNotificationService}, mode {mode} {
notificationManager.ClearNewNotificationFlag();
auto notification = notificationManager.GetLastNotification();
- if(notification.valid) {
+ if (notification.valid) {
currentId = notification.id;
currentItem = std::make_unique<NotificationItem>(notification.Title(),
- notification.Message(),
- notification.index,
- notification.category,
- notificationManager.NbNotifications(),
- mode,
- alertNotificationService);
+ notification.Message(),
+ notification.index,
+ notification.category,
+ notificationManager.NbNotifications(),
+ mode,
+ alertNotificationService);
validDisplay = true;
} else {
currentItem = std::make_unique<NotificationItem>("Notification",
- "No notification to display",
- 0,
- notification.category,
- notificationManager.NbNotifications(),
- Modes::Preview,
- alertNotificationService);
+ "No notification to display",
+ 0,
+ notification.category,
+ notificationManager.NbNotifications(),
+ Modes::Preview,
+ alertNotificationService);
}
- if(mode == Modes::Preview) {
+ if (mode == Modes::Preview) {
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
@@ -45,7 +45,7 @@ Notifications::Notifications(DisplayApp *app,
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
timeoutTickCountStart = xTaskGetTickCount();
- timeoutTickCountEnd = timeoutTickCountStart + (5*1024);
+ timeoutTickCountEnd = timeoutTickCountStart + (5 * 1024);
}
}
@@ -68,34 +68,36 @@ bool Notifications::Refresh() {
}
bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- if(mode != Modes::Normal) return true;
+ if (mode != Modes::Normal)
+ return true;
switch (event) {
case Pinetime::Applications::TouchEvents::SwipeDown: {
Controllers::NotificationManager::Notification previousNotification;
- if(validDisplay)
+ if (validDisplay)
previousNotification = notificationManager.GetPrevious(currentId);
else
previousNotification = notificationManager.GetLastNotification();
- if (!previousNotification.valid) return true;
+ if (!previousNotification.valid)
+ return true;
validDisplay = true;
currentId = previousNotification.id;
currentItem.reset(nullptr);
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
currentItem = std::make_unique<NotificationItem>(previousNotification.Title(),
- previousNotification.Message(),
- previousNotification.index,
- previousNotification.category,
- notificationManager.NbNotifications(),
- mode,
- alertNotificationService);
+ previousNotification.Message(),
+ previousNotification.index,
+ previousNotification.category,
+ notificationManager.NbNotifications(),
+ mode,
+ alertNotificationService);
}
return true;
case Pinetime::Applications::TouchEvents::SwipeUp: {
Controllers::NotificationManager::Notification nextNotification;
- if(validDisplay)
+ if (validDisplay)
nextNotification = notificationManager.GetNext(currentId);
else
nextNotification = notificationManager.GetLastNotification();
@@ -110,16 +112,16 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
currentItem.reset(nullptr);
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up);
currentItem = std::make_unique<NotificationItem>(nextNotification.Title(),
- nextNotification.Message(),
- nextNotification.index,
- nextNotification.category,
- notificationManager.NbNotifications(),
- mode,
- alertNotificationService);
+ nextNotification.Message(),
+ nextNotification.index,
+ nextNotification.category,
+ notificationManager.NbNotifications(),
+ mode,
+ alertNotificationService);
}
return true;
case Pinetime::Applications::TouchEvents::LongTap: {
- //notificationManager.ToggleVibrations();
+ // notificationManager.ToggleVibrations();
return true;
}
default:
@@ -138,20 +140,20 @@ namespace {
item->OnMuteIncomingCall(event);
}
- static void RejectIncomingCallEventHandler(lv_obj_t *obj, lv_event_t event) {
- auto* item = static_cast<Notifications::NotificationItem *>(obj->user_data);
+ static void RejectIncomingCallEventHandler(lv_obj_t* obj, lv_event_t event) {
+ auto* item = static_cast<Notifications::NotificationItem*>(obj->user_data);
item->OnRejectIncomingCall(event);
}
}
- Notifications::NotificationItem::NotificationItem(const char *title,
- const char *msg,
- uint8_t notifNr,
- Controllers::NotificationManager::Categories category,
- uint8_t notifNb,
- Modes mode,
- Pinetime::Controllers::AlertNotificationService& alertNotificationService)
- : notifNr{notifNr}, notifNb{notifNb}, mode{mode}, alertNotificationService{alertNotificationService} {
+Notifications::NotificationItem::NotificationItem(const char* title,
+ const char* msg,
+ uint8_t notifNr,
+ Controllers::NotificationManager::Categories category,
+ uint8_t notifNb,
+ Modes mode,
+ Pinetime::Controllers::AlertNotificationService& alertNotificationService)
+ : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService} {
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL);
@@ -172,20 +174,20 @@ namespace {
lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x888888));
- if(title == nullptr) title = "Notification";
+ if (title == nullptr)
+ title = "Notification";
lv_label_set_text(alert_type, title);
lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16);
/////////
- switch(category) {
+ switch (category) {
default: {
lv_obj_t* alert_subject = lv_label_create(container1, nullptr);
lv_obj_set_style_local_text_color(alert_subject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_long_mode(alert_subject, LV_LABEL_LONG_BREAK);
lv_obj_set_width(alert_subject, LV_HOR_RES - 20);
lv_label_set_text(alert_subject, msg);
- }
- break;
+ } break;
case Controllers::NotificationManager::Categories::IncomingCall: {
lv_obj_t* alert_subject = lv_label_create(container1, nullptr);
lv_obj_set_style_local_text_color(alert_subject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
@@ -234,8 +236,7 @@ namespace {
label_mute = lv_label_create(bt_mute, nullptr);
lv_label_set_text(label_mute, Symbols::volumMute);
lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- }
- break;
+ } break;
}
lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
@@ -246,19 +247,22 @@ namespace {
}
void Notifications::NotificationItem::OnAcceptIncomingCall(lv_event_t event) {
- if (event != LV_EVENT_CLICKED) return;
+ if (event != LV_EVENT_CLICKED)
+ return;
alertNotificationService.AcceptIncomingCall();
}
void Notifications::NotificationItem::OnMuteIncomingCall(lv_event_t event) {
- if (event != LV_EVENT_CLICKED) return;
+ if (event != LV_EVENT_CLICKED)
+ return;
alertNotificationService.MuteIncomingCall();
}
void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) {
- if (event != LV_EVENT_CLICKED) return;
+ if (event != LV_EVENT_CLICKED)
+ return;
alertNotificationService.RejectIncomingCall();
}
diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h
index 0d54ddbe..51ca81da 100644
--- a/src/displayapp/screens/Notifications.h
+++ b/src/displayapp/screens/Notifications.h
@@ -14,19 +14,30 @@ namespace Pinetime {
namespace Screens {
class Notifications : public Screen {
- public:
- enum class Modes {Normal, Preview};
- explicit Notifications(DisplayApp* app, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::AlertNotificationService& alertNotificationService, Modes mode);
- ~Notifications() override;
+ public:
+ enum class Modes { Normal, Preview };
+ explicit Notifications(DisplayApp* app,
+ Pinetime::Controllers::NotificationManager& notificationManager,
+ Pinetime::Controllers::AlertNotificationService& alertNotificationService,
+ Modes mode);
+ ~Notifications() override;
- bool Refresh() override;
- bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
+ bool Refresh() override;
+ bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
class NotificationItem {
public:
- NotificationItem(const char* title, const char* msg, uint8_t notifNr, Controllers::NotificationManager::Categories, uint8_t notifNb, Modes mode, Pinetime::Controllers::AlertNotificationService& alertNotificationService);
+ NotificationItem(const char* title,
+ const char* msg,
+ uint8_t notifNr,
+ Controllers::NotificationManager::Categories,
+ uint8_t notifNb,
+ Modes mode,
+ Pinetime::Controllers::AlertNotificationService& alertNotificationService);
~NotificationItem();
- bool Refresh() {return false;}
+ bool Refresh() {
+ return false;
+ }
void OnAcceptIncomingCall(lv_event_t event);
void OnMuteIncomingCall(lv_event_t event);
void OnRejectIncomingCall(lv_event_t event);
@@ -49,28 +60,24 @@ namespace Pinetime {
lv_obj_t* bottomPlaceholder;
Modes mode;
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
-
-
};
- private:
-
-
- struct NotificationData {
- const char* title;
- const char* text;
- };
- Pinetime::Controllers::NotificationManager& notificationManager;
- Pinetime::Controllers::AlertNotificationService& alertNotificationService;
- Modes mode = Modes::Normal;
- std::unique_ptr<NotificationItem> currentItem;
- Controllers::NotificationManager::Notification::Id currentId;
- bool validDisplay = false;
+ private:
+ struct NotificationData {
+ const char* title;
+ const char* text;
+ };
+ Pinetime::Controllers::NotificationManager& notificationManager;
+ Pinetime::Controllers::AlertNotificationService& alertNotificationService;
+ Modes mode = Modes::Normal;
+ std::unique_ptr<NotificationItem> currentItem;
+ Controllers::NotificationManager::Notification::Id currentId;
+ bool validDisplay = false;
- lv_point_t timeoutLinePoints[2] { {0, 1}, {239, 1} };
- lv_obj_t* timeoutLine;
- uint32_t timeoutTickCountStart;
- uint32_t timeoutTickCountEnd;
+ lv_point_t timeoutLinePoints[2] {{0, 1}, {239, 1}};
+ lv_obj_t* timeoutLine;
+ uint32_t timeoutTickCountStart;
+ uint32_t timeoutTickCountEnd;
};
}
}
diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp
index e86cf01b..161f175b 100644
--- a/src/displayapp/screens/Paddle.cpp
+++ b/src/displayapp/screens/Paddle.cpp
@@ -4,124 +4,96 @@
using namespace Pinetime::Applications::Screens;
-namespace{
-const uint8_t paddle_map[] = {
- 0xfc, 0xfe, 0xfc, 0xff, /*Color of index 0*/
- 0xff, 0xff, 0xff, 0xff, /*Color of index 1*/
-
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
-};
-
-const uint8_t ball_map[] = {
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
- 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
-};
+namespace {
+ const uint8_t paddle_map[] = {
+ 0xfc, 0xfe, 0xfc, 0xff, /*Color of index 0*/
+ 0xff, 0xff, 0xff, 0xff, /*Color of index 1*/
+
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
+
+ const uint8_t ball_map[] = {
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed,
+ };
}
-Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} {
+Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} {
app->SetTouchMode(DisplayApp::TouchModes::Polling);
-
+
points = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(points, "0000");
lv_obj_set_style_local_text_color(points, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x444444));
lv_obj_align(points, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 0);
-
+
paddle.header.always_zero = 0;
paddle.header.w = 4;
paddle.header.h = 60;
paddle.data_size = 68;
paddle.header.cf = LV_IMG_CF_INDEXED_1BIT;
- paddle.data = paddle_map;
+ paddle.data = paddle_map;
paddle_image = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src(paddle_image, &paddle);
-
+
ball.header.always_zero = 0;
ball.header.w = 24;
ball.header.h = 24;
ball.data_size = 24 * 24 * LV_COLOR_SIZE / 8;
ball.header.cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
- ball.data = ball_map;
+ ball.data = ball_map;
ball_image = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src(ball_image, &ball);
}
@@ -133,51 +105,54 @@ Paddle::~Paddle() {
}
bool Paddle::Refresh() {
- if((counter++ % 5) == 0){
- counter = 0;
-
+ if ((counter++ % 5) == 0) {
+ counter = 0;
+
ballX += dx;
- ballY += dy;
-
+ ballY += dy;
+
lv_obj_set_pos(ball_image, ballX, ballY);
-
- //checks if it has touched the sides (floor and ceiling)
- if(ballY <= 0 || ballY >= 215){
+
+ // checks if it has touched the sides (floor and ceiling)
+ if (ballY <= 0 || ballY >= 215) {
dy *= -1;
}
-
- //checks if it has touched the side (left side)
- if(ballX >= 215){
- dx *= -1;
+
+ // checks if it has touched the side (left side)
+ if (ballX >= 215) {
+ dx *= -1;
+ }
+
+ // checks if it is in the position of the paddle
+ if (ballY <= (paddleBottomY + 16) && ballY >= (paddleTopY - 8)) {
+ if (ballX >= 0 && ballX < 4) {
+ lv_obj_set_pos(ball_image, 5, ballY);
+ dx *= -1;
+ score++;
+ }
}
-
- //checks if it is in the position of the paddle
- if(ballY <= (paddleBottomY + 16) && ballY >= (paddleTopY - 8)){
- if(ballX >= 0 && ballX < 4){
- lv_obj_set_pos(ball_image, 5, ballY);
- dx *= -1;
- score++;
- }
- }
-
- //checks if it has gone behind the paddle
- else if(ballX <= -40){
+
+ // checks if it has gone behind the paddle
+ else if (ballX <= -40) {
ballX = 107;
- ballY = 107;
- score = 0;
+ ballY = 107;
+ score = 0;
}
lv_label_set_text_fmt(points, "%04d", score);
- }
+ }
return running;
}
-bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- return true;
+bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
+ return true;
}
bool Paddle::OnTouchEvent(uint16_t x, uint16_t y) {
- lv_obj_set_pos(paddle_image, 0, y - 30); // sets the center paddle pos. (30px offset) with the the y_coordinate of the finger and defaults the x_coordinate to 0
- paddleTopY = y - 30; // refreshes the upper extreme of the paddle
- paddleBottomY = y + 30; // refreshes the lower extreme of the paddle
+ lv_obj_set_pos(
+ paddle_image,
+ 0,
+ y - 30); // sets the center paddle pos. (30px offset) with the the y_coordinate of the finger and defaults the x_coordinate to 0
+ paddleTopY = y - 30; // refreshes the upper extreme of the paddle
+ paddleBottomY = y + 30; // refreshes the lower extreme of the paddle
return true;
}
diff --git a/src/displayapp/screens/Paddle.h b/src/displayapp/screens/Paddle.h
index 453d99ae..e133244f 100644
--- a/src/displayapp/screens/Paddle.h
+++ b/src/displayapp/screens/Paddle.h
@@ -11,39 +11,37 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class Paddle : public Screen{
- public:
- Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl);
- ~Paddle() override;
-
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
- bool OnTouchEvent(uint16_t x, uint16_t y) override;
-
- private:
- Pinetime::Components::LittleVgl& lvgl;
-
- int paddleBottomY = 90; // bottom extreme of the paddle
- int paddleTopY = 150; //top extreme of the paddle
-
- int ballX = 107; // Initial x_coordinate for the ball (12px offset from the center to counteract the ball's 24px size)
- int ballY = 107; // Initial y_coordinate for the ball
-
- int dx = 2; // Velocity of the ball in the x_coordinate
- int dy = 3; // Velocity of the ball in the y_coordinate
-
- int counter = 0; // init Frame refresh limit counter
- int score = 0;
-
- lv_img_dsc_t paddle;
- lv_img_dsc_t ball;
-
- lv_obj_t* points;
- lv_obj_t* paddle_image; // pointer to paddle image
- lv_obj_t* ball_image; // pointer to ball image
-
-
+ class Paddle : public Screen {
+ public:
+ Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl);
+ ~Paddle() override;
+
+ bool Refresh() override;
+
+ bool OnTouchEvent(TouchEvents event) override;
+ bool OnTouchEvent(uint16_t x, uint16_t y) override;
+
+ private:
+ Pinetime::Components::LittleVgl& lvgl;
+
+ int paddleBottomY = 90; // bottom extreme of the paddle
+ int paddleTopY = 150; // top extreme of the paddle
+
+ int ballX = 107; // Initial x_coordinate for the ball (12px offset from the center to counteract the ball's 24px size)
+ int ballY = 107; // Initial y_coordinate for the ball
+
+ int dx = 2; // Velocity of the ball in the x_coordinate
+ int dy = 3; // Velocity of the ball in the y_coordinate
+
+ int counter = 0; // init Frame refresh limit counter
+ int score = 0;
+
+ lv_img_dsc_t paddle;
+ lv_img_dsc_t ball;
+
+ lv_obj_t* points;
+ lv_obj_t* paddle_image; // pointer to paddle image
+ lv_obj_t* ball_image; // pointer to ball image
};
}
}
diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h
index cf4f6994..8e49c9de 100644
--- a/src/displayapp/screens/Screen.h
+++ b/src/displayapp/screens/Screen.h
@@ -8,56 +8,68 @@ namespace Pinetime {
class DisplayApp;
namespace Screens {
- template <class T>
- class DirtyValue {
- public:
- DirtyValue() = default; // Use NSDMI
- explicit DirtyValue(T const& v):value{v}{} // Use MIL and const-lvalue-ref
- bool IsUpdated() const { return isUpdated; }
- T const& Get() { this->isUpdated = false; return value; } // never expose a non-const lvalue-ref
- DirtyValue& operator=(const T& other) {
- if (this->value != other) {
- this->value = other;
- this->isUpdated = true;
- }
- return *this;
+ template <class T> class DirtyValue {
+ public:
+ DirtyValue() = default; // Use NSDMI
+ explicit DirtyValue(T const& v) : value {v} {
+ } // Use MIL and const-lvalue-ref
+ bool IsUpdated() const {
+ return isUpdated;
+ }
+ T const& Get() {
+ this->isUpdated = false;
+ return value;
+ } // never expose a non-const lvalue-ref
+ DirtyValue& operator=(const T& other) {
+ if (this->value != other) {
+ this->value = other;
+ this->isUpdated = true;
}
- private:
- T value{}; // NSDMI - default initialise type
- bool isUpdated{true}; // NSDMI - use brace initilisation
+ return *this;
+ }
+
+ private:
+ T value {}; // NSDMI - default initialise type
+ bool isUpdated {true}; // NSDMI - use brace initilisation
};
-
- class Screen {
- public:
- explicit Screen(DisplayApp* app) : app{app} {}
- virtual ~Screen() = default;
- /**
- * Most of the time, apps only react to events (touch events, for example).
- * In this case you don't need to do anything in this method.
- *
- * For example, InfiniPaint does nothing in Refresh().
- * But, if you want to update your display periodically, draw an animation...
- * you cannot do it in a touch event handler because these handlers are not
- * called if the user does not touch the screen.
- *
- * That's why Refresh() is there: update the display periodically.
- *
- * @return false if the app can be closed, true if it must continue to run
- **/
- virtual bool Refresh() = 0;
+ class Screen {
+ public:
+ explicit Screen(DisplayApp* app) : app {app} {
+ }
+ virtual ~Screen() = default;
- /** @return false if the button hasn't been handled by the app, true if it has been handled */
- virtual bool OnButtonPushed() { return false; }
+ /**
+ * Most of the time, apps only react to events (touch events, for example).
+ * In this case you don't need to do anything in this method.
+ *
+ * For example, InfiniPaint does nothing in Refresh().
+ * But, if you want to update your display periodically, draw an animation...
+ * you cannot do it in a touch event handler because these handlers are not
+ * called if the user does not touch the screen.
+ *
+ * That's why Refresh() is there: update the display periodically.
+ *
+ * @return false if the app can be closed, true if it must continue to run
+ **/
+ virtual bool Refresh() = 0;
- /** @return false if the event hasn't been handled by the app, true if it has been handled */
- virtual bool OnTouchEvent(TouchEvents event) { return false; }
- virtual bool OnTouchEvent(uint16_t x, uint16_t y) { return false; }
+ /** @return false if the button hasn't been handled by the app, true if it has been handled */
+ virtual bool OnButtonPushed() {
+ return false;
+ }
- protected:
- DisplayApp* app;
- bool running = true;
+ /** @return false if the event hasn't been handled by the app, true if it has been handled */
+ virtual bool OnTouchEvent(TouchEvents event) {
+ return false;
+ }
+ virtual bool OnTouchEvent(uint16_t x, uint16_t y) {
+ return false;
+ }
+ protected:
+ DisplayApp* app;
+ bool running = true;
};
}
}
diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h
index 23bcd98b..73ea4610 100644
--- a/src/displayapp/screens/ScreenList.h
+++ b/src/displayapp/screens/ScreenList.h
@@ -10,100 +10,98 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- enum class ScreenListModes {UpDown, RightLeft, LongPress};
- template <size_t N>
- class ScreenList : public Screen {
- public:
+ enum class ScreenListModes { UpDown, RightLeft, LongPress };
+ template <size_t N> class ScreenList : public Screen {
+ public:
+ ScreenList(DisplayApp* app,
+ uint8_t initScreen,
+ std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens,
+ ScreenListModes mode)
+ : Screen(app), initScreen {initScreen}, screens {std::move(screens)}, mode {mode}, current {this->screens[initScreen]()} {
+ screenIndex = initScreen;
+ }
- ScreenList(DisplayApp* app, uint8_t initScreen, std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens, ScreenListModes mode)
- : Screen(app), initScreen{initScreen}, screens{std::move(screens)}, mode{mode}, current{this->screens[initScreen]()} {
- screenIndex = initScreen;
- }
+ ~ScreenList() override {
+ lv_obj_clean(lv_scr_act());
+ }
- ~ScreenList() override {
- lv_obj_clean(lv_scr_act());
- }
+ bool Refresh() override {
+ running = current->Refresh();
+ return running;
+ }
- bool Refresh() override {
- running = current->Refresh();
- return running;
- }
+ bool OnTouchEvent(TouchEvents event) override {
- bool OnTouchEvent(TouchEvents event) override {
-
- if ( mode == ScreenListModes::UpDown) {
- switch (event) {
- case TouchEvents::SwipeDown:
- if (screenIndex > 0) {
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
- screenIndex--;
- current = screens[screenIndex]();
- return true;
- } else {
- return false;
- }
-
- case TouchEvents::SwipeUp:
- if (screenIndex < screens.size() - 1) {
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up);
- screenIndex++;
- current = screens[screenIndex]();
- }
+ if (mode == ScreenListModes::UpDown) {
+ switch (event) {
+ case TouchEvents::SwipeDown:
+ if (screenIndex > 0) {
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
+ screenIndex--;
+ current = screens[screenIndex]();
return true;
- default:
+ } else {
return false;
- }
- } else if ( mode == ScreenListModes::RightLeft) {
- switch (event) {
- case TouchEvents::SwipeRight:
- if (screenIndex > 0) {
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
- screenIndex--;
- current = screens[screenIndex]();
- return true;
- } else {
- return false;
- }
-
- case TouchEvents::SwipeLeft:
- if (screenIndex < screens.size() - 1) {
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
- screenIndex++;
- current = screens[screenIndex]();
- }
+ }
+
+ case TouchEvents::SwipeUp:
+ if (screenIndex < screens.size() - 1) {
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up);
+ screenIndex++;
+ current = screens[screenIndex]();
+ }
+ return true;
+ default:
+ return false;
+ }
+ } else if (mode == ScreenListModes::RightLeft) {
+ switch (event) {
+ case TouchEvents::SwipeRight:
+ if (screenIndex > 0) {
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
+ screenIndex--;
+ current = screens[screenIndex]();
return true;
- default:
+ } else {
return false;
- }
- } else if ( event == TouchEvents::LongTap ) {
- if (screenIndex < screens.size() - 1) {
- screenIndex++;
- } else {
- screenIndex = 0;
- }
- current.reset(nullptr);
- app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
- current = screens[screenIndex]();
- return true;
- }
+ }
- return false;
+ case TouchEvents::SwipeLeft:
+ if (screenIndex < screens.size() - 1) {
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
+ screenIndex++;
+ current = screens[screenIndex]();
+ }
+ return true;
+ default:
+ return false;
+ }
+ } else if (event == TouchEvents::LongTap) {
+ if (screenIndex < screens.size() - 1) {
+ screenIndex++;
+ } else {
+ screenIndex = 0;
+ }
+ current.reset(nullptr);
+ app->SetFullRefresh(DisplayApp::FullRefreshDirections::None);
+ current = screens[screenIndex]();
+ return true;
}
- private:
-
- uint8_t initScreen = 0;
- std::array<std::function<std::unique_ptr<Screen>()>, N> screens;
- ScreenListModes mode = ScreenListModes::UpDown;
+ return false;
+ }
- uint8_t screenIndex = 0;
- std::unique_ptr<Screen> current;
+ private:
+ uint8_t initScreen = 0;
+ std::array<std::function<std::unique_ptr<Screen>()>, N> screens;
+ ScreenListModes mode = ScreenListModes::UpDown;
-
+ uint8_t screenIndex = 0;
+ std::unique_ptr<Screen> current;
};
}
}
diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp
index e07a960f..d7cd20c3 100644
--- a/src/displayapp/screens/StopWatch.cpp
+++ b/src/displayapp/screens/StopWatch.cpp
@@ -16,10 +16,10 @@ namespace {
TimeSeparated_t convertTicksToTimeSegments(const TickType_t timeElapsed) {
const int timeElapsedMillis = (static_cast<float>(timeElapsed) / static_cast<float>(configTICK_RATE_HZ)) * 1000;
- const int milliSecs = (timeElapsedMillis % 1000) / 10; // Get only the first two digits and ignore the last
+ const int hundredths = (timeElapsedMillis % 1000) / 10; // Get only the first two digits and ignore the last
const int secs = (timeElapsedMillis / 1000) % 60;
const int mins = (timeElapsedMillis / 1000) / 60;
- return TimeSeparated_t {mins, secs, milliSecs};
+ return TimeSeparated_t {mins, secs, hundredths};
}
TickType_t calculateDelta(const TickType_t startTime, const TickType_t currentTime) {
@@ -46,20 +46,28 @@ static void stop_lap_event_handler(lv_obj_t* obj, lv_event_t event) {
}
StopWatch::StopWatch(DisplayApp* app)
- : Screen(app), running {true}, currentState {States::Init}, currentEvent {Events::Stop}, startTime {}, oldTimeElapsed {},
- currentTimeSeparated {}, lapBuffer {}, lapNr {}, lapPressed {false} {
+ : Screen(app),
+ running {true},
+ currentState {States::Init},
+ currentEvent {Events::Stop},
+ startTime {},
+ oldTimeElapsed {},
+ currentTimeSeparated {},
+ lapBuffer {},
+ lapNr {},
+ lapPressed {false} {
time = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_label_set_text(time, "00:00");
- lv_obj_align(time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -45);
+ lv_obj_align(time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -45);
msecTime = lv_label_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
+ // lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_label_set_text(msecTime, "00");
- lv_obj_align(msecTime, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 108, 3);
+ lv_obj_align(msecTime, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 108, 3);
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
btnPlayPause->user_data = this;
@@ -70,13 +78,13 @@ StopWatch::StopWatch(DisplayApp* app)
lv_label_set_text(txtPlayPause, Symbols::play);
lapOneText = lv_label_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
+ // lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_align(lapOneText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 30);
lv_label_set_text(lapOneText, "");
lapTwoText = lv_label_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_text_font(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
+ // lv_obj_set_style_local_text_font(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_align(lapTwoText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 55);
lv_label_set_text(lapTwoText, "");
@@ -107,8 +115,9 @@ bool StopWatch::Refresh() {
// Init state when an user first opens the app
// and when a stop/reset button is pressed
case States::Init: {
- if (btnStopLap) {
+ if (btnStopLap != nullptr) {
lv_obj_del(btnStopLap);
+ btnStopLap = nullptr;
}
// The initial default value
lv_label_set_text(time, "00:00");
@@ -141,14 +150,16 @@ bool StopWatch::Refresh() {
currentTimeSeparated = convertTicksToTimeSegments((oldTimeElapsed + timeElapsed));
lv_label_set_text_fmt(time, "%02d:%02d", currentTimeSeparated.mins, currentTimeSeparated.secs);
- lv_label_set_text_fmt(msecTime, "%02d", currentTimeSeparated.msecs);
+ lv_label_set_text_fmt(msecTime, "%02d", currentTimeSeparated.hundredths);
if (lapPressed == true) {
if (lapBuffer[1]) {
- lv_label_set_text_fmt(lapOneText, "#%d %d:%d:%d", (lapNr - 1), lapBuffer[1]->mins, lapBuffer[1]->secs, lapBuffer[1]->msecs);
+ lv_label_set_text_fmt(
+ lapOneText, "#%2d %2d:%02d.%02d", (lapNr - 1), lapBuffer[1]->mins, lapBuffer[1]->secs, lapBuffer[1]->hundredths);
}
if (lapBuffer[0]) {
- lv_label_set_text_fmt(lapTwoText, "#%d %d:%d:%d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->msecs);
+ lv_label_set_text_fmt(
+ lapTwoText, "#%2d %2d:%02d.%02d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->hundredths);
}
// Reset the bool to avoid setting the text in each cycle until there is a change
lapPressed = false;
diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h
index b882cab5..ff604361 100644
--- a/src/displayapp/screens/StopWatch.h
+++ b/src/displayapp/screens/StopWatch.h
@@ -18,7 +18,7 @@ namespace Pinetime::Applications::Screens {
struct TimeSeparated_t {
int mins;
int secs;
- int msecs;
+ int hundredths;
};
// A simple buffer to hold the latest two laps
@@ -66,7 +66,7 @@ namespace Pinetime::Applications::Screens {
StopWatch(DisplayApp* app);
~StopWatch() override;
bool Refresh() override;
-
+
void playPauseBtnEventHandler(lv_event_t event);
void stopLapBtnEventHandler(lv_event_t event);
diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h
index 0750f2c1..e60825c1 100644
--- a/src/displayapp/screens/Symbols.h
+++ b/src/displayapp/screens/Symbols.h
@@ -26,7 +26,7 @@ namespace Pinetime {
static constexpr const char* paintbrush = "\xEF\x87\xBC";
static constexpr const char* paddle = "\xEF\x91\x9D";
static constexpr const char* map = "\xEF\x96\xa0";
- static constexpr const char* qrcode = "\xEF\x80\xa9";
+ static constexpr const char* qrcode = "\xEF\x80\xa9";
static constexpr const char* phone = "\xEF\x82\x95";
static constexpr const char* phoneSlash = "\xEF\x8F\x9D";
static constexpr const char* volumMute = "\xEF\x9A\xA9";
@@ -41,19 +41,18 @@ namespace Pinetime {
static constexpr const char* lapsFlag = "\xEF\x80\xA4";
// lv_font_sys_48.c
- static constexpr const char* settings = "\xEE\xA4\x82";//e902
+ static constexpr const char* settings = "\xEE\xA4\x82"; // e902
- static constexpr const char* brightnessHigh = "\xEE\xA4\x84";//e904
- static constexpr const char* brightnessLow = "\xEE\xA4\x85";//e905
- static constexpr const char* brightnessMedium = "\xEE\xA4\x86";//e906
+ static constexpr const char* brightnessHigh = "\xEE\xA4\x84"; // e904
+ static constexpr const char* brightnessLow = "\xEE\xA4\x85"; // e905
+ static constexpr const char* brightnessMedium = "\xEE\xA4\x86"; // e906
- static constexpr const char* notificationsOff = "\xEE\xA4\x8B";//e90b
- static constexpr const char* notificationsOn = "\xEE\xA4\x8C";//e90c
+ static constexpr const char* notificationsOff = "\xEE\xA4\x8B"; // e90b
+ static constexpr const char* notificationsOn = "\xEE\xA4\x8C"; // e90c
- static constexpr const char* highlight = "\xEE\xA4\x87";//e907
+ static constexpr const char* highlight = "\xEE\xA4\x87"; // e907
}
}
}
}
-
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index f3ac7490..f6e8d61a 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -11,33 +11,46 @@
using namespace Pinetime::Applications::Screens;
-SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::DateTime &dateTimeController,
+SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp* app,
+ Pinetime::Controllers::DateTime& dateTimeController,
Pinetime::Controllers::Battery& batteryController,
Pinetime::Controllers::BrightnessController& brightnessController,
Pinetime::Controllers::Ble& bleController,
- Pinetime::Drivers::WatchdogView& watchdog) :
- Screen(app),
- dateTimeController{dateTimeController}, batteryController{batteryController},
- brightnessController{brightnessController}, bleController{bleController}, watchdog{watchdog},
- screens{app,
- 0,
- {
- [this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen2(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen3(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen4(); }
- },
- Screens::ScreenListModes::UpDown
- } {}
-
+ Pinetime::Drivers::WatchdogView& watchdog)
+ : Screen(app),
+ dateTimeController {dateTimeController},
+ batteryController {batteryController},
+ brightnessController {brightnessController},
+ bleController {bleController},
+ watchdog {watchdog},
+ screens {app,
+ 0,
+ {[this]() -> std::unique_ptr<Screen> {
+ return CreateScreen1();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen2();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen3();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen4();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen5();
+ }},
+ Screens::ScreenListModes::UpDown} {
+}
SystemInfo::~SystemInfo() {
lv_obj_clean(lv_scr_act());
}
bool SystemInfo::Refresh() {
- screens.Refresh();
+ if (running) {
+ screens.Refresh();
+ }
return running;
}
@@ -50,64 +63,57 @@ bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return screens.OnTouchEvent(event);
}
-void SystemInfo::CreateContainer() {
-
- if ( container1 ) {
- container1 = lv_cont_create(lv_scr_act(), nullptr);
-
- lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
- lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
- lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
- lv_obj_set_style_local_border_width(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0);
-
- lv_obj_set_pos(container1, 0, 0);
- lv_obj_set_width(container1, LV_HOR_RES - 10);
- lv_obj_set_height(container1, LV_VER_RES);
- lv_cont_set_layout(container1, LV_LAYOUT_CENTER);
- }
-}
-
std::unique_ptr<Screen> SystemInfo::CreateScreen1() {
- CreateContainer();
-
- lv_obj_t * label = lv_label_create(container1, nullptr);
+ lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label, true);
- lv_label_set_text_fmt(label,
- "#FFFF00 InfiniTime#\n\n"
- "#444444 Version# %ld.%ld.%ld\n\n"
- "#444444 Build date#\n"
- "\t%s\n"
- "\t%s\n",
- Version::Major(), Version::Minor(), Version::Patch(),
- __DATE__, __TIME__);
+ lv_label_set_text_fmt(label,
+ "#FFFF00 InfiniTime#\n\n"
+ "#444444 Version# %ld.%ld.%ld\n\n"
+ "#444444 Build date#\n"
+ "\t%s\n"
+ "\t%s\n",
+ Version::Major(),
+ Version::Minor(),
+ Version::Patch(),
+ __DATE__,
+ __TIME__);
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
- return std::unique_ptr<Screen>(new Screens::Label(0, 4, app, label));
+ lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
+ return std::unique_ptr<Screen>(new Screens::Label(0, 5, app, label));
}
std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
- CreateContainer();
-
auto batteryPercent = static_cast<uint8_t>(batteryController.PercentRemaining());
float batteryVoltage = batteryController.Voltage();
auto resetReason = [this]() {
switch (watchdog.ResetReason()) {
- case Drivers::Watchdog::ResetReasons::Watchdog: return "wtdg";
- case Drivers::Watchdog::ResetReasons::HardReset: return "hardr";
- case Drivers::Watchdog::ResetReasons::NFC: return "nfc";
- case Drivers::Watchdog::ResetReasons::SoftReset: return "softr";
- case Drivers::Watchdog::ResetReasons::CpuLockup: return "cpulock";
- case Drivers::Watchdog::ResetReasons::SystemOff: return "off";
- case Drivers::Watchdog::ResetReasons::LpComp: return "lpcomp";
- case Drivers::Watchdog::ResetReasons::DebugInterface: return "dbg";
- case Drivers::Watchdog::ResetReasons::ResetPin: return "rst";
- default: return "?";
+ case Drivers::Watchdog::ResetReasons::Watchdog:
+ return "wtdg";
+ case Drivers::Watchdog::ResetReasons::HardReset:
+ return "hardr";
+ case Drivers::Watchdog::ResetReasons::NFC:
+ return "nfc";
+ case Drivers::Watchdog::ResetReasons::SoftReset:
+ return "softr";
+ case Drivers::Watchdog::ResetReasons::CpuLockup:
+ return "cpulock";
+ case Drivers::Watchdog::ResetReasons::SystemOff:
+ return "off";
+ case Drivers::Watchdog::ResetReasons::LpComp:
+ return "lpcomp";
+ case Drivers::Watchdog::ResetReasons::DebugInterface:
+ return "dbg";
+ case Drivers::Watchdog::ResetReasons::ResetPin:
+ return "rst";
+ default:
+ return "?";
}
}();
// uptime
- static constexpr uint32_t secondsInADay = 60*60*24;
- static constexpr uint32_t secondsInAnHour = 60*60;
+ static constexpr uint32_t secondsInADay = 60 * 60 * 24;
+ static constexpr uint32_t secondsInAnHour = 60 * 60;
static constexpr uint32_t secondsInAMinute = 60;
uint32_t uptimeSeconds = dateTimeController.Uptime().count();
uint32_t uptimeDays = (uptimeSeconds / secondsInADay);
@@ -118,73 +124,122 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
uptimeSeconds = uptimeSeconds % secondsInAMinute;
// TODO handle more than 100 days of uptime
- if (batteryPercent == -1) batteryPercent = 0;
+ if (batteryPercent == -1)
+ batteryPercent = 0;
// hack to not use the flot functions from printf
uint8_t batteryVoltageBytes[2];
- batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); //truncate whole numbers
- batteryVoltageBytes[0] = static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); //remove whole part of flt and shift 2 places over
+ batteryVoltageBytes[1] = static_cast<uint8_t>(batteryVoltage); // truncate whole numbers
+ batteryVoltageBytes[0] =
+ static_cast<uint8_t>((batteryVoltage - batteryVoltageBytes[1]) * 100); // remove whole part of flt and shift 2 places over
//
- lv_obj_t * label = lv_label_create(container1, nullptr);
+ lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label, true);
- lv_label_set_text_fmt(label,
- "#444444 Date# %02d/%02d/%04d\n"
- "#444444 Time# %02d:%02d:%02d\n"
- "#444444 Uptime#\n %02lud %02lu:%02lu:%02lu\n"
- "#444444 Battery# %d%%/%1i.%02iv\n"
- "#444444 Backlight# %s\n"
- "#444444 Last reset# %s\n",
- dateTimeController.Day(), static_cast<uint8_t>(dateTimeController.Month()), dateTimeController.Year(),
- dateTimeController.Hours(), dateTimeController.Minutes(), dateTimeController.Seconds(),
- uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds,
- batteryPercent, batteryVoltageBytes[1], batteryVoltageBytes[0], brightnessController.ToString(), resetReason
- );
+ lv_label_set_text_fmt(label,
+ "#444444 Date# %02d/%02d/%04d\n"
+ "#444444 Time# %02d:%02d:%02d\n"
+ "#444444 Uptime#\n %02lud %02lu:%02lu:%02lu\n"
+ "#444444 Battery# %d%%/%1i.%02iv\n"
+ "#444444 Backlight# %s\n"
+ "#444444 Last reset# %s\n",
+ dateTimeController.Day(),
+ static_cast<uint8_t>(dateTimeController.Month()),
+ dateTimeController.Year(),
+ dateTimeController.Hours(),
+ dateTimeController.Minutes(),
+ dateTimeController.Seconds(),
+ uptimeDays,
+ uptimeHours,
+ uptimeMinutes,
+ uptimeSeconds,
+ batteryPercent,
+ batteryVoltageBytes[1],
+ batteryVoltageBytes[0],
+ brightnessController.ToString(),
+ resetReason);
+ lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
return std::unique_ptr<Screen>(new Screens::Label(1, 4, app, label));
-
}
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
lv_mem_monitor_t mon;
- lv_mem_monitor(&mon);
- CreateContainer();
+ lv_mem_monitor(&mon);
- lv_obj_t * label = lv_label_create(container1, nullptr);
+ lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label, true);
auto& bleAddr = bleController.Address();
- lv_label_set_text_fmt(label,
- "#444444 BLE MAC#\n"
- " %02x:%02x:%02x:%02x:%02x:%02x"
- "\n"
- "#444444 Memory#\n"
- " #444444 used# %d (%d%%)\n"
- " #444444 frag# %d%%\n"
- " #444444 free# %d"
- "\n"
- "#444444 Steps# %li",
- bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0],
- (int)mon.total_size - mon.free_size,
- mon.used_pct,
- mon.frag_pct,
- (int)mon.free_biggest_size,
- 0
- );
-
- return std::unique_ptr<Screen>(new Screens::Label(2, 4, app, label));
+ lv_label_set_text_fmt(label,
+ "#444444 BLE MAC#\n"
+ " %02x:%02x:%02x:%02x:%02x:%02x"
+ "\n"
+ "#444444 Memory#\n"
+ " #444444 used# %d (%d%%)\n"
+ " #444444 frag# %d%%\n"
+ " #444444 free# %d"
+ "\n"
+ "#444444 Steps# %li",
+ bleAddr[5],
+ bleAddr[4],
+ bleAddr[3],
+ bleAddr[2],
+ bleAddr[1],
+ bleAddr[0],
+ (int) mon.total_size - mon.free_size,
+ mon.used_pct,
+ mon.frag_pct,
+ (int) mon.free_biggest_size,
+ 0);
+ lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
+ return std::unique_ptr<Screen>(new Screens::Label(2, 5, app, label));
+}
+
+bool sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) {
+ return lhs.xTaskNumber < rhs.xTaskNumber;
}
std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
- CreateContainer();
- lv_obj_t * label = lv_label_create(container1, nullptr);
+ TaskStatus_t tasksStatus[7];
+ lv_obj_t* infoTask = lv_table_create(lv_scr_act(), NULL);
+ lv_table_set_col_cnt(infoTask, 3);
+ lv_table_set_row_cnt(infoTask, 8);
+ lv_obj_set_pos(infoTask, 10, 10);
+
+ lv_table_set_cell_value(infoTask, 0, 0, "#");
+ lv_table_set_col_width(infoTask, 0, 50);
+ lv_table_set_cell_value(infoTask, 0, 1, "Task");
+ lv_table_set_col_width(infoTask, 1, 80);
+ lv_table_set_cell_value(infoTask, 0, 2, "Free");
+ lv_table_set_col_width(infoTask, 2, 90);
+
+ auto nb = uxTaskGetSystemState(tasksStatus, 7, nullptr);
+ std::sort(tasksStatus, tasksStatus + nb, sortById);
+ for (uint8_t i = 0; i < nb; i++) {
+
+ lv_table_set_cell_value(infoTask, i + 1, 0, std::to_string(tasksStatus[i].xTaskNumber).c_str());
+ lv_table_set_cell_value(infoTask, i + 1, 1, tasksStatus[i].pcTaskName);
+ if (tasksStatus[i].usStackHighWaterMark < 20) {
+ std::string str1 = std::to_string(tasksStatus[i].usStackHighWaterMark) + " low";
+ lv_table_set_cell_value(infoTask, i + 1, 2, str1.c_str());
+ } else {
+ lv_table_set_cell_value(infoTask, i + 1, 2, std::to_string(tasksStatus[i].usStackHighWaterMark).c_str());
+ }
+ }
+ return std::unique_ptr<Screen>(new Screens::Label(3, 5, app, infoTask));
+}
+
+std::unique_ptr<Screen> SystemInfo::CreateScreen5() {
+ lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label, true);
lv_label_set_text_static(label,
- "Software Licensed\n"
- "under the terms of\n"
- "the GNU General\n"
- "Public License v3\n"
- "#444444 Source code#\n"
- "#FFFF00 https://github.com/#\n"
- "#FFFF00 JF002/InfiniTime#");
+ "Software Licensed\n"
+ "under the terms of\n"
+ "the GNU General\n"
+ "Public License v3\n"
+ "#444444 Source code#\n"
+ "#FFFF00 https://github.com/#\n"
+ "#FFFF00 JF002/InfiniTime#");
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
- return std::unique_ptr<Screen>(new Screens::Label(3, 4, app, label));
+ lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
+ return std::unique_ptr<Screen>(new Screens::Label(4, 5, app, label));
} \ No newline at end of file
diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h
index 574ded74..c0c65554 100644
--- a/src/displayapp/screens/SystemInfo.h
+++ b/src/displayapp/screens/SystemInfo.h
@@ -21,35 +21,33 @@ namespace Pinetime {
namespace Screens {
class SystemInfo : public Screen {
- public:
- explicit SystemInfo(DisplayApp* app,
- Pinetime::Controllers::DateTime& dateTimeController,
- Pinetime::Controllers::Battery& batteryController,
- Pinetime::Controllers::BrightnessController& brightnessController,
- Pinetime::Controllers::Ble& bleController,
- Pinetime::Drivers::WatchdogView& watchdog);
- ~SystemInfo() override;
- bool Refresh() override;
- bool OnButtonPushed() override;
- bool OnTouchEvent(TouchEvents event) override;
- private:
- bool running = true;
-
- lv_obj_t* container1;
-
- Pinetime::Controllers::DateTime& dateTimeController;
- Pinetime::Controllers::Battery& batteryController;
- Pinetime::Controllers::BrightnessController& brightnessController;
- Pinetime::Controllers::Ble& bleController;
- Pinetime::Drivers::WatchdogView& watchdog;
-
- ScreenList<4> screens;
- std::unique_ptr<Screen> CreateScreen1();
- std::unique_ptr<Screen> CreateScreen2();
- std::unique_ptr<Screen> CreateScreen3();
- std::unique_ptr<Screen> CreateScreen4();
-
- void CreateContainer();
+ public:
+ explicit SystemInfo(DisplayApp* app,
+ Pinetime::Controllers::DateTime& dateTimeController,
+ Pinetime::Controllers::Battery& batteryController,
+ Pinetime::Controllers::BrightnessController& brightnessController,
+ Pinetime::Controllers::Ble& bleController,
+ Pinetime::Drivers::WatchdogView& watchdog);
+ ~SystemInfo() override;
+ bool Refresh() override;
+ bool OnButtonPushed() override;
+ bool OnTouchEvent(TouchEvents event) override;
+
+ private:
+ bool running = true;
+
+ Pinetime::Controllers::DateTime& dateTimeController;
+ Pinetime::Controllers::Battery& batteryController;
+ Pinetime::Controllers::BrightnessController& brightnessController;
+ Pinetime::Controllers::Ble& bleController;
+ Pinetime::Drivers::WatchdogView& watchdog;
+
+ ScreenList<5> screens;
+ std::unique_ptr<Screen> CreateScreen1();
+ std::unique_ptr<Screen> CreateScreen2();
+ std::unique_ptr<Screen> CreateScreen3();
+ std::unique_ptr<Screen> CreateScreen4();
+ std::unique_ptr<Screen> CreateScreen5();
};
}
}
diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp
index 8fa7fd07..ec36af38 100644
--- a/src/displayapp/screens/Tile.cpp
+++ b/src/displayapp/screens/Tile.cpp
@@ -4,37 +4,35 @@
using namespace Pinetime::Applications::Screens;
-
namespace {
- static void lv_update_task(struct _lv_task_t *task) {
- auto user_data = static_cast<Tile *>(task->user_data);
+ static void lv_update_task(struct _lv_task_t* task) {
+ auto user_data = static_cast<Tile*>(task->user_data);
user_data->UpdateScreen();
}
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- Tile* screen = static_cast<Tile *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ Tile* screen = static_cast<Tile*>(obj->user_data);
uint32_t* eventDataPtr = (uint32_t*) lv_event_get_data();
uint32_t eventData = *eventDataPtr;
screen->OnObjectEvent(obj, event, eventData);
}
}
-Tile::Tile(uint8_t screenID, uint8_t numScreens,
- DisplayApp* app,
- Controllers::Settings& settingsController,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController,
- std::array<Applications, 6>& applications) :
- Screen(app),
- batteryController{batteryController},
- dateTimeController{dateTimeController} {
-
+Tile::Tile(uint8_t screenID,
+ uint8_t numScreens,
+ DisplayApp* app,
+ Controllers::Settings& settingsController,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController,
+ std::array<Applications, 6>& applications)
+ : Screen(app), batteryController {batteryController}, dateTimeController {dateTimeController} {
+
settingsController.SetAppMenu(screenID);
// Time
- label_time = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
- lv_label_set_align( label_time, LV_LABEL_ALIGN_CENTER );
+ label_time = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
+ lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label_time, nullptr, LV_ALIGN_IN_TOP_LEFT, 15, 6);
// Battery
@@ -42,19 +40,18 @@ Tile::Tile(uint8_t screenID, uint8_t numScreens,
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 6);
- if ( numScreens > 1 ) {
+ if (numScreens > 1) {
pageIndicatorBasePoints[0].x = 240 - 1;
pageIndicatorBasePoints[0].y = 6;
pageIndicatorBasePoints[1].x = 240 - 1;
pageIndicatorBasePoints[1].y = 240 - 6;
-
+
pageIndicatorBase = lv_line_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2);
-
uint16_t indicatorSize = 228 / numScreens;
uint16_t indicatorPos = indicatorSize * screenID;
@@ -69,11 +66,12 @@ Tile::Tile(uint8_t screenID, uint8_t numScreens,
lv_obj_set_style_local_line_rounded(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true);
lv_line_set_points(pageIndicator, pageIndicatorPoints, 2);
}
-
+
uint8_t btIndex = 0;
- for(uint8_t i = 0; i < 6; i++) {
- if(i == 3) btnmMap[btIndex++] = "\n";
- if ( applications[i].application == Apps::None ) {
+ for (uint8_t i = 0; i < 6; i++) {
+ if (i == 3)
+ btnmMap[btIndex++] = "\n";
+ if (applications[i].application == Apps::None) {
btnmMap[btIndex] = " ";
} else {
btnmMap[btIndex] = applications[i].icon;
@@ -94,16 +92,16 @@ Tile::Tile(uint8_t screenID, uint8_t numScreens,
lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, LV_OPA_20);
lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, lv_color_hex(0x111111));
- for(uint8_t i = 0; i < 6; i++) {
- if ( applications[i].application == Apps::None ) {
- lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED );
+ for (uint8_t i = 0; i < 6; i++) {
+ if (applications[i].application == Apps::None) {
+ lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED);
}
}
btnm1->user_data = this;
lv_obj_set_event_cb(btnm1, event_handler);
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
@@ -118,7 +116,7 @@ Tile::~Tile() {
}
void Tile::UpdateScreen() {
- lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
+ lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
}
@@ -126,11 +124,9 @@ bool Tile::Refresh() {
return running;
}
-void Tile::OnObjectEvent(lv_obj_t *obj, lv_event_t event, uint32_t buttonId) {
- if(event == LV_EVENT_VALUE_CHANGED) {
- app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Down);
+void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up);
running = false;
}
}
-
-
diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h
index 54ffcdae..4ebd81cd 100644
--- a/src/displayapp/screens/Tile.h
+++ b/src/displayapp/screens/Tile.h
@@ -14,42 +14,42 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
class Tile : public Screen {
- public:
- struct Applications {
- const char* icon;
- Pinetime::Applications::Apps application;
- };
-
- explicit Tile(uint8_t screenID, uint8_t numScreens,
- DisplayApp* app,
- Controllers::Settings& settingsController,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController,
- std::array<Applications, 6>& applications);
-
- ~Tile() override;
-
- bool Refresh() override;
- void UpdateScreen();
- void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId);
-
- private:
-
- Pinetime::Controllers::Battery& batteryController;
- Controllers::DateTime& dateTimeController;
-
- lv_task_t* taskUpdate;
-
- lv_obj_t* label_time;
- lv_obj_t* batteryIcon;
- lv_point_t pageIndicatorBasePoints[2];
- lv_point_t pageIndicatorPoints[2];
- lv_obj_t* pageIndicatorBase;
- lv_obj_t* pageIndicator;
- lv_obj_t* btnm1;
-
- const char* btnmMap[8];
- Pinetime::Applications::Apps apps[6];
+ public:
+ struct Applications {
+ const char* icon;
+ Pinetime::Applications::Apps application;
+ };
+
+ explicit Tile(uint8_t screenID,
+ uint8_t numScreens,
+ DisplayApp* app,
+ Controllers::Settings& settingsController,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController,
+ std::array<Applications, 6>& applications);
+
+ ~Tile() override;
+
+ bool Refresh() override;
+ void UpdateScreen();
+ void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId);
+
+ private:
+ Pinetime::Controllers::Battery& batteryController;
+ Controllers::DateTime& dateTimeController;
+
+ lv_task_t* taskUpdate;
+
+ lv_obj_t* label_time;
+ lv_obj_t* batteryIcon;
+ lv_point_t pageIndicatorBasePoints[2];
+ lv_point_t pageIndicatorPoints[2];
+ lv_obj_t* pageIndicatorBase;
+ lv_obj_t* pageIndicator;
+ lv_obj_t* btnm1;
+
+ const char* btnmMap[8];
+ Pinetime::Applications::Apps apps[6];
};
}
}
diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp
index 7a3ed1e4..eb268077 100644
--- a/src/displayapp/screens/Twos.cpp
+++ b/src/displayapp/screens/Twos.cpp
@@ -8,7 +8,7 @@
using namespace Pinetime::Applications::Screens;
-Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) {
+Twos::Twos(Pinetime::Applications::DisplayApp* app) : Screen(app) {
// create styles to apply to different valued tiles
lv_style_init(&style_cell1);
@@ -21,32 +21,37 @@ Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) {
lv_style_set_border_width(&style_cell1, LV_STATE_DEFAULT, 3);
lv_style_set_bg_opa(&style_cell1, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&style_cell1, LV_STATE_DEFAULT, lv_color_hex(0xcdc0b4));
+ lv_style_set_pad_top(&style_cell1, LV_STATE_DEFAULT, 25);
+ lv_style_set_text_color(&style_cell1, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_style_set_border_color(&style_cell2, LV_STATE_DEFAULT, lv_color_hex(0xbbada0));
lv_style_set_border_width(&style_cell2, LV_STATE_DEFAULT, 3);
lv_style_set_bg_opa(&style_cell2, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&style_cell2, LV_STATE_DEFAULT, lv_color_hex(0xefdfc6));
+ lv_style_set_pad_top(&style_cell2, LV_STATE_DEFAULT, 25);
+ lv_style_set_text_color(&style_cell2, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_style_set_border_color(&style_cell3, LV_STATE_DEFAULT, lv_color_hex(0xbbada0));
lv_style_set_border_width(&style_cell3, LV_STATE_DEFAULT, 3);
lv_style_set_bg_opa(&style_cell3, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&style_cell3, LV_STATE_DEFAULT, lv_color_hex(0xef9263));
+ lv_style_set_pad_top(&style_cell3, LV_STATE_DEFAULT, 25);
lv_style_set_border_color(&style_cell4, LV_STATE_DEFAULT, lv_color_hex(0xbbada0));
lv_style_set_border_width(&style_cell4, LV_STATE_DEFAULT, 3);
lv_style_set_bg_opa(&style_cell4, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&style_cell4, LV_STATE_DEFAULT, lv_color_hex(0xf76142));
- //lv_style_set_text_color(&style_cell4, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_style_set_pad_top(&style_cell4, LV_STATE_DEFAULT, 25);
lv_style_set_border_color(&style_cell5, LV_STATE_DEFAULT, lv_color_hex(0xbbada0));
lv_style_set_border_width(&style_cell5, LV_STATE_DEFAULT, 3);
lv_style_set_bg_opa(&style_cell5, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&style_cell5, LV_STATE_DEFAULT, lv_color_hex(0x007dc5));
- //lv_style_set_text_color(&style_cell5, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_style_set_pad_top(&style_cell5, LV_STATE_DEFAULT, 25);
// format grid display
-
- gridDisplay = lv_table_create(lv_scr_act(), nullptr);
+
+ gridDisplay = lv_table_create(lv_scr_act(), nullptr);
lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL1, &style_cell1);
lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL2, &style_cell2);
lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL3, &style_cell3);
@@ -54,17 +59,17 @@ Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) {
lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL4 + 1, &style_cell5);
lv_table_set_col_cnt(gridDisplay, 4);
lv_table_set_row_cnt(gridDisplay, 4);
- lv_table_set_col_width(gridDisplay, 0, LV_HOR_RES/4);
- lv_table_set_col_width(gridDisplay, 1, LV_HOR_RES/4);
- lv_table_set_col_width(gridDisplay, 2, LV_HOR_RES/4);
- lv_table_set_col_width(gridDisplay, 3, LV_HOR_RES/4);
+ lv_table_set_col_width(gridDisplay, 0, LV_HOR_RES / 4);
+ lv_table_set_col_width(gridDisplay, 1, LV_HOR_RES / 4);
+ lv_table_set_col_width(gridDisplay, 2, LV_HOR_RES / 4);
+ lv_table_set_col_width(gridDisplay, 3, LV_HOR_RES / 4);
lv_obj_align(gridDisplay, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_obj_clean_style_list(gridDisplay, LV_TABLE_PART_BG);
// initialize grid
- for(int row = 0; row < 4; row++) {
- for(int col = 0; col < 4; col++) {
+ for (int row = 0; row < 4; row++) {
+ for (int col = 0; col < 4; col++) {
grid[row][col].value = 0;
lv_table_set_cell_type(gridDisplay, row, col, 1);
lv_table_set_cell_align(gridDisplay, row, col, LV_LABEL_ALIGN_CENTER);
@@ -81,7 +86,7 @@ Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) {
lv_label_set_recolor(scoreText, true);
lv_label_set_text_fmt(scoreText, "Score #FFFF00 %i#", score);
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
@@ -102,10 +107,10 @@ bool Twos::Refresh() {
}
bool Twos::placeNewTile() {
- std::vector< std::pair <int,int> > availableCells;
- for(int row = 0; row < 4; row++) {
- for(int col = 0; col < 4; col++) {
- if(!grid[row][col].value) {
+ std::vector<std::pair<int, int>> availableCells;
+ for (int row = 0; row < 4; row++) {
+ for (int col = 0; col < 4; col++) {
+ if (!grid[row][col].value) {
availableCells.push_back(std::make_pair(row, col));
}
}
@@ -114,22 +119,24 @@ bool Twos::placeNewTile() {
if (availableCells.size() == 0) {
return false; // game lost
}
-
+
auto it = availableCells.cbegin();
int random = rand() % availableCells.size();
std::advance(it, random);
- std::pair <int,int> newCell = *it;
+ std::pair<int, int> newCell = *it;
- if ((rand() % 100) < 90) grid[newCell.first][newCell.second].value = 2;
- else grid[newCell.first][newCell.second].value = 4;
+ if ((rand() % 100) < 90)
+ grid[newCell.first][newCell.second].value = 2;
+ else
+ grid[newCell.first][newCell.second].value = 4;
updateGridDisplay(grid);
return true;
}
-bool Twos::tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int oldCol) {
- if((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) {
- if((newCol != oldCol) || (newRow != oldRow)) {
- if(!grid[newRow][newCol].merged) {
+bool Twos::tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol) {
+ if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) {
+ if ((newCol != oldCol) || (newRow != oldRow)) {
+ if (!grid[newRow][newCol].merged) {
unsigned int newVal = grid[oldRow][oldCol].value *= 2;
grid[newRow][newCol].value = newVal;
score += newVal;
@@ -144,7 +151,7 @@ bool Twos::tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int ol
}
bool Twos::tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol) {
- if(((newCol >= 0) && (newCol != oldCol)) || ((newRow >= 0) && (newRow != oldRow))) {
+ if (((newCol >= 0) && (newCol != oldCol)) || ((newRow >= 0) && (newRow != oldRow))) {
grid[newRow][newCol].value = grid[oldRow][oldCol].value;
grid[oldRow][oldCol].value = 0;
return true;
@@ -154,27 +161,28 @@ bool Twos::tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCo
bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
bool validMove = false;
- for(int row = 0; row < 4; row++) {
- for(int col = 0; col < 4; col++) {
+ for (int row = 0; row < 4; row++) {
+ for (int col = 0; col < 4; col++) {
grid[row][col].merged = false; // reinitialize merge state
}
}
- switch(event) {
+ switch (event) {
case TouchEvents::SwipeLeft:
- for(int col = 1; col < 4; col++) { // ignore tiles already on far left
- for(int row = 0; row < 4; row++) {
- if(grid[row][col].value) {
+ for (int col = 1; col < 4; col++) { // ignore tiles already on far left
+ for (int row = 0; row < 4; row++) {
+ if (grid[row][col].value) {
int newCol = -1;
- for(int potentialNewCol = col - 1; potentialNewCol >= 0; potentialNewCol--) {
- if(!grid[row][potentialNewCol].value) {
+ for (int potentialNewCol = col - 1; potentialNewCol >= 0; potentialNewCol--) {
+ if (!grid[row][potentialNewCol].value) {
newCol = potentialNewCol;
- }
- else { // blocked by another tile
- if(tryMerge(grid, row, potentialNewCol, row, col)) validMove = true;
+ } else { // blocked by another tile
+ if (tryMerge(grid, row, potentialNewCol, row, col))
+ validMove = true;
break;
}
}
- if(tryMove(grid, row, newCol, row, col)) validMove = true;
+ if (tryMove(grid, row, newCol, row, col))
+ validMove = true;
}
}
}
@@ -183,20 +191,21 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
return true;
case TouchEvents::SwipeRight:
- for(int col = 2; col >= 0; col--) { // ignore tiles already on far right
- for(int row = 0; row < 4; row++) {
- if(grid[row][col].value) {
+ for (int col = 2; col >= 0; col--) { // ignore tiles already on far right
+ for (int row = 0; row < 4; row++) {
+ if (grid[row][col].value) {
int newCol = -1;
- for(int potentialNewCol = col + 1; potentialNewCol < 4; potentialNewCol++) {
- if(!grid[row][potentialNewCol].value) {
+ for (int potentialNewCol = col + 1; potentialNewCol < 4; potentialNewCol++) {
+ if (!grid[row][potentialNewCol].value) {
newCol = potentialNewCol;
- }
- else { // blocked by another tile
- if(tryMerge(grid, row, potentialNewCol, row, col)) validMove = true;
+ } else { // blocked by another tile
+ if (tryMerge(grid, row, potentialNewCol, row, col))
+ validMove = true;
break;
}
}
- if(tryMove(grid, row, newCol, row, col)) validMove = true;
+ if (tryMove(grid, row, newCol, row, col))
+ validMove = true;
}
}
}
@@ -205,20 +214,21 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
return true;
case TouchEvents::SwipeUp:
- for(int row = 1; row < 4; row++) { // ignore tiles already on top
- for(int col = 0; col < 4; col++) {
- if(grid[row][col].value) {
+ for (int row = 1; row < 4; row++) { // ignore tiles already on top
+ for (int col = 0; col < 4; col++) {
+ if (grid[row][col].value) {
int newRow = -1;
- for(int potentialNewRow = row - 1; potentialNewRow >= 0; potentialNewRow--) {
- if(!grid[potentialNewRow][col].value) {
+ for (int potentialNewRow = row - 1; potentialNewRow >= 0; potentialNewRow--) {
+ if (!grid[potentialNewRow][col].value) {
newRow = potentialNewRow;
- }
- else { // blocked by another tile
- if(tryMerge(grid, potentialNewRow, col, row, col)) validMove = true;
+ } else { // blocked by another tile
+ if (tryMerge(grid, potentialNewRow, col, row, col))
+ validMove = true;
break;
}
}
- if(tryMove(grid, newRow, col, row, col)) validMove = true;
+ if (tryMove(grid, newRow, col, row, col))
+ validMove = true;
}
}
}
@@ -227,20 +237,21 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
return true;
case TouchEvents::SwipeDown:
- for(int row = 2; row >=0; row--) { // ignore tiles already on bottom
- for(int col = 0; col < 4; col++) {
- if(grid[row][col].value) {
+ for (int row = 2; row >= 0; row--) { // ignore tiles already on bottom
+ for (int col = 0; col < 4; col++) {
+ if (grid[row][col].value) {
int newRow = -1;
- for(int potentialNewRow = row + 1; potentialNewRow < 4; potentialNewRow++) {
- if(!grid[potentialNewRow][col].value) {
+ for (int potentialNewRow = row + 1; potentialNewRow < 4; potentialNewRow++) {
+ if (!grid[potentialNewRow][col].value) {
newRow = potentialNewRow;
- }
- else { // blocked by another tile
- if(tryMerge(grid, potentialNewRow, col, row, col)) validMove = true;
+ } else { // blocked by another tile
+ if (tryMerge(grid, potentialNewRow, col, row, col))
+ validMove = true;
break;
}
}
- if(tryMove(grid, newRow, col, row, col)) validMove = true;
+ if (tryMove(grid, newRow, col, row, col))
+ validMove = true;
}
}
}
@@ -255,12 +266,11 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}
void Twos::updateGridDisplay(Tile grid[][4]) {
- for(int row = 0; row < 4; row++) {
- for(int col = 0; col < 4; col++) {
+ for (int row = 0; row < 4; row++) {
+ for (int col = 0; col < 4; col++) {
if (grid[row][col].value) {
lv_table_set_cell_value(gridDisplay, row, col, (std::to_string(grid[row][col].value)).c_str());
- }
- else {
+ } else {
lv_table_set_cell_value(gridDisplay, row, col, "");
}
switch (grid[row][col].value) {
diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h
index 7223c7a8..3367618f 100644
--- a/src/displayapp/screens/Twos.h
+++ b/src/displayapp/screens/Twos.h
@@ -11,30 +11,28 @@ namespace Pinetime {
};
namespace Screens {
class Twos : public Screen {
- public:
- Twos(DisplayApp* app);
- ~Twos() override;
- bool Refresh() override;
-
- bool OnTouchEvent(TouchEvents event) override;
+ public:
+ Twos(DisplayApp* app);
+ ~Twos() override;
+ bool Refresh() override;
- private:
+ bool OnTouchEvent(TouchEvents event) override;
- lv_style_t style_cell1;
- lv_style_t style_cell2;
- lv_style_t style_cell3;
- lv_style_t style_cell4;
- lv_style_t style_cell5;
-
-
- lv_obj_t *scoreText;
- lv_obj_t *gridDisplay;
- Tile grid[4][4];
- unsigned int score = 0;
- void updateGridDisplay(Tile grid[][4]);
- bool tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int oldCol);
- bool tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol);
- bool placeNewTile();
+ private:
+ lv_style_t style_cell1;
+ lv_style_t style_cell2;
+ lv_style_t style_cell3;
+ lv_style_t style_cell4;
+ lv_style_t style_cell5;
+
+ lv_obj_t* scoreText;
+ lv_obj_t* gridDisplay;
+ Tile grid[4][4];
+ unsigned int score = 0;
+ void updateGridDisplay(Tile grid[][4]);
+ bool tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol);
+ bool tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol);
+ bool placeNewTile();
};
}
}
diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp
index 66af584a..02f1fc2a 100644
--- a/src/displayapp/screens/WatchFaceAnalog.cpp
+++ b/src/displayapp/screens/WatchFaceAnalog.cpp
@@ -14,44 +14,45 @@ using namespace Pinetime::Applications::Screens;
#define HOUR_LENGTH 70
#define MINUTE_LENGTH 90
#define SECOND_LENGTH 110
-#define PI 3.14159265358979323846
+#define PI 3.14159265358979323846
// ##
-static int16_t coordinate_x_relocate(int16_t x)
-{
- return ((x) + LV_HOR_RES / 2);
+static int16_t coordinate_x_relocate(int16_t x) {
+ return ((x) + LV_HOR_RES / 2);
}
// ##
-static int16_t coordinate_y_relocate(int16_t y)
-{
- return (((y) - LV_HOR_RES / 2) < 0) ? (0 - ((y) - LV_HOR_RES / 2)) : ((y) - LV_HOR_RES / 2);
+static int16_t coordinate_y_relocate(int16_t y) {
+ return (((y) -LV_HOR_RES / 2) < 0) ? (0 - ((y) -LV_HOR_RES / 2)) : ((y) -LV_HOR_RES / 2);
}
-WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController) : Screen(app), currentDateTime{{}},
- dateTimeController{dateTimeController}, batteryController{batteryController},
- bleController{bleController}, notificatioManager{notificatioManager},
- settingsController{settingsController} {
+WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController)
+ : Screen(app),
+ currentDateTime {{}},
+ dateTimeController {dateTimeController},
+ batteryController {batteryController},
+ bleController {bleController},
+ notificatioManager {notificatioManager},
+ settingsController {settingsController} {
settingsController.SetClockFace(1);
sHour = 99;
sMinute = 99;
- sSecond = 99;
-
- lv_obj_t * bg_clock_img = lv_img_create(lv_scr_act(), NULL);
+ sSecond = 99;
+
+ lv_obj_t* bg_clock_img = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(bg_clock_img, &bg_clock);
lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0);
- batteryIcon = lv_label_create(lv_scr_act(), nullptr);
+ batteryIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(batteryIcon, Symbols::batteryHalf);
lv_obj_align(batteryIcon, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -8, -4);
-
notificationIcon = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
@@ -61,17 +62,16 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app,
label_date_day = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xf0a500));
- lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
- lv_label_set_align( label_date_day, LV_LABEL_ALIGN_CENTER );
- lv_obj_align(label_date_day, NULL, LV_ALIGN_CENTER, 50, 0);
-
+ lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
+ lv_label_set_align(label_date_day, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_date_day, NULL, LV_ALIGN_CENTER, 50, 0);
+
minute_body = lv_line_create(lv_scr_act(), NULL);
minute_body_trace = lv_line_create(lv_scr_act(), NULL);
- hour_body = lv_line_create(lv_scr_act(), NULL);
- hour_body_trace = lv_line_create(lv_scr_act(), NULL);
+ hour_body = lv_line_create(lv_scr_act(), NULL);
+ hour_body_trace = lv_line_create(lv_scr_act(), NULL);
second_body = lv_line_create(lv_scr_act(), NULL);
-
lv_style_init(&second_line_style);
lv_style_set_line_width(&second_line_style, LV_STATE_DEFAULT, 3);
lv_style_set_line_color(&second_line_style, LV_STATE_DEFAULT, LV_COLOR_RED);
@@ -90,7 +90,6 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app,
lv_style_set_line_rounded(&minute_line_style_trace, LV_STATE_DEFAULT, false);
lv_obj_add_style(minute_body_trace, LV_LINE_PART_MAIN, &minute_line_style_trace);
-
lv_style_init(&hour_line_style);
lv_style_set_line_width(&hour_line_style, LV_STATE_DEFAULT, 7);
lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE);
@@ -104,7 +103,6 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app,
lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace);
UpdateClock();
-
}
WatchFaceAnalog::~WatchFaceAnalog() {
@@ -114,17 +112,17 @@ WatchFaceAnalog::~WatchFaceAnalog() {
lv_style_reset(&minute_line_style);
lv_style_reset(&minute_line_style_trace);
lv_style_reset(&second_line_style);
-
+
lv_obj_clean(lv_scr_act());
}
void WatchFaceAnalog::UpdateClock() {
-
+
hour = dateTimeController.Hours();
minute = dateTimeController.Minutes();
- second = dateTimeController.Seconds();
+ second = dateTimeController.Seconds();
- if(sMinute != minute) {
+ if (sMinute != minute) {
minute_point[0].x = coordinate_x_relocate(30 * sin(minute * 6 * PI / 180));
minute_point[0].y = coordinate_y_relocate(30 * cos(minute * 6 * PI / 180));
minute_point[1].x = coordinate_x_relocate(MINUTE_LENGTH * sin(minute * 6 * PI / 180));
@@ -134,40 +132,38 @@ void WatchFaceAnalog::UpdateClock() {
minute_point_trace[0].y = coordinate_y_relocate(5 * cos(minute * 6 * PI / 180));
minute_point_trace[1].x = coordinate_x_relocate(31 * sin(minute * 6 * PI / 180));
minute_point_trace[1].y = coordinate_y_relocate(31 * cos(minute * 6 * PI / 180));
-
+
lv_line_set_points(minute_body, minute_point, 2);
lv_line_set_points(minute_body_trace, minute_point_trace, 2);
}
- if(sHour != hour || sMinute != minute) {
+ if (sHour != hour || sMinute != minute) {
sHour = hour;
sMinute = minute;
- hour_point[0].x = coordinate_x_relocate(30 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point[0].y = coordinate_y_relocate(30 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point[1].x = coordinate_x_relocate(HOUR_LENGTH * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point[1].y = coordinate_y_relocate(HOUR_LENGTH * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
-
- hour_point_trace[0].x = coordinate_x_relocate(5 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point_trace[0].y = coordinate_y_relocate(5 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point_trace[1].x = coordinate_x_relocate(31 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
- hour_point_trace[1].y = coordinate_y_relocate(31 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
-
- lv_line_set_points(hour_body, hour_point, 2);
- lv_line_set_points(hour_body_trace, hour_point_trace, 2);
+ hour_point[0].x = coordinate_x_relocate(30 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point[0].y = coordinate_y_relocate(30 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point[1].x = coordinate_x_relocate(HOUR_LENGTH * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point[1].y = coordinate_y_relocate(HOUR_LENGTH * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+
+ hour_point_trace[0].x = coordinate_x_relocate(5 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point_trace[0].y = coordinate_y_relocate(5 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point_trace[1].x = coordinate_x_relocate(31 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+ hour_point_trace[1].y = coordinate_y_relocate(31 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180));
+
+ lv_line_set_points(hour_body, hour_point, 2);
+ lv_line_set_points(hour_body_trace, hour_point_trace, 2);
}
- if(sSecond != second) {
+ if (sSecond != second) {
sSecond = second;
second_point[0].x = coordinate_x_relocate(20 * sin((180 + second * 6) * PI / 180));
second_point[0].y = coordinate_y_relocate(20 * cos((180 + second * 6) * PI / 180));
second_point[1].x = coordinate_x_relocate(SECOND_LENGTH * sin(second * 6 * PI / 180));
second_point[1].y = coordinate_y_relocate(SECOND_LENGTH * cos(second * 6 * PI / 180));
lv_line_set_points(second_body, second_point, 2);
-
}
}
-
bool WatchFaceAnalog::Refresh() {
batteryPercentRemaining = batteryController.PercentRemaining();
@@ -176,11 +172,10 @@ bool WatchFaceAnalog::Refresh() {
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
}
-
notificationState = notificatioManager.AreNewNotificationsAvailable();
- if(notificationState.IsUpdated()) {
- if(notificationState.Get() == true)
+ if (notificationState.IsUpdated()) {
+ if (notificationState.Get() == true)
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
else
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
@@ -188,17 +183,17 @@ bool WatchFaceAnalog::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime();
- if(currentDateTime.IsUpdated()) {
-
+ if (currentDateTime.IsUpdated()) {
+
month = dateTimeController.Month();
day = dateTimeController.Day();
dayOfWeek = dateTimeController.DayOfWeek();
UpdateClock();
-
+
if ((month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
- lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), day);
+ lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), day);
currentMonth = month;
currentDayOfWeek = dayOfWeek;
diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h
index 56b086ab..667f6241 100644
--- a/src/displayapp/screens/WatchFaceAnalog.h
+++ b/src/displayapp/screens/WatchFaceAnalog.h
@@ -22,68 +22,67 @@ namespace Pinetime {
namespace Screens {
class WatchFaceAnalog : public Screen {
- public:
- WatchFaceAnalog(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController);
-
- ~WatchFaceAnalog() override;
+ public:
+ WatchFaceAnalog(DisplayApp* app,
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController);
- bool Refresh() override;
+ ~WatchFaceAnalog() override;
- private:
- uint8_t sHour, sMinute, sSecond;
- uint8_t hour;
- uint8_t minute;
- uint8_t second;
+ bool Refresh() override;
- Pinetime::Controllers::DateTime::Months month;
- uint8_t day;
- Pinetime::Controllers::DateTime::Days dayOfWeek;
+ private:
+ uint8_t sHour, sMinute, sSecond;
+ uint8_t hour;
+ uint8_t minute;
+ uint8_t second;
- Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
- Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
- uint8_t currentDay = 0;
+ Pinetime::Controllers::DateTime::Months month;
+ uint8_t day;
+ Pinetime::Controllers::DateTime::Days dayOfWeek;
- DirtyValue<float> batteryPercentRemaining {0};
- DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime;
- DirtyValue<bool> notificationState {false};
+ Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
+ Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
+ uint8_t currentDay = 0;
- lv_obj_t *hour_body;
- lv_obj_t *hour_body_trace;
- lv_obj_t *minute_body;
- lv_obj_t *minute_body_trace;
- lv_obj_t *second_body;
+ DirtyValue<float> batteryPercentRemaining {0};
+ DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime;
+ DirtyValue<bool> notificationState {false};
- // ##
- lv_point_t hour_point[2];
- lv_point_t hour_point_trace[2];
- lv_point_t minute_point[2];
- lv_point_t minute_point_trace[2];
- lv_point_t second_point[2];
+ lv_obj_t* hour_body;
+ lv_obj_t* hour_body_trace;
+ lv_obj_t* minute_body;
+ lv_obj_t* minute_body_trace;
+ lv_obj_t* second_body;
- // ##
- lv_style_t hour_line_style;
- lv_style_t hour_line_style_trace;
- lv_style_t minute_line_style;
- lv_style_t minute_line_style_trace;
- lv_style_t second_line_style;
-
- lv_obj_t* label_date_day;
- lv_obj_t* batteryIcon;
- lv_obj_t* notificationIcon;
-
+ // ##
+ lv_point_t hour_point[2];
+ lv_point_t hour_point_trace[2];
+ lv_point_t minute_point[2];
+ lv_point_t minute_point_trace[2];
+ lv_point_t second_point[2];
- Controllers::DateTime& dateTimeController;
- Controllers::Battery& batteryController;
- Controllers::Ble& bleController;
- Controllers::NotificationManager& notificatioManager;
- Controllers::Settings& settingsController;
+ // ##
+ lv_style_t hour_line_style;
+ lv_style_t hour_line_style_trace;
+ lv_style_t minute_line_style;
+ lv_style_t minute_line_style_trace;
+ lv_style_t second_line_style;
- void UpdateClock();
+ lv_obj_t* label_date_day;
+ lv_obj_t* batteryIcon;
+ lv_obj_t* notificationIcon;
+
+ Controllers::DateTime& dateTimeController;
+ Controllers::Battery& batteryController;
+ Controllers::Ble& bleController;
+ Controllers::NotificationManager& notificatioManager;
+ Controllers::Settings& settingsController;
+
+ void UpdateClock();
};
}
}
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index c085b0b4..f1285eaf 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -17,20 +17,23 @@
using namespace Pinetime::Applications::Screens;
-
WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController,
- Controllers::HeartRateController& heartRateController,
- Controllers::MotionController& motionController) : Screen(app), currentDateTime{{}},
- dateTimeController{dateTimeController}, batteryController{batteryController},
- bleController{bleController}, notificatioManager{notificatioManager},
- settingsController{settingsController},
- heartRateController{heartRateController},
- motionController{motionController} {
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController,
+ Controllers::HeartRateController& heartRateController,
+ Controllers::MotionController& motionController)
+ : Screen(app),
+ currentDateTime {{}},
+ dateTimeController {dateTimeController},
+ batteryController {batteryController},
+ bleController {bleController},
+ notificatioManager {notificatioManager},
+ settingsController {settingsController},
+ heartRateController {heartRateController},
+ motionController {motionController} {
settingsController.SetClockFace(0);
displayedChar[0] = 0;
@@ -62,15 +65,15 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, 60);
lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999));
- label_time = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed);
+ label_time = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed);
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0);
label_time_ampm = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(label_time_ampm, "");
- lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -30, -55);
-
+ lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -30, -55);
+
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_click(backgroundLabel, true);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
@@ -78,7 +81,6 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text(backgroundLabel, "");
-
heartbeatIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(heartbeatIcon, Symbols::heartBeat);
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
@@ -86,14 +88,9 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
- lv_label_set_text(heartbeatValue, "---");
+ lv_label_set_text(heartbeatValue, "");
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
- heartbeatBpm = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_color(heartbeatBpm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
- lv_label_set_text(heartbeatBpm, "BPM");
- lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
-
stepValue = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FFE7));
lv_label_set_text(stepValue, "0");
@@ -120,7 +117,7 @@ bool WatchFaceDigital::Refresh() {
bleState = bleController.IsConnected();
if (bleState.IsUpdated()) {
- if(bleState.Get() == true) {
+ if (bleState.Get() == true) {
lv_label_set_text(bleIcon, BleIcon::GetIcon(true));
} else {
lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
@@ -131,8 +128,8 @@ bool WatchFaceDigital::Refresh() {
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
notificationState = notificatioManager.AreNewNotificationsAvailable();
- if(notificationState.IsUpdated()) {
- if(notificationState.Get() == true)
+ if (notificationState.IsUpdated()) {
+ if (notificationState.Get() == true)
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
else
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
@@ -140,16 +137,16 @@ bool WatchFaceDigital::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime();
- if(currentDateTime.IsUpdated()) {
+ if (currentDateTime.IsUpdated()) {
auto newDateTime = currentDateTime.Get();
auto dp = date::floor<date::days>(newDateTime);
- auto time = date::make_time(newDateTime-dp);
+ auto time = date::make_time(newDateTime - dp);
auto yearMonthDay = date::year_month_day(dp);
- auto year = (int)yearMonthDay.year();
- auto month = static_cast<Pinetime::Controllers::DateTime::Months>((unsigned)yearMonthDay.month());
- auto day = (unsigned)yearMonthDay.day();
+ auto year = (int) yearMonthDay.year();
+ auto month = static_cast<Pinetime::Controllers::DateTime::Months>((unsigned) yearMonthDay.month());
+ auto day = (unsigned) yearMonthDay.day();
auto dayOfWeek = static_cast<Pinetime::Controllers::DateTime::Days>(date::weekday(yearMonthDay).iso_encoding());
int hour = time.hours().count();
@@ -160,29 +157,26 @@ bool WatchFaceDigital::Refresh() {
char hoursChar[3];
char ampmChar[3];
- if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) {
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
sprintf(hoursChar, "%02d", hour);
} else {
if (hour == 0 && hour != 12) {
- hour = 12;
- sprintf(ampmChar, "AM");
- }
- else if (hour == 12 && hour != 0) {
- hour = 12;
- sprintf(ampmChar, "PM");
- }
- else if (hour < 12 && hour != 0) {
- sprintf(ampmChar, "AM");
- }
- else if (hour > 12 && hour != 0)
- {
- hour = hour - 12;
- sprintf(ampmChar, "PM");
+ hour = 12;
+ sprintf(ampmChar, "AM");
+ } else if (hour == 12 && hour != 0) {
+ hour = 12;
+ sprintf(ampmChar, "PM");
+ } else if (hour < 12 && hour != 0) {
+ sprintf(ampmChar, "AM");
+ } else if (hour > 12 && hour != 0) {
+ hour = hour - 12;
+ sprintf(ampmChar, "PM");
}
sprintf(hoursChar, "%02d", hour);
}
- if(hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] || minutesChar[1] != displayedChar[3]) {
+ if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] ||
+ minutesChar[1] != displayedChar[3]) {
displayedChar[0] = hoursChar[0];
displayedChar[1] = hoursChar[1];
displayedChar[2] = minutesChar[0];
@@ -190,25 +184,26 @@ bool WatchFaceDigital::Refresh() {
char timeStr[6];
- if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) {
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
lv_label_set_text(label_time_ampm, ampmChar);
- if ( hoursChar[0] == '0' ) { hoursChar[0] = ' '; }
+ if (hoursChar[0] == '0') {
+ hoursChar[0] = ' ';
+ }
}
- sprintf(timeStr, "%c%c:%c%c", hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);
+ sprintf(timeStr, "%c%c:%c%c", hoursChar[0], hoursChar[1], minutesChar[0], minutesChar[1]);
lv_label_set_text(label_time, timeStr);
-
- if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) {
+
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0);
} else {
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
}
-
}
if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
char dateStr[22];
- if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) {
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
sprintf(dateStr, "%s %d %s %d", dateTimeController.DayOfWeekShortToString(), day, dateTimeController.MonthShortToString(), year);
} else {
sprintf(dateStr, "%s %s %d %d", dateTimeController.DayOfWeekShortToString(), dateTimeController.MonthShortToString(), day, year);
@@ -216,7 +211,6 @@ bool WatchFaceDigital::Refresh() {
lv_label_set_text(label_date, dateStr);
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, 60);
-
currentYear = year;
currentMonth = month;
currentDayOfWeek = dayOfWeek;
@@ -226,33 +220,26 @@ bool WatchFaceDigital::Refresh() {
heartbeat = heartRateController.HeartRate();
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
- if(heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
- char heartbeatBuffer[4];
- if(heartbeatRunning.Get())
- sprintf(heartbeatBuffer, "%d", heartbeat.Get());
- else
- sprintf(heartbeatBuffer, "---");
+ if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
+ if (heartbeatRunning.Get()) {
+ lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
+ lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
+ } else {
+ lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B));
+ lv_label_set_text_static(heartbeatValue, "");
+ }
- lv_label_set_text(heartbeatValue, heartbeatBuffer);
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
- lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
}
stepCount = motionController.NbSteps();
motionSensorOk = motionController.IsSensorOk();
- if(stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
- char stepBuffer[5];
- if(motionSensorOk.Get())
- sprintf(stepBuffer, "%lu", stepCount.Get());
- else
- sprintf(stepBuffer, "---", stepCount.Get());
- lv_label_set_text(stepValue, stepBuffer);
+ if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
+ lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get());
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
}
return running;
}
-
-
diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h
index 67d32ff6..246efc95 100644
--- a/src/displayapp/screens/WatchFaceDigital.h
+++ b/src/displayapp/screens/WatchFaceDigital.h
@@ -22,64 +22,59 @@ namespace Pinetime {
namespace Screens {
class WatchFaceDigital : public Screen {
- public:
- WatchFaceDigital(DisplayApp* app,
- Controllers::DateTime& dateTimeController,
- Controllers::Battery& batteryController,
- Controllers::Ble& bleController,
- Controllers::NotificationManager& notificatioManager,
- Controllers::Settings &settingsController,
- Controllers::HeartRateController& heartRateController,
- Controllers::MotionController& motionController);
- ~WatchFaceDigital() override;
+ public:
+ WatchFaceDigital(DisplayApp* app,
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController,
+ Controllers::NotificationManager& notificatioManager,
+ Controllers::Settings& settingsController,
+ Controllers::HeartRateController& heartRateController,
+ Controllers::MotionController& motionController);
+ ~WatchFaceDigital() override;
- bool Refresh() override;
-
+ bool Refresh() override;
- void OnObjectEvent(lv_obj_t *pObj, lv_event_t i);
- private:
+ void OnObjectEvent(lv_obj_t* pObj, lv_event_t i);
+ private:
+ char displayedChar[5];
- char displayedChar[5];
+ uint16_t currentYear = 1970;
+ Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
+ Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
+ uint8_t currentDay = 0;
- uint16_t currentYear = 1970;
- Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
- Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
- uint8_t currentDay = 0;
+ DirtyValue<int> batteryPercentRemaining {};
+ DirtyValue<bool> bleState {};
+ DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
+ DirtyValue<bool> motionSensorOk {};
+ DirtyValue<uint32_t> stepCount {};
+ DirtyValue<uint8_t> heartbeat {};
+ DirtyValue<bool> heartbeatRunning {};
+ DirtyValue<bool> notificationState {};
- DirtyValue<int> batteryPercentRemaining {};
- DirtyValue<bool> bleState {};
- DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime{};
- DirtyValue<bool> motionSensorOk {};
- DirtyValue<uint32_t> stepCount {};
- DirtyValue<uint8_t> heartbeat {};
- DirtyValue<bool> heartbeatRunning {};
- DirtyValue<bool> notificationState {};
-
- lv_obj_t* label_time;
- lv_obj_t* label_time_ampm;
- lv_obj_t* label_date;
- lv_obj_t* backgroundLabel;
- lv_obj_t* batteryIcon;
- lv_obj_t* bleIcon;
- lv_obj_t* batteryPlug;
- lv_obj_t* heartbeatIcon;
- lv_obj_t* heartbeatValue;
- lv_obj_t* heartbeatBpm;
- lv_obj_t* stepIcon;
- lv_obj_t* stepValue;
- lv_obj_t* notificationIcon;
-
- Controllers::DateTime& dateTimeController;
- Controllers::Battery& batteryController;
- Controllers::Ble& bleController;
- Controllers::NotificationManager& notificatioManager;
- Controllers::Settings& settingsController;
- Controllers::HeartRateController& heartRateController;
- Controllers::MotionController& motionController;
-
-
+ lv_obj_t* label_time;
+ lv_obj_t* label_time_ampm;
+ lv_obj_t* label_date;
+ lv_obj_t* backgroundLabel;
+ lv_obj_t* batteryIcon;
+ lv_obj_t* bleIcon;
+ lv_obj_t* batteryPlug;
+ lv_obj_t* heartbeatIcon;
+ lv_obj_t* heartbeatValue;
+ lv_obj_t* heartbeatBpm;
+ lv_obj_t* stepIcon;
+ lv_obj_t* stepValue;
+ lv_obj_t* notificationIcon;
+ Controllers::DateTime& dateTimeController;
+ Controllers::Battery& batteryController;
+ Controllers::Ble& bleController;
+ Controllers::NotificationManager& notificatioManager;
+ Controllers::Settings& settingsController;
+ Controllers::HeartRateController& heartRateController;
+ Controllers::MotionController& motionController;
};
}
}
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index 9fd051b8..3994794d 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -3,66 +3,63 @@
#include "displayapp/screens/Symbols.h"
#include "displayapp/screens/BatteryIcon.h"
-
using namespace Pinetime::Applications::Screens;
namespace {
- static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event) {
- QuickSettings* screen = static_cast<QuickSettings *>(obj->user_data);
+ static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) {
+ QuickSettings* screen = static_cast<QuickSettings*>(obj->user_data);
screen->OnButtonEvent(obj, event);
}
- static void lv_update_task(struct _lv_task_t *task) {
- auto user_data = static_cast<QuickSettings *>(task->user_data);
+ static void lv_update_task(struct _lv_task_t* task) {
+ auto user_data = static_cast<QuickSettings*>(task->user_data);
user_data->UpdateScreen();
}
}
-QuickSettings::QuickSettings(
- Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController,
- Controllers::BrightnessController& brightness,
- Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- batteryController{batteryController},
- dateTimeController{dateTimeController},
- brightness{brightness},
- settingsController{settingsController}
-{
+QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController,
+ Controllers::BrightnessController& brightness,
+ Controllers::MotorController& motorController,
+ Pinetime::Controllers::Settings& settingsController)
+ : Screen(app),
+ batteryController {batteryController},
+ dateTimeController {dateTimeController},
+ brightness {brightness},
+ motorController{motorController},
+ settingsController {settingsController} {
// Time
- label_time = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
- lv_label_set_align( label_time, LV_LABEL_ALIGN_CENTER );
+ label_time = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
+ lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 15, 4);
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 4);
-
- lv_obj_t * lbl_btn;
+ lv_obj_t* lbl_btn;
btn1 = lv_btn_create(lv_scr_act(), nullptr);
btn1->user_data = this;
lv_obj_set_event_cb(btn1, ButtonEventHandler);
- lv_obj_align(btn1, nullptr, LV_ALIGN_CENTER, -50, -30);
+ lv_obj_align(btn1, nullptr, LV_ALIGN_CENTER, -50, -30);
lv_obj_set_style_local_radius(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
- lv_obj_set_style_local_bg_color(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
+ lv_obj_set_style_local_bg_color(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_grad_dir(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
- lv_btn_set_fit2(btn1, LV_FIT_TIGHT, LV_FIT_TIGHT);
+ lv_btn_set_fit2(btn1, LV_FIT_TIGHT, LV_FIT_TIGHT);
btn1_lvl = lv_label_create(btn1, nullptr);
lv_obj_set_style_local_text_font(btn1_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
lv_label_set_text_static(btn1_lvl, brightness.GetIcon());
-
btn2 = lv_btn_create(lv_scr_act(), nullptr);
btn2->user_data = this;
lv_obj_set_event_cb(btn2, ButtonEventHandler);
- lv_obj_align(btn2, nullptr, LV_ALIGN_CENTER, 50, -30);
+ lv_obj_align(btn2, nullptr, LV_ALIGN_CENTER, 50, -30);
lv_obj_set_style_local_radius(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
lv_obj_set_style_local_bg_color(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_grad_dir(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
@@ -71,7 +68,6 @@ QuickSettings::QuickSettings(
lbl_btn = lv_label_create(btn2, nullptr);
lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
lv_label_set_text_static(lbl_btn, Symbols::highlight);
-
btn3 = lv_btn_create(lv_scr_act(), nullptr);
btn3->user_data = this;
@@ -86,9 +82,9 @@ QuickSettings::QuickSettings(
lv_btn_set_fit2(btn3, LV_FIT_TIGHT, LV_FIT_TIGHT);
btn3_lvl = lv_label_create(btn3, nullptr);
- lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
+ lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
- if ( settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::ON ) {
+ if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::ON) {
lv_obj_add_state(btn3, LV_STATE_CHECKED);
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
} else {
@@ -98,7 +94,7 @@ QuickSettings::QuickSettings(
btn4 = lv_btn_create(lv_scr_act(), nullptr);
btn4->user_data = this;
lv_obj_set_event_cb(btn4, ButtonEventHandler);
- lv_obj_align(btn4, nullptr, LV_ALIGN_CENTER, 50, 60);
+ lv_obj_align(btn4, nullptr, LV_ALIGN_CENTER, 50, 60);
lv_obj_set_style_local_radius(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20);
lv_obj_set_style_local_bg_color(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_grad_dir(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE);
@@ -108,17 +104,15 @@ QuickSettings::QuickSettings(
lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
lv_label_set_text_static(lbl_btn, Symbols::settings);
- lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text_static(backgroundLabel, "");
taskUpdate = lv_task_create(lv_update_task, 500000, LV_TASK_PRIO_MID, this);
-
}
-
QuickSettings::~QuickSettings() {
lv_task_del(taskUpdate);
lv_obj_clean(lv_scr_act());
@@ -126,39 +120,38 @@ QuickSettings::~QuickSettings() {
}
void QuickSettings::UpdateScreen() {
- lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
+ lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes());
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
}
-void QuickSettings::OnButtonEvent(lv_obj_t *object, lv_event_t event) {
- if(object == btn2 && event == LV_EVENT_PRESSED) {
-
+void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
+ if (object == btn2 && event == LV_EVENT_PRESSED) {
+
running = false;
app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::None);
- } else if(object == btn1 && event == LV_EVENT_PRESSED) {
-
+ } else if (object == btn1 && event == LV_EVENT_PRESSED) {
+
brightness.Step();
lv_label_set_text_static(btn1_lvl, brightness.GetIcon());
- settingsController.SetBrightness( brightness.Level() );
+ settingsController.SetBrightness(brightness.Level());
+
+ } else if (object == btn3 && event == LV_EVENT_VALUE_CHANGED) {
- } else if(object == btn3 && event == LV_EVENT_VALUE_CHANGED) {
-
- if(lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
- settingsController.SetVibrationStatus( Controllers::Settings::Vibration::ON );
+ if (lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
+ settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON);
+ motorController.SetDuration(35);
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
} else {
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF);
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOff);
}
- } else if(object == btn4 && event == LV_EVENT_PRESSED) {
+ } else if (object == btn4 && event == LV_EVENT_PRESSED) {
running = false;
settingsController.SetSettingsMenu(0);
app->StartApp(Apps::Settings, DisplayApp::FullRefreshDirections::Up);
-
}
-
}
bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h
index 329be55b..a14f46bf 100644
--- a/src/displayapp/screens/settings/QuickSettings.h
+++ b/src/displayapp/screens/settings/QuickSettings.h
@@ -7,50 +7,50 @@
#include <lvgl/lvgl.h>
#include "components/datetime/DateTimeController.h"
#include "components/brightness/BrightnessController.h"
+#include "components/motor/MotorController.h"
#include "components/settings/Settings.h"
#include "components/battery/BatteryController.h"
-
namespace Pinetime {
namespace Applications {
namespace Screens {
- class QuickSettings : public Screen{
- public:
- QuickSettings(DisplayApp* app,
- Pinetime::Controllers::Battery& batteryController,
- Controllers::DateTime& dateTimeController,
- Controllers::BrightnessController& brightness,
- Pinetime::Controllers::Settings &settingsController);
-
- ~QuickSettings() override;
-
- bool Refresh() override;
-
- bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
- void OnButtonEvent(lv_obj_t *object, lv_event_t event);
-
- void UpdateScreen();
-
- private:
-
- Pinetime::Controllers::Battery& batteryController;
- Controllers::DateTime& dateTimeController;
- Controllers::BrightnessController& brightness;
- Controllers::Settings& settingsController;
-
- lv_task_t* taskUpdate;
- lv_obj_t * batteryIcon;
- lv_obj_t * label_time;
-
- lv_obj_t * btn1;
- lv_obj_t * btn1_lvl;
- lv_obj_t * btn2;
- lv_obj_t * btn3;
- lv_obj_t * btn3_lvl;
- lv_obj_t * btn4;
-
+ class QuickSettings : public Screen {
+ public:
+ QuickSettings(DisplayApp* app,
+ Pinetime::Controllers::Battery& batteryController,
+ Controllers::DateTime& dateTimeController,
+ Controllers::BrightnessController& brightness,
+ Controllers::MotorController& motorController,
+ Pinetime::Controllers::Settings& settingsController);
+
+ ~QuickSettings() override;
+
+ bool Refresh() override;
+
+ bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
+ void OnButtonEvent(lv_obj_t* object, lv_event_t event);
+
+ void UpdateScreen();
+
+ private:
+ Pinetime::Controllers::Battery& batteryController;
+ Controllers::DateTime& dateTimeController;
+ Controllers::BrightnessController& brightness;
+ Controllers::MotorController& motorController;
+ Controllers::Settings& settingsController;
+
+ lv_task_t* taskUpdate;
+ lv_obj_t* batteryIcon;
+ lv_obj_t* label_time;
+
+ lv_obj_t* btn1;
+ lv_obj_t* btn1_lvl;
+ lv_obj_t* btn2;
+ lv_obj_t* btn3;
+ lv_obj_t* btn3_lvl;
+ lv_obj_t* btn4;
};
}
}
diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp
index 6c1bc9b5..4954185d 100644
--- a/src/displayapp/screens/settings/SettingDisplay.cpp
+++ b/src/displayapp/screens/settings/SettingDisplay.cpp
@@ -8,19 +8,16 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- SettingDisplay* screen = static_cast<SettingDisplay *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ SettingDisplay* screen = static_cast<SettingDisplay*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
}
-SettingDisplay::SettingDisplay(
- Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController}
-{
+SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app), settingsController {settingsController} {
- lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
+ lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
@@ -32,31 +29,31 @@ SettingDisplay::SettingDisplay(
lv_obj_set_height(container1, LV_VER_RES - 50);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title,"Display timeout");
+ lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(title, "Display timeout");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15);
- lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_text_static(icon, Symbols::sun);
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0);
-
+
optionsTotal = 0;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " 5 seconds");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetScreenTimeOut() == 5000 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetScreenTimeOut() == 5000) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " 15 seconds");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetScreenTimeOut() == 15000 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetScreenTimeOut() == 15000) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -64,7 +61,7 @@ SettingDisplay::SettingDisplay(
lv_checkbox_set_text_static(cbOption[optionsTotal], " 20 seconds");
cbOption[optionsTotal]->user_data = this;
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetScreenTimeOut() == 20000 ) {
+ if (settingsController.GetScreenTimeOut() == 20000) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -72,7 +69,7 @@ SettingDisplay::SettingDisplay(
lv_checkbox_set_text_static(cbOption[optionsTotal], " 30 seconds");
cbOption[optionsTotal]->user_data = this;
lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetScreenTimeOut() == 30000 ) {
+ if (settingsController.GetScreenTimeOut() == 30000) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -87,18 +84,25 @@ bool SettingDisplay::Refresh() {
return running;
}
-
-void SettingDisplay::UpdateSelected(lv_obj_t *object, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
- for(int i = 0; i < optionsTotal; i++) {
- if ( object == cbOption[i] ) {
+void SettingDisplay::UpdateSelected(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ for (int i = 0; i < optionsTotal; i++) {
+ if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
-
- if ( i == 0 ) { settingsController.SetScreenTimeOut(5000); };
- if ( i == 1 ) { settingsController.SetScreenTimeOut(15000); };
- if ( i == 2 ) { settingsController.SetScreenTimeOut(20000); };
- if ( i == 3 ) { settingsController.SetScreenTimeOut(30000); };
-
+
+ if (i == 0) {
+ settingsController.SetScreenTimeOut(5000);
+ };
+ if (i == 1) {
+ settingsController.SetScreenTimeOut(15000);
+ };
+ if (i == 2) {
+ settingsController.SetScreenTimeOut(20000);
+ };
+ if (i == 3) {
+ settingsController.SetScreenTimeOut(30000);
+ };
+
app->PushMessage(Applications::Display::Messages::UpdateTimeOut);
} else {
diff --git a/src/displayapp/screens/settings/SettingDisplay.h b/src/displayapp/screens/settings/SettingDisplay.h
index 9565d3c7..b8ed87ec 100644
--- a/src/displayapp/screens/settings/SettingDisplay.h
+++ b/src/displayapp/screens/settings/SettingDisplay.h
@@ -10,20 +10,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class SettingDisplay : public Screen{
- public:
- SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
- ~SettingDisplay() override;
+ class SettingDisplay : public Screen {
+ public:
+ SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~SettingDisplay() override;
- bool Refresh() override;
- void UpdateSelected(lv_obj_t *object, lv_event_t event);
-
- private:
+ bool Refresh() override;
+ void UpdateSelected(lv_obj_t* object, lv_event_t event);
- Controllers::Settings& settingsController;
- uint8_t optionsTotal;
- lv_obj_t * cbOption[4];
-
+ private:
+ Controllers::Settings& settingsController;
+ uint8_t optionsTotal;
+ lv_obj_t* cbOption[4];
};
}
}
diff --git a/src/displayapp/screens/settings/SettingTimeFormat.cpp b/src/displayapp/screens/settings/SettingTimeFormat.cpp
index ff217bda..031a2a72 100644
--- a/src/displayapp/screens/settings/SettingTimeFormat.cpp
+++ b/src/displayapp/screens/settings/SettingTimeFormat.cpp
@@ -7,19 +7,16 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- SettingTimeFormat* screen = static_cast<SettingTimeFormat *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ SettingTimeFormat* screen = static_cast<SettingTimeFormat*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
}
-SettingTimeFormat::SettingTimeFormat(
- Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController}
-{
+SettingTimeFormat::SettingTimeFormat(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app), settingsController {settingsController} {
- lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
+ lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
@@ -31,12 +28,12 @@ SettingTimeFormat::SettingTimeFormat(
lv_obj_set_height(container1, LV_VER_RES - 50);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title,"Time format");
+ lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(title, "Time format");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
- lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_text_static(icon, Symbols::clock);
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
@@ -46,8 +43,8 @@ SettingTimeFormat::SettingTimeFormat(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " 12-hour");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
@@ -55,8 +52,8 @@ SettingTimeFormat::SettingTimeFormat(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " 24-hour");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -71,16 +68,19 @@ bool SettingTimeFormat::Refresh() {
return running;
}
-
-void SettingTimeFormat::UpdateSelected(lv_obj_t *object, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
- for(int i = 0; i < optionsTotal; i++) {
- if ( object == cbOption[i] ) {
+void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ for (int i = 0; i < optionsTotal; i++) {
+ if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
-
- if ( i == 0 ) { settingsController.SetClockType(Controllers::Settings::ClockType::H12); };
- if ( i == 1 ) { settingsController.SetClockType(Controllers::Settings::ClockType::H24); };
-
+
+ if (i == 0) {
+ settingsController.SetClockType(Controllers::Settings::ClockType::H12);
+ };
+ if (i == 1) {
+ settingsController.SetClockType(Controllers::Settings::ClockType::H24);
+ };
+
} else {
lv_checkbox_set_checked(cbOption[i], false);
}
diff --git a/src/displayapp/screens/settings/SettingTimeFormat.h b/src/displayapp/screens/settings/SettingTimeFormat.h
index a6380493..9203b45b 100644
--- a/src/displayapp/screens/settings/SettingTimeFormat.h
+++ b/src/displayapp/screens/settings/SettingTimeFormat.h
@@ -10,20 +10,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class SettingTimeFormat : public Screen{
- public:
- SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
- ~SettingTimeFormat() override;
+ class SettingTimeFormat : public Screen {
+ public:
+ SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~SettingTimeFormat() override;
- bool Refresh() override;
- void UpdateSelected(lv_obj_t *object, lv_event_t event);
-
- private:
+ bool Refresh() override;
+ void UpdateSelected(lv_obj_t* object, lv_event_t event);
- Controllers::Settings& settingsController;
- uint8_t optionsTotal;
- lv_obj_t * cbOption[2];
-
+ private:
+ Controllers::Settings& settingsController;
+ uint8_t optionsTotal;
+ lv_obj_t* cbOption[2];
};
}
}
diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp
index 927a9e3a..89f0c098 100644
--- a/src/displayapp/screens/settings/SettingWakeUp.cpp
+++ b/src/displayapp/screens/settings/SettingWakeUp.cpp
@@ -8,19 +8,16 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- SettingWakeUp* screen = static_cast<SettingWakeUp *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ SettingWakeUp* screen = static_cast<SettingWakeUp*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
}
-SettingWakeUp::SettingWakeUp(
- Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController}
-{
+SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app), settingsController {settingsController} {
- lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
+ lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
@@ -32,12 +29,12 @@ SettingWakeUp::SettingWakeUp(
lv_obj_set_height(container1, LV_VER_RES - 50);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title,"Wake Up");
+ lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(title, "Wake Up");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15);
- lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_text_static(icon, Symbols::clock);
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
@@ -47,32 +44,32 @@ SettingWakeUp::SettingWakeUp(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " None");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Single Tap");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Double Tap");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Raise Wrist");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
optionsTotal++;
@@ -87,18 +84,25 @@ bool SettingWakeUp::Refresh() {
return running;
}
-
-void SettingWakeUp::UpdateSelected(lv_obj_t *object, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
- for(int i = 0; i < optionsTotal; i++) {
- if ( object == cbOption[i] ) {
+void SettingWakeUp::UpdateSelected(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ for (int i = 0; i < optionsTotal; i++) {
+ if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
-
- if ( i == 0 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::None); };
- if ( i == 1 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::SingleTap); };
- if ( i == 2 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap); };
- if ( i == 3 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist); };
-
+
+ if (i == 0) {
+ settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::None);
+ };
+ if (i == 1) {
+ settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::SingleTap);
+ };
+ if (i == 2) {
+ settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap);
+ };
+ if (i == 3) {
+ settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist);
+ };
+
} else {
lv_checkbox_set_checked(cbOption[i], false);
}
diff --git a/src/displayapp/screens/settings/SettingWakeUp.h b/src/displayapp/screens/settings/SettingWakeUp.h
index 86b52837..8b33eb06 100644
--- a/src/displayapp/screens/settings/SettingWakeUp.h
+++ b/src/displayapp/screens/settings/SettingWakeUp.h
@@ -10,20 +10,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class SettingWakeUp : public Screen{
- public:
- SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
- ~SettingWakeUp() override;
+ class SettingWakeUp : public Screen {
+ public:
+ SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~SettingWakeUp() override;
- bool Refresh() override;
- void UpdateSelected(lv_obj_t *object, lv_event_t event);
-
- private:
+ bool Refresh() override;
+ void UpdateSelected(lv_obj_t* object, lv_event_t event);
- Controllers::Settings& settingsController;
- uint8_t optionsTotal;
- lv_obj_t * cbOption[4];
-
+ private:
+ Controllers::Settings& settingsController;
+ uint8_t optionsTotal;
+ lv_obj_t* cbOption[4];
};
}
}
diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp
index f763acd4..457cebf6 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.cpp
+++ b/src/displayapp/screens/settings/SettingWatchFace.cpp
@@ -7,21 +7,18 @@
using namespace Pinetime::Applications::Screens;
namespace {
- static void event_handler(lv_obj_t * obj, lv_event_t event) {
- SettingWatchFace* screen = static_cast<SettingWatchFace *>(obj->user_data);
+ static void event_handler(lv_obj_t* obj, lv_event_t event) {
+ SettingWatchFace* screen = static_cast<SettingWatchFace*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
}
-SettingWatchFace::SettingWatchFace(
- Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController}
-{
+SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app), settingsController {settingsController} {
- lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr);
+ lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
- //lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
+ // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
@@ -32,12 +29,12 @@ SettingWatchFace::SettingWatchFace(
lv_obj_set_height(container1, LV_VER_RES - 50);
lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT);
- lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(title,"Watch face");
+ lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
+ lv_label_set_text_static(title, "Watch face");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15);
- lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_text_static(icon, Symbols::clock);
lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER);
@@ -47,8 +44,8 @@ SettingWatchFace::SettingWatchFace(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Digital face");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetClockFace() == 0 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetClockFace() == 0) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
@@ -56,8 +53,8 @@ SettingWatchFace::SettingWatchFace(
cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr);
lv_checkbox_set_text_static(cbOption[optionsTotal], " Analog face");
cbOption[optionsTotal]->user_data = this;
- lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
- if (settingsController.GetClockFace() == 1 ) {
+ lv_obj_set_event_cb(cbOption[optionsTotal], event_handler);
+ if (settingsController.GetClockFace() == 1) {
lv_checkbox_set_checked(cbOption[optionsTotal], true);
}
@@ -73,11 +70,10 @@ bool SettingWatchFace::Refresh() {
return running;
}
-
-void SettingWatchFace::UpdateSelected(lv_obj_t *object, lv_event_t event) {
- if(event == LV_EVENT_VALUE_CHANGED) {
- for(uint8_t i = 0; i < optionsTotal; i++) {
- if ( object == cbOption[i] ) {
+void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) {
+ if (event == LV_EVENT_VALUE_CHANGED) {
+ for (uint8_t i = 0; i < optionsTotal; i++) {
+ if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
settingsController.SetClockFace(i);
} else {
diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h
index 8c30ed28..1930a228 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.h
+++ b/src/displayapp/screens/settings/SettingWatchFace.h
@@ -10,20 +10,18 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class SettingWatchFace : public Screen{
- public:
- SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
- ~SettingWatchFace() override;
+ class SettingWatchFace : public Screen {
+ public:
+ SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~SettingWatchFace() override;
- bool Refresh() override;
- void UpdateSelected(lv_obj_t *object, lv_event_t event);
-
- private:
+ bool Refresh() override;
+ void UpdateSelected(lv_obj_t* object, lv_event_t event);
- Controllers::Settings& settingsController;
- uint8_t optionsTotal;
- lv_obj_t * cbOption[2];
-
+ private:
+ Controllers::Settings& settingsController;
+ uint8_t optionsTotal;
+ lv_obj_t* cbOption[2];
};
}
}
diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp
index b2825915..e24be3d7 100644
--- a/src/displayapp/screens/settings/Settings.cpp
+++ b/src/displayapp/screens/settings/Settings.cpp
@@ -8,27 +8,27 @@
using namespace Pinetime::Applications::Screens;
-Settings::Settings(
- Pinetime::Applications::DisplayApp *app,
- Pinetime::Controllers::Settings &settingsController) :
- Screen(app),
- settingsController{settingsController},
- screens{app,
- settingsController.GetSettingsMenu(),
- {
- [this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
- [this]() -> std::unique_ptr<Screen> { return CreateScreen2(); }
- },
- Screens::ScreenListModes::UpDown
- } {}
+Settings::Settings(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
+ : Screen(app),
+ settingsController {settingsController},
+ screens {app,
+ settingsController.GetSettingsMenu(),
+ {[this]() -> std::unique_ptr<Screen> {
+ return CreateScreen1();
+ },
+ [this]() -> std::unique_ptr<Screen> {
+ return CreateScreen2();
+ }},
+ Screens::ScreenListModes::UpDown} {
+}
Settings::~Settings() {
lv_obj_clean(lv_scr_act());
}
bool Settings::Refresh() {
-
- if(running)
+
+ if (running)
running = screens.Refresh();
return running;
}
@@ -39,29 +39,26 @@ bool Settings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
std::unique_ptr<Screen> Settings::CreateScreen1() {
- std::array<Screens::List::Applications, 4> applications {
- {
- {Symbols::sun, "Display", Apps::SettingDisplay},
- {Symbols::clock, "Wake Up", Apps::SettingWakeUp},
- {Symbols::clock, "Time format", Apps::SettingTimeFormat},
- {Symbols::clock, "Watch face", Apps::SettingWatchFace},
- }
+ std::array<Screens::List::Applications, 4> applications {{
+ {Symbols::sun, "Display", Apps::SettingDisplay},
+ {Symbols::clock, "Wake Up", Apps::SettingWakeUp},
+ {Symbols::clock, "Time format", Apps::SettingTimeFormat},
+ {Symbols::clock, "Watch face", Apps::SettingWatchFace},
+ }
};
return std::unique_ptr<Screen>(new Screens::List(0, 2, app, settingsController, applications));
}
-
std::unique_ptr<Screen> Settings::CreateScreen2() {
- std::array<Screens::List::Applications, 4> applications {
- {
- {Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
- {Symbols::check, "Firmware", Apps::FirmwareValidation},
- {Symbols::list, "About", Apps::SysInfo},
- {"", "", Apps::None},
- }
+ std::array<Screens::List::Applications, 4> applications {{
+ {Symbols::batteryHalf, "Battery", Apps::BatteryInfo},
+ {Symbols::check, "Firmware", Apps::FirmwareValidation},
+ {Symbols::list, "About", Apps::SysInfo},
+ {"", "", Apps::None},
+ }
};
diff --git a/src/displayapp/screens/settings/Settings.h b/src/displayapp/screens/settings/Settings.h
index 9955e1d4..7e332dfe 100644
--- a/src/displayapp/screens/settings/Settings.h
+++ b/src/displayapp/screens/settings/Settings.h
@@ -6,31 +6,26 @@
namespace Pinetime {
-
namespace Applications {
namespace Screens {
- class Settings : public Screen{
- public:
- Settings(DisplayApp* app,
- Pinetime::Controllers::Settings &settingsController);
- ~Settings() override;
-
- bool Refresh() override;
-
- void OnButtonEvent(lv_obj_t *object, lv_event_t event);
- bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
+ class Settings : public Screen {
+ public:
+ Settings(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
+ ~Settings() override;
- private:
+ bool Refresh() override;
- Controllers::Settings& settingsController;
-
- ScreenList<2> screens;
+ void OnButtonEvent(lv_obj_t* object, lv_event_t event);
+ bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
- std::unique_ptr<Screen> CreateScreen1();
- std::unique_ptr<Screen> CreateScreen2();
+ private:
+ Controllers::Settings& settingsController;
+ ScreenList<2> screens;
+ std::unique_ptr<Screen> CreateScreen1();
+ std::unique_ptr<Screen> CreateScreen2();
};
}
}