Mercurial > public > ostc4
diff Discovery/Src/tMenuEditCustom.c @ 841:70092f552f5a Evo_2_23
Added autofocus for T3_DecoTTS view:
a switch to the DecoTTS view will now be triggered in case a new deco stop depth is added, a deco stopp has been missed or if a new 10 minutes TTS is passed.
author | Ideenmodellierer |
---|---|
date | Sun, 07 Jan 2024 21:25:34 +0100 |
parents | 8d6c35655d4d |
children | b2aad621aeb0 |
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditCustom.c Sun Jan 07 21:21:58 2024 +0100 +++ b/Discovery/Src/tMenuEditCustom.c Sun Jan 07 21:25:34 2024 +0100 @@ -48,10 +48,6 @@ #define MAX_FOCUS_LIMITER (2u) /* max number for reducing the spot used for focus detection */ -/* defines for autofocus of compass */ -#define AF_COMPASS_ACTIVATION_ANGLE (5.0f) /* angle for pitch and roll. Compass gets activated in case the value is smaller (OSTC4 hold in horitontal position */ -#define AF_COMPASS_DEBOUNCE (10u) /* debouncing value to avoid compass activation during normal movement */ - static uint8_t customviewsSubpage = 0; static uint8_t customviewsSubpageMax = 0; /* number of pages needed to display all selectable views */ static const uint8_t* pcv_curchangelist; @@ -1108,43 +1104,3 @@ } write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); } - -uint8_t HandleAFCompass() -{ - static uint8_t debounce = 0; - static uint8_t lastState = AF_VIEW_NOCHANGE; - uint8_t detectionState = AF_VIEW_NOCHANGE; - - float pitch = stateRealGetPointer()->lifeData.compass_pitch; - float roll = stateRealGetPointer()->lifeData.compass_roll; - - /* OSTC in horizontal position ?*/ - if((pitch > -AF_COMPASS_ACTIVATION_ANGLE) && (pitch < AF_COMPASS_ACTIVATION_ANGLE) && (roll > -AF_COMPASS_ACTIVATION_ANGLE) && (roll < AF_COMPASS_ACTIVATION_ANGLE)) - { - if(debounce < AF_COMPASS_DEBOUNCE) debounce++; - if(debounce == AF_COMPASS_DEBOUNCE) - { - detectionState = AF_VIEW_ACTIVATED; - } - } - else - { - if(debounce > 0) debounce--; - if(debounce == 0) - { - detectionState = AF_VIEW_DEACTIVATED; - } - } - if(detectionState) /* no state change => return 0 */ - { - if((detectionState == lastState)) - { - detectionState = AF_VIEW_NOCHANGE; - } - else - { - lastState = detectionState; - } - } - return detectionState; -}