Mercurial > public > ostc4
comparison Discovery/Inc/motion.h @ 383:49a02dea8ae3 MotionDetection
Combine variables in a structure to improve readability of code
Add function to compensate offsets from calculated to real sector center position
author | ideenmodellierer |
---|---|
date | Thu, 17 Oct 2019 21:15:42 +0200 |
parents | 4bb5ceebfaf9 |
children | e3237f580ae9 |
comparison
equal
deleted
inserted
replaced
382:14fd5f35cb50 | 383:49a02dea8ae3 |
---|---|
36 DETECT_NOTHING | 36 DETECT_NOTHING |
37 } detectionState_t; | 37 } detectionState_t; |
38 | 38 |
39 typedef struct | 39 typedef struct |
40 { | 40 { |
41 float upperlimit; | 41 float upperborder; /* current sector is changed if pitch exceeds these borders */ |
42 float lowerlimit; | 42 float lowerborder; |
43 | |
44 uint8_t current; /* number of the current visible sector */ | |
45 uint8_t target; /* used for sector switch => number of the sector which shall be finnaly displayed */ | |
46 | |
47 float offset; /* offset to adjust minimum pitch value used for detection to zero */ | |
48 float size; /* delta of upper and lower boarder defining the sector in degree */ | |
49 float window; /* defines which range of pitch values are used for detection */ | |
50 float center; /* defines the offset from pitch to middle of active sector (avoid center position is close to the calculated borders) */ | |
51 uint8_t count; /* number of sectors used for detection */ | |
43 } SSector; | 52 } SSector; |
53 | |
54 | |
55 | |
44 | 56 |
45 void InitMotionDetection(void); | 57 void InitMotionDetection(void); |
46 void DefinePitchSectors(float centerAngle, uint8_t numOfSectors); | 58 void DefinePitchSectors(float centerAngle, uint8_t numOfSectors); |
47 detectionState_t detectPitch(float currentPitch); | 59 detectionState_t detectPitch(float currentPitch); |
48 detectionState_t detectSectorButtonEvent(float curPitch); | 60 detectionState_t detectSectorButtonEvent(float curPitch); |