Mercurial > public > ostc4
diff 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 |
line wrap: on
line diff
--- a/Discovery/Inc/motion.h Thu Oct 10 22:26:03 2019 +0200 +++ b/Discovery/Inc/motion.h Thu Oct 17 21:15:42 2019 +0200 @@ -38,10 +38,22 @@ typedef struct { - float upperlimit; - float lowerlimit; + float upperborder; /* current sector is changed if pitch exceeds these borders */ + float lowerborder; + + uint8_t current; /* number of the current visible sector */ + uint8_t target; /* used for sector switch => number of the sector which shall be finnaly displayed */ + + float offset; /* offset to adjust minimum pitch value used for detection to zero */ + float size; /* delta of upper and lower boarder defining the sector in degree */ + float window; /* defines which range of pitch values are used for detection */ + float center; /* defines the offset from pitch to middle of active sector (avoid center position is close to the calculated borders) */ + uint8_t count; /* number of sectors used for detection */ } SSector; + + + void InitMotionDetection(void); void DefinePitchSectors(float centerAngle, uint8_t numOfSectors); detectionState_t detectPitch(float currentPitch);