From 8daddf87782c1228a44528da6f67d8dfce3edb40 Mon Sep 17 00:00:00 2001 From: mark9064 <30447455+mark9064@users.noreply.github.com> Date: Wed, 18 Jun 2025 14:09:57 +0100 Subject: Background heartrate measurement Co-Authored-By: Patric Gruber --- src/components/settings/Settings.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/components/settings') diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 093a3ac6..9133d3fe 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -1,6 +1,8 @@ #pragma once #include #include +#include +#include #include "components/brightness/BrightnessController.h" #include "components/fs/FS.h" #include "displayapp/apps/Apps.h" @@ -334,10 +336,25 @@ namespace Pinetime { return (settings.dfuAndFsEnabledOnBoot ? DfuAndFsMode::Enabled : DfuAndFsMode::Disabled); }; + std::optional GetHeartRateBackgroundMeasurementInterval() const { + if (settings.heartRateBackgroundPeriod == std::numeric_limits::max()) { + return std::nullopt; + } + return settings.heartRateBackgroundPeriod; + } + + void SetHeartRateBackgroundMeasurementInterval(std::optional newIntervalInSeconds) { + newIntervalInSeconds = newIntervalInSeconds.value_or(std::numeric_limits::max()); + if (newIntervalInSeconds != settings.heartRateBackgroundPeriod) { + settingsChanged = true; + } + settings.heartRateBackgroundPeriod = newIntervalInSeconds.value(); + } + private: Pinetime::Controllers::FS& fs; - static constexpr uint32_t settingsVersion = 0x0009; + static constexpr uint32_t settingsVersion = 0x000a; struct SettingsData { uint32_t version = settingsVersion; @@ -365,6 +382,7 @@ namespace Pinetime { Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium; bool dfuAndFsEnabledOnBoot = false; + uint16_t heartRateBackgroundPeriod = std::numeric_limits::max(); // Disabled by default }; SettingsData settings; -- cgit v1.2.3-70-g09d2