diff options
| author | mark9064 <30447455+mark9064@users.noreply.github.com> | 2025-06-18 14:09:57 +0100 |
|---|---|---|
| committer | mark9064 <30447455+mark9064@users.noreply.github.com> | 2025-11-05 10:34:49 +0000 |
| commit | 8daddf87782c1228a44528da6f67d8dfce3edb40 (patch) | |
| tree | dead2a56c55f5eec74c70f42389c89e379aa4ce7 /src/components/settings/Settings.h | |
| parent | 04afd22943cf4d6a826e09cf5fd246886ee7cacf (diff) | |
Background heartrate measurement
Co-Authored-By: Patric Gruber <me@patric-gruber.at>
Diffstat (limited to 'src/components/settings/Settings.h')
| -rw-r--r-- | src/components/settings/Settings.h | 20 |
1 files changed, 19 insertions, 1 deletions
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 <cstdint> #include <bitset> +#include <limits> +#include <optional> #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<uint16_t> GetHeartRateBackgroundMeasurementInterval() const { + if (settings.heartRateBackgroundPeriod == std::numeric_limits<uint16_t>::max()) { + return std::nullopt; + } + return settings.heartRateBackgroundPeriod; + } + + void SetHeartRateBackgroundMeasurementInterval(std::optional<uint16_t> newIntervalInSeconds) { + newIntervalInSeconds = newIntervalInSeconds.value_or(std::numeric_limits<uint16_t>::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<uint16_t>::max(); // Disabled by default }; SettingsData settings; |
