bump settings version, fix types
This commit is contained in:
parent
520e50901a
commit
50d88bbe84
|
@ -1,6 +1,5 @@
|
|||
#include "displayapp/screens/settings/SettingHeartRate.h"
|
||||
#include <lvgl/lvgl.h>
|
||||
#include "displayapp/DisplayApp.h"
|
||||
#include "displayapp/screens/Styles.h"
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "displayapp/screens/Symbols.h"
|
||||
|
@ -18,8 +17,8 @@ namespace {
|
|||
|
||||
constexpr std::array<Option, 8> SettingHeartRate::options;
|
||||
|
||||
SettingHeartRate::SettingHeartRate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||
: app {app}, settingsController {settingsController} {
|
||||
SettingHeartRate::SettingHeartRate(Pinetime::Controllers::Settings& settingsController)
|
||||
: settingsController {settingsController} {
|
||||
|
||||
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
|
||||
|
||||
|
|
|
@ -21,13 +21,12 @@ namespace Pinetime {
|
|||
|
||||
class SettingHeartRate : public Screen {
|
||||
public:
|
||||
SettingHeartRate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settings);
|
||||
SettingHeartRate(Pinetime::Controllers::Settings& settings);
|
||||
~SettingHeartRate() override;
|
||||
|
||||
void UpdateSelected(lv_obj_t* object, lv_event_t event);
|
||||
|
||||
private:
|
||||
DisplayApp* app;
|
||||
Pinetime::Controllers::Settings& settingsController;
|
||||
|
||||
static constexpr std::array<Option, 8> options = {{
|
||||
|
|
|
@ -29,7 +29,7 @@ void HeartRateTask::Work() {
|
|||
int lastBpm = 0;
|
||||
|
||||
while (true) {
|
||||
auto delay = CurrentTaskDelay();
|
||||
TickType_t delay = CurrentTaskDelay();
|
||||
Messages msg;
|
||||
|
||||
if (xQueueReceive(messageQueue, &msg, delay) == pdTRUE) {
|
||||
|
@ -160,34 +160,34 @@ void HeartRateTask::HandleSensorData(int* lastBpm) {
|
|||
}
|
||||
}
|
||||
|
||||
int HeartRateTask::CurrentTaskDelay() {
|
||||
TickType_t HeartRateTask::CurrentTaskDelay() {
|
||||
switch (state) {
|
||||
case States::Measuring:
|
||||
case States::BackgroundMeasuring:
|
||||
return ppg.deltaTms;
|
||||
case States::Running:
|
||||
return 100;
|
||||
return 100 * pdMS_TO_TICKS;
|
||||
case States::BackgroundWaiting:
|
||||
return 10000;
|
||||
return 10000 * pdMS_TO_TICKS;
|
||||
default:
|
||||
return portMAX_DELAY;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t HeartRateTask::GetHeartRateBackgroundMeasurementIntervalInTicks() {
|
||||
TickType_t HeartRateTask::GetHeartRateBackgroundMeasurementIntervalInTicks() {
|
||||
switch (settings.GetHeartRateBackgroundMeasurementInterval()) {
|
||||
case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::TenSeconds:
|
||||
return 10 * 1000;
|
||||
return 10 * pdMS_TO_TICKS;
|
||||
case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::ThirtySeconds:
|
||||
return 30 * 1000;
|
||||
return 30 * pdMS_TO_TICKS;
|
||||
case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::OneMinute:
|
||||
return 60 * 1000;
|
||||
return 60 * pdMS_TO_TICKS;
|
||||
case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::FiveMinutes:
|
||||
return 5 * 60 * 1000;
|
||||
return 5 * 60 * pdMS_TO_TICKS;
|
||||
case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::TenMinutes:
|
||||
return 10 * 60 * 1000;
|
||||
return 10 * 60 * pdMS_TO_TICKS;
|
||||
case Pinetime::Controllers::Settings::HeartRateBackgroundMeasurementInterval::ThirtyMinutes:
|
||||
return 30 * 60 * 1000;
|
||||
return 30 * 60 * pdMS_TO_TICKS;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <components/heartrate/Ppg.h>
|
||||
#include "components/settings/Settings.h"
|
||||
|
||||
#define DURATION_UNTIL_BACKGROUND_MEASURMENT_IS_STOPPED 30 * 1000 // 30 seconds assuming 1 Hz
|
||||
#define DURATION_UNTIL_BACKGROUND_MEASURMENT_IS_STOPPED 30 * pdMS_TO_TICKS
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Drivers {
|
||||
|
@ -37,9 +37,9 @@ namespace Pinetime {
|
|||
|
||||
void HandleBackgroundWaiting();
|
||||
void HandleSensorData(int* lastBpm);
|
||||
int CurrentTaskDelay();
|
||||
TickType_t CurrentTaskDelay();
|
||||
|
||||
uint32_t GetHeartRateBackgroundMeasurementIntervalInTicks();
|
||||
TickType_t GetHeartRateBackgroundMeasurementIntervalInTicks();
|
||||
bool IsContinuosModeActivated();
|
||||
bool IsBackgroundMeasurementActivated();
|
||||
|
||||
|
|
Loading…
Reference in a new issue