Skip to content

Commit

Permalink
use pdMS_TO_TICKS correctly, format using clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
patricgruber committed Dec 1, 2023
1 parent 569f430 commit 4c64aa7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/displayapp/screens/settings/SettingHeartRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ namespace {

constexpr std::array<Option, 8> 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);

Expand Down
19 changes: 10 additions & 9 deletions src/heartratetask/HeartRateTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,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();
}
Expand All @@ -169,9 +170,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;
}
Expand All @@ -180,17 +181,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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/heartratetask/HeartRateTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <components/heartrate/Ppg.h>
#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 {
Expand Down

0 comments on commit 4c64aa7

Please sign in to comment.