Mercurial > public > ostc4
comparison Discovery/Src/motion.c @ 385:0cd862e501f6 MotionDetection
Finetune parameter for detection of small sectors as used for the pitch detection
author | ideenmodellierer |
---|---|
date | Mon, 21 Oct 2019 18:37:43 +0200 |
parents | 427ae9f8e28e |
children | e3237f580ae9 |
comparison
equal
deleted
inserted
replaced
384:427ae9f8e28e | 385:0cd862e501f6 |
---|---|
18 #define STABLE_STATE_COUNT 2 /* number of count to declare a state as stable (at the moment based on 100ms) */ | 18 #define STABLE_STATE_COUNT 2 /* number of count to declare a state as stable (at the moment based on 100ms) */ |
19 #define STABLE_STATE_TIMEOUT 5 /* Detection shall be aborted if a movement state is stable for more than 500ms */ | 19 #define STABLE_STATE_TIMEOUT 5 /* Detection shall be aborted if a movement state is stable for more than 500ms */ |
20 | 20 |
21 #define SECTOR_WINDOW 80.0 /* Pitch window which is used for custom view projection */ | 21 #define SECTOR_WINDOW 80.0 /* Pitch window which is used for custom view projection */ |
22 #define SECTOR_WINDOW_MAX 120.0 /* Pitch window which will be greater than the divers field of view */ | 22 #define SECTOR_WINDOW_MAX 120.0 /* Pitch window which will be greater than the divers field of view */ |
23 #define SECTOR_HYSTERY 3 /* Additional offset to avoid fast changing displays */ | 23 #define SECTOR_HYSTERY 2 /* Additional offset to avoid fast changing displays */ |
24 #define SECTOR_BORDER 400.0 /* Define a value which is out of limit to avoid not wanted key events */ | 24 #define SECTOR_BORDER 400.0 /* Define a value which is out of limit to avoid not wanted key events */ |
25 #define SECTOR_FILTER 10 /* Define speed for calculated angle to follow real value */ | 25 #define SECTOR_FILTER 10 /* Define speed for calculated angle to follow real value */ |
26 | 26 |
27 #define SECTOR_MAX 30 /* maximum number of sectors */ | 27 #define SECTOR_MAX 24 /* maximum number of sectors */ |
28 #define SECTOR_SCROLL 7 /* number of sectors used for scroll detection */ | 28 #define SECTOR_SCROLL 7 /* number of sectors used for scroll detection */ |
29 | 29 |
30 static detectionState_t detectionState = DETECT_NOTHING; | 30 detectionState_t detectionState = DETECT_NOTHING; |
31 static SSector sectorDetection; | 31 SSector sectorDetection; |
32 | 32 |
33 | 33 |
34 uint8_t GetSectorForPitch(float pitch) | 34 uint8_t GetSectorForPitch(float pitch) |
35 { | 35 { |
36 static uint8_t lastsector = 0; | 36 static uint8_t lastsector = 0; |
191 } | 191 } |
192 return PitchEvent; | 192 return PitchEvent; |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 uint8_t sectorhist[20]; | |
197 uint8_t sectorindex = 0; | |
198 /* Detect if user is generating an pitch including return to starting position */ | 196 /* Detect if user is generating an pitch including return to starting position */ |
199 /* This is done by feeding the past movements value per value into a state machine */ | 197 /* This is done by feeding the past movements value per value into a state machine */ |
200 detectionState_t detectPitch(float currentPitch) | 198 detectionState_t detectPitch(float currentPitch) |
201 { | 199 { |
202 static uint8_t lastSector = 0; | 200 static uint8_t lastSector = 0; |