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/heartrate/Ppg.cpp | |
| parent | 04afd22943cf4d6a826e09cf5fd246886ee7cacf (diff) | |
Background heartrate measurement
Co-Authored-By: Patric Gruber <me@patric-gruber.at>
Diffstat (limited to 'src/components/heartrate/Ppg.cpp')
| -rw-r--r-- | src/components/heartrate/Ppg.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/components/heartrate/Ppg.cpp b/src/components/heartrate/Ppg.cpp index efbed852..25be6237 100644 --- a/src/components/heartrate/Ppg.cpp +++ b/src/components/heartrate/Ppg.cpp @@ -155,8 +155,12 @@ int8_t Ppg::Preprocess(uint16_t hrs, uint16_t als) { int Ppg::HeartRate() { if (dataIndex < dataLength) { + if (!enoughData) { + return -2; + } return 0; } + enoughData = true; int hr = 0; hr = ProcessHeartRate(resetSpectralAvg); resetSpectralAvg = false; @@ -171,6 +175,7 @@ int Ppg::HeartRate() { void Ppg::Reset(bool resetDaqBuffer) { if (resetDaqBuffer) { dataIndex = 0; + enoughData = false; } avgIndex = 0; dataAverage.fill(0.0f); |
