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