From 05a37aac43a168c0eecc2f4489334cf22d103fcf Mon Sep 17 00:00:00 2001 From: mark9064 <30447455+mark9064@users.noreply.github.com> Date: Tue, 13 Feb 2024 00:38:20 +0000 Subject: [PATCH] Simplify ISR task wake checks The macro checks the variable, so we don't need to check it ourselves --- src/displayapp/DisplayApp.cpp | 4 +--- src/displayapp/DisplayAppRecovery.cpp | 8 ++------ src/heartratetask/HeartRateTask.cpp | 5 +---- src/systemtask/SystemTask.cpp | 5 +---- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index e5329b2d9d..007e1c7c71 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -560,9 +560,7 @@ void DisplayApp::PushMessage(Messages msg) { if (in_isr()) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken == pdTRUE) { - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); - } + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); } else { TickType_t timeout = portMAX_DELAY; // Make xQueueSend() non-blocking if the message is a Notification message. We do this to avoid diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index c4bd57669b..002ee3bd04 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -110,13 +110,9 @@ void DisplayApp::DisplayOtaProgress(uint8_t percent, uint16_t color) { } void DisplayApp::PushMessage(Display::Messages msg) { - BaseType_t xHigherPriorityTaskWoken; - xHigherPriorityTaskWoken = pdFALSE; + BaseType_t xHigherPriorityTaskWoken = pdFALSE; xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { - /* Actual macro used here is port specific. */ - // TODO : should I do something here? - } + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); } void DisplayApp::Register(Pinetime::System::SystemTask* /*systemTask*/) { diff --git a/src/heartratetask/HeartRateTask.cpp b/src/heartratetask/HeartRateTask.cpp index 414cdf2c47..9d82d11e0d 100644 --- a/src/heartratetask/HeartRateTask.cpp +++ b/src/heartratetask/HeartRateTask.cpp @@ -103,10 +103,7 @@ void HeartRateTask::Work() { void HeartRateTask::PushMessage(HeartRateTask::Messages msg) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; xQueueSendFromISR(messageQueue, &msg, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { - /* Actual macro used here is port specific. */ - // TODO : should I do something here? - } + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); } void HeartRateTask::StartMeasurement() { diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 246e7cec01..466ac1f0b5 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -504,10 +504,7 @@ void SystemTask::PushMessage(System::Messages msg) { if (in_isr()) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; xQueueSendFromISR(systemTasksMsgQueue, &msg, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken == pdTRUE) { - /* Actual macro used here is port specific. */ - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); - } + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); } else { xQueueSend(systemTasksMsgQueue, &msg, portMAX_DELAY); }