From 4ed4d2cfcdae1fba9553de7a370eec9a1a1c7611 Mon Sep 17 00:00:00 2001 From: Patric Gruber Date: Fri, 1 Dec 2023 17:22:28 +0100 Subject: [PATCH] use pdMS_TO_TICKS correctly, format using clang-format --- .../screens/settings/SettingHeartRate.cpp | 3 +-- src/heartratetask/HeartRateTask.cpp | 19 ++++++++++--------- src/heartratetask/HeartRateTask.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/displayapp/screens/settings/SettingHeartRate.cpp b/src/displayapp/screens/settings/SettingHeartRate.cpp index 7d8206cd..fdba9af1 100644 --- a/src/displayapp/screens/settings/SettingHeartRate.cpp +++ b/src/displayapp/screens/settings/SettingHeartRate.cpp @@ -17,8 +17,7 @@ namespace { constexpr std::array SettingHeartRate::options; -SettingHeartRate::SettingHeartRate(Pinetime::Controllers::Settings& settingsController) - : settingsController {settingsController} { +SettingHeartRate::SettingHeartRate(Pinetime::Controllers::Settings& settingsController) : settingsController {settingsController} { lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); diff --git a/src/heartratetask/HeartRateTask.cpp b/src/heartratetask/HeartRateTask.cpp index 1d1f7952..a3baa7d2 100644 --- a/src/heartratetask/HeartRateTask.cpp +++ b/src/heartratetask/HeartRateTask.cpp @@ -154,7 +154,8 @@ void HeartRateTask::HandleSensorData(int* lastBpm) { state = States::BackgroundWaiting; StartWaiting(); } - if (bpm == 0 && state == States::BackgroundMeasuring && xTaskGetTickCount() - measurementStart >= DURATION_UNTIL_BACKGROUND_MEASURMENT_IS_STOPPED) { + if (bpm == 0 && state == States::BackgroundMeasuring && + xTaskGetTickCount() - measurementStart >= DURATION_UNTIL_BACKGROUND_MEASURMENT_IS_STOPPED) { state = States::BackgroundWaiting; StartWaiting(); } @@ -166,9 +167,9 @@ TickType_t HeartRateTask::CurrentTaskDelay() { case States::BackgroundMeasuring: return ppg.deltaTms; case States::Running: - return 100 * pdMS_TO_TICKS; + return pdMS_TO_TICKS(100); case States::BackgroundWaiting: - return 10000 * pdMS_TO_TICKS; + return pdMS_TO_TICKS(10000); default: return portMAX_DELAY; } @@ -177,17 +178,17 @@ TickType_t HeartRateTask::CurrentTaskDelay() { TickType_t HeartRateTask::GetHeartRateBackgroundMeasurementIntervalInTicks() { switch (settings.GetHeartRateBackgroundMeasurementInterval()) { case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::TenSeconds: - return 10 * pdMS_TO_TICKS; + return pdMS_TO_TICKS(10 * 1000); case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::ThirtySeconds: - return 30 * pdMS_TO_TICKS; + return pdMS_TO_TICKS(30 * 1000); case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::OneMinute: - return 60 * pdMS_TO_TICKS; + return pdMS_TO_TICKS(60 * 1000); case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::FiveMinutes: - return 5 * 60 * pdMS_TO_TICKS; + return pdMS_TO_TICKS(5 * 60 * 1000); case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::TenMinutes: - return 10 * 60 * pdMS_TO_TICKS; + return pdMS_TO_TICKS(10 * 60 * 1000); case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::ThirtyMinutes: - return 30 * 60 * pdMS_TO_TICKS; + return pdMS_TO_TICKS(30 * 60 * 1000); default: return 0; } diff --git a/src/heartratetask/HeartRateTask.h b/src/heartratetask/HeartRateTask.h index 5321363b..47b86d60 100644 --- a/src/heartratetask/HeartRateTask.h +++ b/src/heartratetask/HeartRateTask.h @@ -5,7 +5,7 @@ #include #include "components/settings/Settings.h" -#define DURATION_UNTIL_BACKGROUND_MEASURMENT_IS_STOPPED 30 * pdMS_TO_TICKS +#define DURATION_UNTIL_BACKGROUND_MEASURMENT_IS_STOPPED pdMS_TO_TICKS(30 * 1000) namespace Pinetime { namespace Drivers {