diff options
| author | Joaquim <joaquim.org@gmail.com> | 2021-04-26 20:29:48 (GMT) |
|---|---|---|
| committer | Joaquim <joaquim.org@gmail.com> | 2021-04-26 20:29:48 (GMT) |
| commit | cd0d85dff95bbc5f285d92eb78a642aab1ae4b8b (patch) | |
| tree | fc568aa2516c8c64cc55eb0d08e9a929c11b454a /src/components/heartrate/Ptagc.cpp | |
| parent | 5fc07a8df7d18d1fa9c4971f2c7b69ea68db559b (diff) | |
| parent | eedff2c06c292bda8dcb92fc04c67097fe72e22f (diff) | |
Merge branch 'develop' of
https://github.com/JF002/InfiniTime into StepsApp
Diffstat (limited to 'src/components/heartrate/Ptagc.cpp')
| -rw-r--r-- | src/components/heartrate/Ptagc.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/components/heartrate/Ptagc.cpp b/src/components/heartrate/Ptagc.cpp index dd7c441..e358371 100644 --- a/src/components/heartrate/Ptagc.cpp +++ b/src/components/heartrate/Ptagc.cpp @@ -10,17 +10,16 @@ using namespace Pinetime::Controllers; /** Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/ppg.py */ -Ptagc::Ptagc(float start, float decay, float threshold) : peak{start}, decay{decay}, boost{1.0f/decay}, threshold{threshold} { - +Ptagc::Ptagc(float start, float decay, float threshold) : peak {start}, decay {decay}, boost {1.0f / decay}, threshold {threshold} { } float Ptagc::Step(float spl) { - if(std::abs(spl) > peak) + if (std::abs(spl) > peak) peak *= boost; else peak *= decay; - if((spl > (peak * threshold)) || (spl < (peak * -threshold))) + if ((spl > (peak * threshold)) || (spl < (peak * -threshold))) return 0.0f; spl = 100.0f * spl / (2.0f * peak); |
