summaryrefslogtreecommitdiff
path: root/src/systemtask
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2022-12-18 19:14:36 +0200
committerGitHub <noreply@github.com>2022-12-18 18:14:36 +0100
commitafea7ca0d1d670bdee04cfe80a1d8c36efa4fca0 (patch)
treef1a4196755f85af4490c44f6b2c8784f9eb48669 /src/systemtask
parentbfedf47d1a8ac6d5df1d0ad4d4071323366d22e8 (diff)
Update clang-tidy configuration and fix some warnings (#1474)
Don't enable coding conventions from unrelated projects. Only enable generic checks.
Diffstat (limited to 'src/systemtask')
-rw-r--r--src/systemtask/Messages.h4
-rw-r--r--src/systemtask/SystemTask.cpp20
2 files changed, 11 insertions, 13 deletions
diff --git a/src/systemtask/Messages.h b/src/systemtask/Messages.h
index 7a46e060..d730d74f 100644
--- a/src/systemtask/Messages.h
+++ b/src/systemtask/Messages.h
@@ -1,8 +1,8 @@
#pragma once
-
+#include <cstdint>
namespace Pinetime {
namespace System {
- enum class Messages {
+ enum class Messages : uint8_t {
GoToSleep,
GoToRunning,
TouchWakeUp,
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp
index ef631af7..01056a9a 100644
--- a/src/systemtask/SystemTask.cpp
+++ b/src/systemtask/SystemTask.cpp
@@ -30,14 +30,14 @@ namespace {
void DimTimerCallback(TimerHandle_t xTimer) {
NRF_LOG_INFO("DimTimerCallback");
- auto sysTask = static_cast<SystemTask*>(pvTimerGetTimerID(xTimer));
+ auto* sysTask = static_cast<SystemTask*>(pvTimerGetTimerID(xTimer));
sysTask->OnDim();
}
void IdleTimerCallback(TimerHandle_t xTimer) {
NRF_LOG_INFO("IdleTimerCallback");
- auto sysTask = static_cast<SystemTask*>(pvTimerGetTimerID(xTimer));
+ auto* sysTask = static_cast<SystemTask*>(pvTimerGetTimerID(xTimer));
sysTask->OnIdle();
}
@@ -208,10 +208,9 @@ void SystemTask::Work() {
while (true) {
UpdateMotion();
- uint8_t msg;
- if (xQueueReceive(systemTasksMsgQueue, &msg, 100)) {
- Messages message = static_cast<Messages>(msg);
- switch (message) {
+ Messages msg;
+ if (xQueueReceive(systemTasksMsgQueue, &msg, 100) == pdTRUE) {
+ switch (msg) {
case Messages::EnableSleeping:
// Make sure that exiting an app doesn't enable sleeping,
// if the exiting was caused by a firmware update
@@ -348,7 +347,7 @@ void SystemTask::Work() {
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent);
break;
case Messages::HandleButtonEvent: {
- Controllers::ButtonActions action;
+ Controllers::ButtonActions action = Controllers::ButtonActions::None;
if (nrf_gpio_pin_read(Pinetime::PinMap::Button) == 0) {
action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Release);
} else {
@@ -459,7 +458,7 @@ void SystemTask::Work() {
uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG);
dateTimeController.UpdateTime(systick_counter);
NoInit_BackUpTime = dateTimeController.CurrentDateTime();
- if (!nrf_gpio_pin_read(PinMap::Button)) {
+ if (nrf_gpio_pin_read(PinMap::Button) == 0) {
watchdog.Kick();
}
}
@@ -552,10 +551,9 @@ void SystemTask::PushMessage(System::Messages msg) {
}
if (in_isr()) {
- BaseType_t xHigherPriorityTaskWoken;
- xHigherPriorityTaskWoken = pdFALSE;
+ BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xQueueSendFromISR(systemTasksMsgQueue, &msg, &xHigherPriorityTaskWoken);
- if (xHigherPriorityTaskWoken) {
+ if (xHigherPriorityTaskWoken == pdTRUE) {
/* Actual macro used here is port specific. */
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}