From b1925ff28638dd4b8400c4d0c49d796d8990b1af Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Thu, 10 Jun 2021 21:20:27 +0200 Subject: Minor improvements: use std::make_unique when creating unique_ptr, check the code is running from an IRQ before calling xQueueSendFromISR or xQueueSend) --- src/displayapp/screens/SystemInfo.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/displayapp/screens/SystemInfo.cpp') diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index f61d2ff1..a7387dac 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -81,7 +81,7 @@ std::unique_ptr 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(new Screens::Label(0, 5, app, label)); + return std::make_unique(0, 5, app, label); } std::unique_ptr SystemInfo::CreateScreen2() { @@ -161,7 +161,7 @@ std::unique_ptr SystemInfo::CreateScreen2() { brightnessController.ToString(), resetReason); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); - return std::unique_ptr(new Screens::Label(1, 4, app, label)); + return std::make_unique(1, 4, app, label); } std::unique_ptr SystemInfo::CreateScreen3() { @@ -195,7 +195,7 @@ std::unique_ptr SystemInfo::CreateScreen3() { (int) mon.free_biggest_size, 0); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); - return std::unique_ptr(new Screens::Label(2, 5, app, label)); + return std::make_unique(2, 5, app, label); } bool sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) { @@ -229,7 +229,7 @@ std::unique_ptr SystemInfo::CreateScreen4() { lv_table_set_cell_value(infoTask, i + 1, 2, std::to_string(tasksStatus[i].usStackHighWaterMark).c_str()); } } - return std::unique_ptr(new Screens::Label(3, 5, app, infoTask)); + return std::make_unique(3, 5, app, infoTask); } std::unique_ptr SystemInfo::CreateScreen5() { @@ -245,5 +245,5 @@ std::unique_ptr 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(new Screens::Label(4, 5, app, label)); + return std::make_unique(4, 5, app, label); } -- cgit v1.2.3 From bf906bd573b37e0bb592221dae6b5f156836a6b6 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sat, 12 Jun 2021 12:12:39 +0300 Subject: Fix scrollbar (#382) --- src/displayapp/screens/SystemInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/displayapp/screens/SystemInfo.cpp') diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index a7387dac..a0b626e9 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -161,7 +161,7 @@ std::unique_ptr SystemInfo::CreateScreen2() { brightnessController.ToString(), resetReason); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); - return std::make_unique(1, 4, app, label); + return std::make_unique(1, 5, app, label); } std::unique_ptr SystemInfo::CreateScreen3() { -- cgit v1.2.3 From 314a8ebba070bd935c795cea2955d494f002797f Mon Sep 17 00:00:00 2001 From: Avamander Date: Sat, 12 Jun 2021 12:18:19 +0300 Subject: Changed the namespace of SystemInfo::sortById to avoid a name conflict (#360) --- src/displayapp/DisplayApp.cpp | 2 -- src/displayapp/screens/SystemInfo.cpp | 2 +- src/displayapp/screens/SystemInfo.h | 3 +++ 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/displayapp/screens/SystemInfo.cpp') diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 05f171be..01e26e22 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -331,8 +331,6 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) std::make_unique(this, dateTimeController, batteryController, brightnessController, bleController, watchdog); ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; - // - case Apps::FlashLight: currentScreen = std::make_unique(this, *systemTask, brightnessController); ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None); diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index a0b626e9..9ff28288 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -198,7 +198,7 @@ std::unique_ptr SystemInfo::CreateScreen3() { return std::make_unique(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; } 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 CreateScreen1(); std::unique_ptr CreateScreen2(); std::unique_ptr CreateScreen3(); -- cgit v1.2.3