summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy6
-rw-r--r--src/displayapp/DisplayApp.cpp44
-rw-r--r--src/displayapp/DisplayApp.h2
-rw-r--r--src/displayapp/DisplayAppRecovery.cpp7
-rw-r--r--src/logging/NrfLogger.cpp5
5 files changed, 36 insertions, 28 deletions
diff --git a/.clang-tidy b/.clang-tidy
index d6036802..8a7d38f0 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -22,5 +22,9 @@ Checks: '*,
-hicpp-no-assembler,
-hicpp-avoid-c-arrays,
-hicpp-uppercase-literal-suffix,
+ -hicpp-no-array-decay,
-cert-err58-cpp,
- -cert-err60-cpp' \ No newline at end of file
+ -cert-err60-cpp'
+CheckOptions:
+ - key: readability-function-cognitive-complexity.Threshold
+ value: 100 \ No newline at end of file
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 3a20c766..9ec9640b 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -65,7 +65,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
notificationManager {notificationManager},
heartRateController {heartRateController},
settingsController {settingsController},
- motorController{motorController},
+ motorController {motorController},
motionController {motionController} {
msgQueue = xQueueCreate(queueSize, itemSize);
// Start clock when smartwatch boots
@@ -73,8 +73,9 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
}
void DisplayApp::Start() {
- if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle))
+ if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 800, this, 0, &taskHandle)) {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
+ }
}
void DisplayApp::Process(void* instance) {
@@ -85,7 +86,7 @@ void DisplayApp::Process(void* instance) {
// Send a dummy notification to unlock the lvgl display driver for the first iteration
xTaskNotifyGive(xTaskGetCurrentTaskHandle());
- while (1) {
+ while (true) {
app->Refresh();
}
}
@@ -213,7 +214,7 @@ void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction)
LoadApp(app, direction);
}
-void DisplayApp::returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) {
+void DisplayApp::ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) {
returnToApp = app;
returnDirection = direction;
returnTouchEvent = touchEvent;
@@ -224,12 +225,12 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
SetFullRefresh(direction);
// default return to launcher
- returnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown);
switch (app) {
case Apps::Launcher:
currentScreen = std::make_unique<Screens::ApplicationList>(this, settingsController, batteryController, dateTimeController);
- returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::None:
case Apps::Clock:
@@ -245,7 +246,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
case Apps::FirmwareValidation:
currentScreen = std::make_unique<Screens::FirmwareValidation>(this, validator);
- returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::FirmwareUpdate:
currentScreen = std::make_unique<Screens::FirmwareUpdate>(this, bleController);
@@ -254,54 +255,54 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
case Apps::Notifications:
currentScreen = std::make_unique<Screens::Notifications>(
this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal);
- returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
+ ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
break;
case Apps::NotificationsPreview:
currentScreen = std::make_unique<Screens::Notifications>(
this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview);
- returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
+ ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
break;
// Settings
case Apps::QuickSettings:
- currentScreen =
- std::make_unique<Screens::QuickSettings>(this, batteryController, dateTimeController, brightnessController, motorController, settingsController);
- returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
+ currentScreen = std::make_unique<Screens::QuickSettings>(
+ this, batteryController, dateTimeController, brightnessController, motorController, settingsController);
+ ReturnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
break;
case Apps::Settings:
currentScreen = std::make_unique<Screens::Settings>(this, settingsController);
- returnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SettingWatchFace:
currentScreen = std::make_unique<Screens::SettingWatchFace>(this, settingsController);
- returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SettingTimeFormat:
currentScreen = std::make_unique<Screens::SettingTimeFormat>(this, settingsController);
- returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SettingWakeUp:
currentScreen = std::make_unique<Screens::SettingWakeUp>(this, settingsController);
- returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SettingDisplay:
currentScreen = std::make_unique<Screens::SettingDisplay>(this, settingsController);
- returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::BatteryInfo:
currentScreen = std::make_unique<Screens::BatteryInfo>(this, batteryController);
- returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SysInfo:
currentScreen =
std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog);
- returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
//
case Apps::FlashLight:
currentScreen = std::make_unique<Screens::FlashLight>(this, systemTask, brightnessController);
- returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None);
+ ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None);
break;
case Apps::StopWatch:
currentScreen = std::make_unique<Screens::StopWatch>(this);
@@ -349,8 +350,9 @@ TouchEvents DisplayApp::OnTouchEvent() {
if (info.isTouch) {
switch (info.gesture) {
case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
- if (touchMode == TouchModes::Gestures)
+ if (touchMode == TouchModes::Gestures) {
lvgl.SetNewTapEvent(info.x, info.y);
+ }
return TouchEvents::Tap;
case Pinetime::Drivers::Cst816S::Gestures::LongPress:
return TouchEvents::LongTap;
diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h
index 75e52755..ffe27cf1 100644
--- a/src/displayapp/DisplayApp.h
+++ b/src/displayapp/DisplayApp.h
@@ -103,7 +103,7 @@ namespace Pinetime {
static void Process(void* instance);
void InitHw();
void Refresh();
- void returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent);
+ void ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent);
void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction);
};
}
diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp
index 6db987fa..a132a47c 100644
--- a/src/displayapp/DisplayAppRecovery.cpp
+++ b/src/displayapp/DisplayAppRecovery.cpp
@@ -37,7 +37,7 @@ void DisplayApp::Process(void* instance) {
xTaskNotifyGive(xTaskGetCurrentTaskHandle());
app->InitHw();
- while (1) {
+ while (true) {
app->Refresh();
}
}
@@ -51,10 +51,11 @@ void DisplayApp::Refresh() {
if (xQueueReceive(msgQueue, &msg, 200)) {
switch (msg) {
case Display::Messages::UpdateBleConnection:
- if (bleController.IsConnected())
+ if (bleController.IsConnected()) {
DisplayLogo(colorBlue);
- else
+ } else {
DisplayLogo(colorWhite);
+ }
break;
case Display::Messages::BleFirmwareUpdateStarted:
DisplayLogo(colorGreen);
diff --git a/src/logging/NrfLogger.cpp b/src/logging/NrfLogger.cpp
index 70a00e61..1c048f2c 100644
--- a/src/logging/NrfLogger.cpp
+++ b/src/logging/NrfLogger.cpp
@@ -12,8 +12,9 @@ void NrfLogger::Init() {
NRF_LOG_DEFAULT_BACKENDS_INIT();
- if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 200, this, 0, &m_logger_thread))
+ if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 200, this, 0, &m_logger_thread)) {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
+ }
}
void NrfLogger::Process(void*) {
@@ -21,7 +22,7 @@ void NrfLogger::Process(void*) {
// Suppress endless loop diagnostic
#pragma clang diagnostic push
#pragma ide diagnostic ignored "EndlessLoop"
- while (1) {
+ while (true) {
NRF_LOG_FLUSH();
vTaskDelay(100); // Not good for power consumption, it will wake up every 100ms...
}