Mercurial > public > ostc4
changeset 362:7b8c87a39c0e MotionDetection
Parameter update
author | Ideenmodellierer |
---|---|
date | Tue, 11 Jun 2019 05:31:07 +0200 |
parents | b111fc4250e9 |
children | bdf978d2a5d4 |
files | Discovery/Src/motion.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Src/motion.c Tue Jun 11 05:30:09 2019 +0200 +++ b/Discovery/Src/motion.c Tue Jun 11 05:31:07 2019 +0200 @@ -12,7 +12,7 @@ #define PITCH_HISTORY_ENTRIES 20 /* number of pitch value stored in buffer */ #define STABLE_STATE_COUNT 2 /* number of count to declare a state as stable (at the moment based on 100ms) */ -#define MOVE_DELTA_COUNT 5 /* Delta count needed to identify a valid movement */ +#define MOVE_DELTA_COUNT 10 /* Delta count needed to identify a valid movement */ #define SHAKE_DELTA_COUNT 30 /* Delta count needed to identify a valid minima / maxima */ @@ -44,6 +44,8 @@ } +detectionState_t detectionState = DETECT_NOTHING; + /* Detect if user is generating an pitch including return to starting position (shake) */ /* This is done by feeding the past movements value per value into a state machine */ detectionState_t detectShake(float currentPitch) @@ -54,7 +56,7 @@ static float startPitch = 0.0; relativeMove_t relativeMove = RELATIVE_MOVE_INVALID; - static detectionState_t detectionState = DETECT_NOTHING; + pitchHistory[pitchWriteIdx] = currentPitch; runningIdx = pitchWriteIdx;