Mercurial > public > ostc4
comparison 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 |
comparison
equal
deleted
inserted
replaced
840:7e714662b93f | 841:70092f552f5a |
---|---|
45 | 45 |
46 #define CV_PER_PAGE (5u) /* number of cv selections shown at one page */ | 46 #define CV_PER_PAGE (5u) /* number of cv selections shown at one page */ |
47 #define MAX_BACKLIGHT_BOOST (2u) /* max number of backlight levels which may be increased during focus state */ | 47 #define MAX_BACKLIGHT_BOOST (2u) /* max number of backlight levels which may be increased during focus state */ |
48 | 48 |
49 #define MAX_FOCUS_LIMITER (2u) /* max number for reducing the spot used for focus detection */ | 49 #define MAX_FOCUS_LIMITER (2u) /* max number for reducing the spot used for focus detection */ |
50 | |
51 /* defines for autofocus of compass */ | |
52 #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 */ | |
53 #define AF_COMPASS_DEBOUNCE (10u) /* debouncing value to avoid compass activation during normal movement */ | |
54 | 50 |
55 static uint8_t customviewsSubpage = 0; | 51 static uint8_t customviewsSubpage = 0; |
56 static uint8_t customviewsSubpageMax = 0; /* number of pages needed to display all selectable views */ | 52 static uint8_t customviewsSubpageMax = 0; /* number of pages needed to display all selectable views */ |
57 static const uint8_t* pcv_curchangelist; | 53 static const uint8_t* pcv_curchangelist; |
58 /* Private function prototypes -----------------------------------------------*/ | 54 /* Private function prototypes -----------------------------------------------*/ |
1106 text[textPointer] = 0; | 1102 text[textPointer] = 0; |
1107 write_label_var( 30, 800, ME_Y_LINE6, &FontT48, text); | 1103 write_label_var( 30, 800, ME_Y_LINE6, &FontT48, text); |
1108 } | 1104 } |
1109 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | 1105 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
1110 } | 1106 } |
1111 | |
1112 uint8_t HandleAFCompass() | |
1113 { | |
1114 static uint8_t debounce = 0; | |
1115 static uint8_t lastState = AF_VIEW_NOCHANGE; | |
1116 uint8_t detectionState = AF_VIEW_NOCHANGE; | |
1117 | |
1118 float pitch = stateRealGetPointer()->lifeData.compass_pitch; | |
1119 float roll = stateRealGetPointer()->lifeData.compass_roll; | |
1120 | |
1121 /* OSTC in horizontal position ?*/ | |
1122 if((pitch > -AF_COMPASS_ACTIVATION_ANGLE) && (pitch < AF_COMPASS_ACTIVATION_ANGLE) && (roll > -AF_COMPASS_ACTIVATION_ANGLE) && (roll < AF_COMPASS_ACTIVATION_ANGLE)) | |
1123 { | |
1124 if(debounce < AF_COMPASS_DEBOUNCE) debounce++; | |
1125 if(debounce == AF_COMPASS_DEBOUNCE) | |
1126 { | |
1127 detectionState = AF_VIEW_ACTIVATED; | |
1128 } | |
1129 } | |
1130 else | |
1131 { | |
1132 if(debounce > 0) debounce--; | |
1133 if(debounce == 0) | |
1134 { | |
1135 detectionState = AF_VIEW_DEACTIVATED; | |
1136 } | |
1137 } | |
1138 if(detectionState) /* no state change => return 0 */ | |
1139 { | |
1140 if((detectionState == lastState)) | |
1141 { | |
1142 detectionState = AF_VIEW_NOCHANGE; | |
1143 } | |
1144 else | |
1145 { | |
1146 lastState = detectionState; | |
1147 } | |
1148 } | |
1149 return detectionState; | |
1150 } |