summaryrefslogtreecommitdiff
path: root/src/displayapp/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens')
-rw-r--r--src/displayapp/screens/Clock.cpp30
-rw-r--r--src/displayapp/screens/Clock.h4
-rw-r--r--src/displayapp/screens/FlashLight.cpp4
-rw-r--r--src/displayapp/screens/HeartRate.cpp8
-rw-r--r--src/displayapp/screens/Navigation.cpp137
-rw-r--r--src/displayapp/screens/Navigation.h101
-rw-r--r--src/displayapp/screens/ScreenList.h13
-rw-r--r--src/displayapp/screens/SystemInfo.cpp16
-rw-r--r--src/displayapp/screens/SystemInfo.h3
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp4
-rw-r--r--src/displayapp/screens/settings/Settings.cpp4
-rw-r--r--src/displayapp/screens/settings/Settings.h1
12 files changed, 164 insertions, 161 deletions
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp
index 14299840..05e47a39 100644
--- a/src/displayapp/screens/Clock.cpp
+++ b/src/displayapp/screens/Clock.cpp
@@ -33,21 +33,17 @@ Clock::Clock(DisplayApp* app,
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} {
-
+ screen {[this, &settingsController]() {
+ switch (settingsController.GetClockFace()) {
+ case 0:
+ return WatchFaceDigitalScreen();
+ break;
+ case 1:
+ return WatchFaceAnalogScreen();
+ break;
+ }
+ return WatchFaceDigitalScreen();
+ }()} {
settingsController.SetAppMenu(0);
}
@@ -56,12 +52,12 @@ Clock::~Clock() {
}
bool Clock::Refresh() {
- screens.Refresh();
+ screen->Refresh();
return running;
}
bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- return screens.OnTouchEvent(event);
+ return screen->OnTouchEvent(event);
}
std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h
index 9879985f..174c73b7 100644
--- a/src/displayapp/screens/Clock.h
+++ b/src/displayapp/screens/Clock.h
@@ -4,8 +4,8 @@
#include <chrono>
#include <cstdint>
#include <memory>
+#include <components/heartrate/HeartRateController.h>
#include "Screen.h"
-#include "ScreenList.h"
#include "components/datetime/DateTimeController.h"
namespace Pinetime {
@@ -47,7 +47,7 @@ namespace Pinetime {
Controllers::HeartRateController& heartRateController;
Controllers::MotionController& motionController;
- ScreenList<2> screens;
+ std::unique_ptr<Screen> screen;
std::unique_ptr<Screen> WatchFaceDigitalScreen();
std::unique_ptr<Screen> WatchFaceAnalogScreen();
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index 4568db40..7db2c6c8 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -39,14 +39,14 @@ FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app,
backgroundAction->user_data = this;
lv_obj_set_event_cb(backgroundAction, event_handler);
- systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
+ systemTask.PushMessage(Pinetime::System::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));
brightness.Restore();
- systemTask.PushMessage(Pinetime::System::SystemTask::Messages::EnableSleeping);
+ systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping);
}
void FlashLight::OnClickEvent(lv_obj_t* obj, lv_event_t event) {
diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp
index 90f6bc26..5689b63e 100644
--- a/src/displayapp/screens/HeartRate.cpp
+++ b/src/displayapp/screens/HeartRate.cpp
@@ -63,12 +63,12 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app,
label_startStop = lv_label_create(btn_startStop, nullptr);
UpdateStartStopButton(isHrRunning);
if (isHrRunning)
- systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
+ systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping);
}
HeartRate::~HeartRate() {
lv_obj_clean(lv_scr_act());
- systemTask.PushMessage(Pinetime::System::SystemTask::Messages::EnableSleeping);
+ systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping);
}
bool HeartRate::Refresh() {
@@ -95,12 +95,12 @@ void HeartRate::OnStartStopEvent(lv_event_t event) {
if (heartRateController.State() == Controllers::HeartRateController::States::Stopped) {
heartRateController.Start();
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
- systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
+ systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping);
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
} else {
heartRateController.Stop();
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
- systemTask.PushMessage(Pinetime::System::SystemTask::Messages::EnableSleeping);
+ systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping);
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
}
}
diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp
index b5ce8b83..79b04e21 100644
--- a/src/displayapp/screens/Navigation.cpp
+++ b/src/displayapp/screens/Navigation.cpp
@@ -24,6 +24,106 @@ using namespace Pinetime::Applications::Screens;
LV_FONT_DECLARE(lv_font_navi_80)
+namespace {
+ constexpr std::array<std::pair<const char*, const char*>, 86> 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"},
+ }};
+
+ const char* iconForName(const std::string& icon) {
+ for (auto iter : m_iconMap) {
+ if (iter.first == icon) {
+ return iter.second;
+ }
+ }
+ return "\xEE\xA4\x90";
+ }
+}
+
/**
* Navigation watchapp
*
@@ -68,27 +168,25 @@ Navigation::~Navigation() {
}
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));
+ if (flag != navService.getFlag()) {
+ flag = navService.getFlag();
+ lv_label_set_text(imgFlag, iconForName(flag));
}
- if (m_narrative != navService.getNarrative()) {
- m_narrative = navService.getNarrative();
- lv_label_set_text(txtNarrative, m_narrative.data());
+ if (narrative != navService.getNarrative()) {
+ narrative = navService.getNarrative();
+ lv_label_set_text(txtNarrative, narrative.data());
}
- if (m_manDist != navService.getManDist()) {
- m_manDist = navService.getManDist();
- lv_label_set_text(txtManDist, m_manDist.data());
+ if (manDist != navService.getManDist()) {
+ manDist = navService.getManDist();
+ lv_label_set_text(txtManDist, manDist.data());
}
- if (m_progress != navService.getProgress()) {
- m_progress = navService.getProgress();
- lv_bar_set_value(barProgress, m_progress, LV_ANIM_OFF);
- if (m_progress > 90) {
+ if (progress != navService.getProgress()) {
+ progress = navService.getProgress();
+ lv_bar_set_value(barProgress, progress, LV_ANIM_OFF);
+ if (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);
@@ -98,11 +196,4 @@ bool Navigation::Refresh() {
return running;
}
-const char* Navigation::iconForName(std::string icon) {
- for (auto iter : m_iconMap) {
- if (iter.first == icon) {
- return iter.second;
- }
- }
- return "\xEE\xA4\x90";
-}
+
diff --git a/src/displayapp/screens/Navigation.h b/src/displayapp/screens/Navigation.h
index 46816c33..eb7e00c4 100644
--- a/src/displayapp/screens/Navigation.h
+++ b/src/displayapp/screens/Navigation.h
@@ -45,103 +45,10 @@ namespace Pinetime {
Pinetime::Controllers::NavigationService& navService;
- std::string m_flag;
- std::string m_narrative;
- std::string m_manDist;
- 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::string flag;
+ std::string narrative;
+ std::string manDist;
+ int progress;
};
}
}
diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h
index 73ea4610..ea66bfb2 100644
--- a/src/displayapp/screens/ScreenList.h
+++ b/src/displayapp/screens/ScreenList.h
@@ -15,12 +15,17 @@ namespace Pinetime {
public:
ScreenList(DisplayApp* app,
uint8_t initScreen,
- std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens,
+ const 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;
+ : Screen(app), initScreen {initScreen}, screens {std::move(screens)}, mode {mode}, screenIndex{initScreen}, current {this->screens[initScreen]()} {
+
}
+ ScreenList(const ScreenList&) = delete;
+ ScreenList& operator=(const ScreenList&) = delete;
+ ScreenList(ScreenList&&) = delete;
+ ScreenList& operator=(ScreenList&&) = delete;
+
~ScreenList() override {
lv_obj_clean(lv_scr_act());
}
@@ -97,7 +102,7 @@ namespace Pinetime {
private:
uint8_t initScreen = 0;
- std::array<std::function<std::unique_ptr<Screen>()>, N> screens;
+ const std::array<std::function<std::unique_ptr<Screen>()>, N> screens;
ScreenListModes mode = ScreenListModes::UpDown;
uint8_t screenIndex = 0;
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index e4ef6911..9ff28288 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -81,7 +81,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen1() {
__TIME__);
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
- return std::unique_ptr<Screen>(new Screens::Label(0, 5, app, label));
+ return std::make_unique<Screens::Label>(0, 5, app, label);
}
std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
@@ -161,7 +161,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
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));
+ return std::make_unique<Screens::Label>(1, 5, app, label);
}
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
@@ -175,8 +175,9 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
"#444444 BLE MAC#\n"
" %02x:%02x:%02x:%02x:%02x:%02x"
"\n"
- "#444444 Memory#\n"
+ "#444444 LVGL Memory#\n"
" #444444 used# %d (%d%%)\n"
+ " #444444 max used# %d\n"
" #444444 frag# %d%%\n"
" #444444 free# %d"
"\n"
@@ -189,14 +190,15 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
bleAddr[0],
(int) mon.total_size - mon.free_size,
mon.used_pct,
+ mon.max_used,
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));
+ return std::make_unique<Screens::Label>(2, 5, app, label);
}
-bool sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) {
+bool SystemInfo::sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) {
return lhs.xTaskNumber < rhs.xTaskNumber;
}
@@ -227,7 +229,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
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));
+ return std::make_unique<Screens::Label>(3, 5, app, infoTask);
}
std::unique_ptr<Screen> SystemInfo::CreateScreen5() {
@@ -243,5 +245,5 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen5() {
"#FFFF00 JF002/InfiniTime#");
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
- return std::unique_ptr<Screen>(new Screens::Label(4, 5, app, label));
+ return std::make_unique<Screens::Label>(4, 5, app, label);
}
diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h
index c0c65554..c61a07a2 100644
--- a/src/displayapp/screens/SystemInfo.h
+++ b/src/displayapp/screens/SystemInfo.h
@@ -43,6 +43,9 @@ namespace Pinetime {
Pinetime::Drivers::WatchdogView& watchdog;
ScreenList<5> screens;
+
+ static bool sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs);
+
std::unique_ptr<Screen> CreateScreen1();
std::unique_ptr<Screen> CreateScreen2();
std::unique_ptr<Screen> CreateScreen3();
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index 3994794d..5db7468c 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -7,12 +7,12 @@ 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);
+ auto* 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);
+ auto* user_data = static_cast<QuickSettings*>(task->user_data);
user_data->UpdateScreen();
}
}
diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp
index 2c72c832..e63a3584 100644
--- a/src/displayapp/screens/settings/Settings.cpp
+++ b/src/displayapp/screens/settings/Settings.cpp
@@ -46,7 +46,7 @@ std::unique_ptr<Screen> Settings::CreateScreen1() {
{Symbols::clock, "Watch face", Apps::SettingWatchFace},
}};
- return std::unique_ptr<Screen>(new Screens::List(0, 2, app, settingsController, applications));
+ return std::make_unique<Screens::List>(0, 2, app, settingsController, applications);
}
std::unique_ptr<Screen> Settings::CreateScreen2() {
@@ -58,5 +58,5 @@ std::unique_ptr<Screen> Settings::CreateScreen2() {
{Symbols::list, "About", Apps::SysInfo},
}};
- return std::unique_ptr<Screen>(new Screens::List(1, 2, app, settingsController, applications));
+ return std::make_unique<Screens::List>(1, 2, app, settingsController, applications);
}
diff --git a/src/displayapp/screens/settings/Settings.h b/src/displayapp/screens/settings/Settings.h
index 7e332dfe..711a6be6 100644
--- a/src/displayapp/screens/settings/Settings.h
+++ b/src/displayapp/screens/settings/Settings.h
@@ -16,7 +16,6 @@ namespace Pinetime {
bool Refresh() override;
- void OnButtonEvent(lv_obj_t* object, lv_event_t event);
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
private: