summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/DisplayApp.cpp21
-rw-r--r--src/displayapp/screens/SystemInfo.cpp10
-rw-r--r--src/displayapp/screens/settings/Settings.cpp4
-rw-r--r--src/displayapp/screens/settings/Settings.h1
4 files changed, 22 insertions, 14 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 99758c92..3bfaf2a2 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -45,6 +45,12 @@
using namespace Pinetime::Applications;
using namespace Pinetime::Applications::Display;
+namespace {
+ static inline bool in_isr(void) {
+ return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0;
+ }
+}
+
DisplayApp::DisplayApp(Drivers::St7789& lcd,
Components::LittleVgl& lvgl,
Drivers::Cst816S& touchPanel,
@@ -364,12 +370,15 @@ void DisplayApp::IdleState() {
}
void DisplayApp::PushMessage(Messages msg) {
- BaseType_t xHigherPriorityTaskWoken;
- xHigherPriorityTaskWoken = pdFALSE;
- xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken);
- if (xHigherPriorityTaskWoken) {
- /* Actual macro used here is port specific. */
- // TODO : should I do something here?
+ if(in_isr()) {
+ BaseType_t xHigherPriorityTaskWoken;
+ xHigherPriorityTaskWoken = pdFALSE;
+ xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken);
+ if (xHigherPriorityTaskWoken) {
+ portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
+ }
+ } else {
+ xQueueSend(msgQueue, &msg, portMAX_DELAY);
}
}
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<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, 4, app, label);
}
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
@@ -195,7 +195,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
(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) {
@@ -229,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() {
@@ -245,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/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: