Nora Vazbyte
/
99Problems-BLEAint1
app critics will say it's money, cash, toes
Diff: source/main.cpp
- Revision:
- 15:a502564c7a88
- Parent:
- 14:aa0029dbb3e2
- Child:
- 16:567f06e22645
--- a/source/main.cpp Tue Nov 13 18:49:21 2018 +0000 +++ b/source/main.cpp Tue Nov 20 15:46:04 2018 +0000 @@ -35,8 +35,10 @@ double step_threshold = 14.45; double oldAcceleration = 0.0; -int callback_cycles = 4; +int callback_cycles = 1; // used to be 4 int step; +int run_threshold = 5; // used to be 7 +int run_count = 0; static HeartRateService* hrService; MPU9250 mpu = MPU9250(P0_26, P0_27); @@ -69,7 +71,18 @@ //printf("%i\n", callback_cycles); if (accel < step_threshold && oldAcceleration >= step_threshold && (callback_cycles > 3)) { - step = 1; + if (callback_cycles <= run_threshold) { + if (run_count >= 2) { + step = 2; + } + else { + run_count++; + } + } + else { + step = 1; + run_count = 0; + } callback_cycles = 0; }