Mercurial > public > ostc4
annotate Discovery/Src/motion.c @ 626:3e1a0e267f38
Added option to select sensitivity of focus detection:
Depending on the location the computer is equiped during dive (arm wet/ dry suite, glove...) it is usefull to adapt the sensitivity of the focus detection. Technical it means the radius of the spot in which direction ray is projected may be changed in size.
The option has been added to the motion control menu.
author | Ideenmodellierer |
---|---|
date | Fri, 12 Feb 2021 21:37:50 +0100 |
parents | 028d8f3a9410 |
children | 189f945ae4ba |
rev | line source |
---|---|
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
1 /* |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
2 * motion.c |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
3 * |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
4 * Created on: 20.05.2019 |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
5 * Author: Thorsten Sonntag |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
6 */ |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
7 |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
8 #include <stdint.h> |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
9 #include <string.h> |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
10 #include <stdlib.h> |
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
11 #include <math.h> |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
12 #include "motion.h" |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
13 #include "data_central.h" |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
14 #include "t7.h" |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
15 #include "t3.h" |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
16 #include "settings.h" |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
17 #include "base.h" |
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
18 |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
19 #define STABLE_STATE_COUNT 2 /* number of count to declare a state as stable (at the moment based on 100ms) */ |
363 | 20 #define STABLE_STATE_TIMEOUT 5 /* Detection shall be aborted if a movement state is stable for more than 500ms */ |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
21 |
385
0cd862e501f6
Finetune parameter for detection of small sectors as used for the pitch detection
ideenmodellierer
parents:
384
diff
changeset
|
22 #define SECTOR_MAX 24 /* maximum number of sectors */ |
378
834e087505ec
Incremented "idle window" for scroll detection
ideenmodellierer
parents:
373
diff
changeset
|
23 #define SECTOR_SCROLL 7 /* number of sectors used for scroll detection */ |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
24 #define SECTOR_MAX_CNT 5 /* max number of views used for sector control */ |
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
25 |
551 | 26 #define MOTION_DELTA_STABLE 0 |
27 #define MOTION_DELTA_JITTER 1 | |
28 #define MOTION_DELTA_RAISE 2 | |
29 #define MOTION_DELTA_FALL 3 | |
30 | |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
31 #define MOTION_DELTA_JITTER_LEVEL 2.0 /* lower values are considered as stable */ |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
32 #define MOTION_DELTA_RAISE_LEVEL 4.0 /* Movement causing a significant change detected */ |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
33 #define MOTION_DELTA_FALL_LEVEL -4.0 /* Movement causing a significant change detected */ |
551 | 34 |
35 #define MOTION_DELTA_HISTORY_SIZE 20 /* Number of history data sets */ | |
36 | |
385
0cd862e501f6
Finetune parameter for detection of small sectors as used for the pitch detection
ideenmodellierer
parents:
384
diff
changeset
|
37 detectionState_t detectionState = DETECT_NOTHING; |
0cd862e501f6
Finetune parameter for detection of small sectors as used for the pitch detection
ideenmodellierer
parents:
384
diff
changeset
|
38 SSector sectorDetection; |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
39 |
551 | 40 static uint8_t motionDeltaHistory[3][MOTION_DELTA_HISTORY_SIZE]; /* Change history of roll, pitch and yaw */ |
41 static uint8_t motionDeltaHistoryIdx; /* Current index of history data */ | |
42 | |
43 static uint8_t focusCnt = 0; | |
44 static uint8_t inFocus = 0; | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
45 static uint8_t sectorMap[SECTOR_MAX_CNT]; |
551 | 46 |
611
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
47 static uint8_t suspendMotionDetectionSec = 0; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
48 |
551 | 49 void resetMotionDeltaHistory() |
50 { | |
51 motionDeltaHistoryIdx = 0; | |
52 memset(motionDeltaHistory, 0, sizeof(motionDeltaHistory)); | |
53 } | |
54 | |
55 void evaluateMotionDelta(float roll, float pitch, float yaw) | |
56 { | |
57 static float lastValue[3] = {0.0,0.0,0.0}; | |
58 uint8_t nextIndex = motionDeltaHistoryIdx + 1; | |
59 uint8_t axis; | |
60 float curValue; | |
61 | |
62 if(nextIndex == MOTION_DELTA_HISTORY_SIZE) | |
63 { | |
64 nextIndex = 0; | |
65 } | |
66 for(axis=0; axis < 3; axis++) | |
67 { | |
68 switch(axis) | |
69 { | |
70 case MOTION_HISTORY_ROLL: curValue = roll; | |
71 break; | |
72 case MOTION_HISTORY_PITCH: curValue = pitch; | |
73 break; | |
74 default: | |
75 case MOTION_HISTORY_YAW: if((yaw < 90) && (lastValue[MOTION_HISTORY_YAW] > 270.0)) /* transition 360 => 0 */ | |
76 { | |
77 lastValue[MOTION_HISTORY_YAW] -= 360; | |
78 } | |
79 else if((yaw > 270) && (lastValue[MOTION_HISTORY_YAW] < 90.0)) /* transition 0 => 360 */ | |
80 { | |
81 lastValue[MOTION_HISTORY_YAW] += 360; | |
82 } | |
83 curValue = yaw; | |
84 break; | |
85 } | |
86 if(curValue - lastValue[axis] > MOTION_DELTA_RAISE_LEVEL) | |
87 { | |
88 motionDeltaHistory[axis][nextIndex] = MOTION_DELTA_RAISE; | |
89 } | |
90 if(fabsf(curValue - lastValue[axis]) < MOTION_DELTA_RAISE_LEVEL) | |
91 { | |
92 motionDeltaHistory[axis][nextIndex] = MOTION_DELTA_JITTER; | |
93 } | |
94 if(fabsf(curValue - lastValue[axis]) < MOTION_DELTA_JITTER_LEVEL) | |
95 { | |
96 motionDeltaHistory[axis][nextIndex] = MOTION_DELTA_STABLE; | |
97 } | |
98 if(curValue - lastValue[axis] < MOTION_DELTA_FALL_LEVEL) | |
99 { | |
100 motionDeltaHistory[axis][nextIndex] = MOTION_DELTA_FALL; | |
101 } | |
102 lastValue[axis] = curValue; | |
103 } | |
104 motionDeltaHistoryIdx = nextIndex; | |
105 } | |
106 | |
107 SDeltaHistory GetDeltaHistory(uint8_t stepback) | |
108 { | |
578 | 109 uint8_t loop; |
551 | 110 uint8_t index = motionDeltaHistoryIdx; |
111 | |
112 SDeltaHistory result = {0,0,0}; | |
113 | |
578 | 114 stepback++; /* motionDeltaHistoryIdx is pointing to future entry => step back one to get the latest */ |
115 loop = stepback; | |
551 | 116 if(stepback < MOTION_DELTA_HISTORY_SIZE) |
117 { | |
118 while(loop != 0) /* find requested entry */ | |
119 { | |
120 loop--; | |
121 index--; | |
122 if(index == 0) | |
123 { | |
124 index = MOTION_DELTA_HISTORY_SIZE - 1; | |
125 } | |
126 } | |
127 result.roll = motionDeltaHistory[MOTION_HISTORY_ROLL][index]; | |
128 result.pitch = motionDeltaHistory[MOTION_HISTORY_PITCH][index]; | |
129 result.yaw = motionDeltaHistory[MOTION_HISTORY_YAW][index]; | |
130 } | |
131 return result; | |
132 } | |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
133 |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
134 uint8_t GetSectorForFocus(float focusOffset) |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
135 { |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
136 uint8_t sector = 0; |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
137 float compare = 0.1; |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
138 |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
139 while(compare <= 0.5) |
381 | 140 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
141 if(focusOffset > compare) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
142 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
143 sector++; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
144 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
145 else |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
146 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
147 break; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
148 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
149 compare += 0.1; |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
150 } |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
151 if(sector > sectorDetection.count) |
381 | 152 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
153 sector = sectorDetection.count; |
381 | 154 } |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
155 return sector; |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
156 } |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
157 |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
158 void DefineSectorCount(uint8_t numOfSectors) |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
159 { |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
160 if(numOfSectors == CUSTOMER_DEFINED_VIEWS) |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
161 { |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
162 if(settingsGetPointer()->design == 3) /* Big font view ? */ |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
163 { |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
164 sectorDetection.count = t3_GetEnabled_customviews(); |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
165 } |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
166 else |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
167 { |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
168 sectorDetection.count = t7_GetEnabled_customviews(); |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
169 } |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
170 if(sectorDetection.count > SECTOR_MAX_CNT) |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
171 { |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
172 sectorDetection.count = SECTOR_MAX_CNT; /* more views are hard to manually control */ |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
173 } |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
174 } |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
175 else |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
176 if(numOfSectors != CUSTOMER_KEEP_LAST_SECTORS) |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
177 { |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
178 sectorDetection.count = numOfSectors; |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
179 } |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
180 } |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
181 |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
182 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
183 uint8_t GetCVForSector(uint8_t selSector) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
184 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
185 if(selSector < sectorDetection.count) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
186 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
187 return sectorMap[selSector]; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
188 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
189 else |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
190 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
191 return 0; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
192 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
193 } |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
194 |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
195 void MapCVToSector() |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
196 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
197 uint8_t ViewIndex = 0; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
198 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
199 memset(sectorMap, 0, sizeof(sectorMap)); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
200 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
201 if(settingsGetPointer()->design == 3) /* Big font view ? */ |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
202 { |
595 | 203 t3_set_customview_to_primary(); |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
204 sectorMap[ViewIndex] = t3_change_customview(ACTION_END); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
205 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
206 else |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
207 { |
595 | 208 t7_set_customview_to_primary(); |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
209 sectorMap[ViewIndex] = t7_change_customview(ACTION_END); |
595 | 210 |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
211 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
212 |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
213 ViewIndex++; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
214 while(ViewIndex < sectorDetection.count) |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
215 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
216 if(settingsGetPointer()->design == 3) /* Big font view ? */ |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
217 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
218 sectorMap[ViewIndex] = t3_change_customview(ACTION_BUTTON_ENTER); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
219 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
220 else |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
221 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
222 sectorMap[ViewIndex] = t7_change_customview(ACTION_BUTTON_ENTER); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
223 } |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
224 ViewIndex++; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
225 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
226 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
227 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
228 |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
229 void InitMotionDetection(void) |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
230 { |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
231 sectorDetection.target = 0; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
232 sectorDetection.current = 0; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
233 sectorDetection.size = 0; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
234 sectorDetection.count = 0; |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
235 |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
236 switch(settingsGetPointer()->MotionDetection) |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
237 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
238 case MOTION_DETECT_SECTOR: DefineSectorCount(CUSTOMER_DEFINED_VIEWS); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
239 MapCVToSector(); |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
240 break; |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
241 case MOTION_DETECT_MOVE: DefineSectorCount(SECTOR_MAX); |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
242 break; |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
243 case MOTION_DETECT_SCROLL: DefineSectorCount(SECTOR_SCROLL); |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
244 break; |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
245 default: |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
246 break; |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
247 } |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
248 |
551 | 249 resetMotionDeltaHistory(); |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
250 } |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
251 |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
252 /* Map the current pitch value to a sector and create button event in case the sector is left */ |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
253 detectionState_t detectSectorButtonEvent(float focusOffset) |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
254 { |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
255 uint8_t newTargetSector; |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
256 |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
257 newTargetSector = GetSectorForFocus(focusOffset); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
258 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
259 if(settingsGetPointer()->design == 3) /* Big font view ? */ |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
260 { |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
261 t3_select_customview(GetCVForSector(newTargetSector)); |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
262 } |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
263 else |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
264 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
265 t7_select_customview(GetCVForSector(newTargetSector)); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
266 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
267 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
268 return DETECT_NOTHING; |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
269 } |
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
270 |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
271 /* Check if pitch is not in center position and trigger a button action if needed */ |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
272 detectionState_t detectScrollButtonEvent(float focusOffset) |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
273 { |
378
834e087505ec
Incremented "idle window" for scroll detection
ideenmodellierer
parents:
373
diff
changeset
|
274 static uint8_t delayscroll = 0; /* slow down the number of scroll events */ |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
275 |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
276 uint8_t PitchEvent = DETECT_NOTHING; |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
277 |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
278 if(delayscroll == 0) |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
279 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
280 if(focusOffset > 0.3) |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
281 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
282 PitchEvent = DETECT_POS_PITCH; |
574 | 283 delayscroll = 7; |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
284 } |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
285 } |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
286 else |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
287 { |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
288 delayscroll--; |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
289 } |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
290 return PitchEvent; |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
291 } |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
292 |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
293 |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
294 /* Detect if user is generating an pitch including return to starting position */ |
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
295 /* This is done by feeding the past movements value per value into a state machine */ |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
296 detectionState_t detectPitch(float currentPitch) |
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
297 { |
578 | 298 static int8_t lastStart = 0; |
551 | 299 uint8_t exit = 0; |
578 | 300 int8_t step = 0; |
574 | 301 uint8_t duration = 0; |
551 | 302 SDeltaHistory test; |
370
77cdfbdaca8c
Changed function names from shake to pitch and improved detection function: Shake might be confusing for people reading the code because pitch values are ased for calculation => changed name to pitch to be more transparent
ideenmodellierer
parents:
363
diff
changeset
|
303 |
578 | 304 if(lastStart < 0) |
305 { | |
306 detectionState = DETECT_NOTHING; | |
307 lastStart = 0; | |
308 } | |
309 else | |
310 { | |
311 detectionState = DETECT_START; | |
312 } | |
313 step = lastStart; | |
314 do | |
551 | 315 { |
316 test = GetDeltaHistory(step); | |
574 | 317 duration++; |
551 | 318 switch (detectionState) |
319 { | |
320 case DETECT_NOTHING: if(test.pitch > MOTION_DELTA_STABLE) | |
321 { | |
322 exit = 1; | |
578 | 323 lastStart = -2; |
551 | 324 } |
325 else | |
326 { | |
327 detectionState = DETECT_START; | |
578 | 328 lastStart = -1; |
551 | 329 } |
330 break; | |
331 case DETECT_START: if(test.pitch == MOTION_DELTA_RAISE) | |
332 { | |
333 detectionState = DETECT_POS_MOVE; | |
578 | 334 lastStart = step; |
551 | 335 } |
578 | 336 else |
551 | 337 if(test.pitch == MOTION_DELTA_FALL) |
338 { | |
339 detectionState = DETECT_NEG_MOVE; | |
578 | 340 lastStart = step; |
341 } | |
342 else | |
343 { | |
344 lastStart = -1; | |
551 | 345 } |
574 | 346 duration = 0; |
551 | 347 break; |
578 | 348 case DETECT_NEG_MOVE: if((test.pitch <= MOTION_DELTA_JITTER) || (test.pitch == MOTION_DELTA_RAISE)) |
349 { | |
350 detectionState++; | |
351 } | |
352 break; | |
353 case DETECT_POS_MOVE: if((test.pitch <= MOTION_DELTA_JITTER) || (test.pitch == MOTION_DELTA_FALL)) | |
551 | 354 { |
355 detectionState++; | |
356 } | |
357 break; | |
358 case DETECT_MAXIMA: if(test.pitch == MOTION_DELTA_FALL) | |
359 { | |
360 detectionState = DETECT_FALLBACK; | |
361 } | |
362 break; | |
363 case DETECT_MINIMA: if(test.pitch == MOTION_DELTA_RAISE) | |
364 { | |
365 detectionState = DETECT_RISEBACK; | |
366 } | |
367 break; | |
368 case DETECT_RISEBACK: | |
369 case DETECT_FALLBACK: if(test.pitch == MOTION_DELTA_STABLE) | |
370 { | |
578 | 371 if(duration > 4) /* avoid detection triggered by short moves */ |
574 | 372 { |
373 detectionState++; | |
374 } | |
578 | 375 exit = 1; |
376 lastStart = -2; | |
551 | 377 } |
378 break; | |
379 default: | |
380 detectionState = DETECT_NOTHING; | |
381 exit = 1; | |
382 break; | |
383 } | |
578 | 384 step--; |
385 } while((step >= 0) && (!exit)); | |
386 | |
387 if((lastStart < MOTION_DELTA_HISTORY_SIZE)) | |
388 { | |
389 lastStart++; /* prepare value for next iteration (history index will be increased) */ | |
390 } | |
391 else | |
392 { | |
393 lastStart = -1; | |
551 | 394 } |
395 if((detectionState != DETECT_POS_PITCH) && (detectionState != DETECT_NEG_PITCH)) /* nothing found */ | |
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
396 { |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
397 detectionState = DETECT_NOTHING; |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
398 } |
551 | 399 else /* dont detect the same event twice */ |
400 { | |
401 resetMotionDeltaHistory(); | |
402 } | |
403 return detectionState; | |
404 } | |
363 | 405 |
551 | 406 void anglesToCoord(float roll, float pitch, float yaw, SCoord *pCoord) |
407 { | |
408 pCoord->x = ((cosf(yaw) * cosf(pitch)) * pCoord->x + (cosf(yaw)*sinf(pitch)*sinf(roll) - (sinf(yaw)* cosf(roll))) * pCoord->y + (cosf(yaw)*sinf(pitch)*cosf(roll) + sinf(yaw)*sinf(roll)) * pCoord->z); | |
409 pCoord->y = ((sinf(yaw) * cosf(pitch)) * pCoord->x + (sinf(yaw)*sinf(pitch)*sinf(roll) + cosf(yaw) * cosf(roll)) * pCoord->y + ( sinf(yaw) * sinf(pitch) * cosf(roll) - cosf(yaw) * sinf(roll))* pCoord->z); | |
410 pCoord->z = ((-1*sinf(pitch)) * pCoord->x + (cosf(pitch) *sinf(roll)) * pCoord->y + (cosf(pitch) * cosf(roll))* pCoord->z); | |
411 } | |
412 | |
413 SCoord CoordAdd(SCoord cA, SCoord cB) | |
414 { | |
415 SCoord result; | |
416 | |
417 result.x = cA.x + cB.x; | |
418 result.y = cA.y + cB.y; | |
419 result.z = cA.z + cB.z; | |
420 return result; | |
421 } | |
422 | |
423 SCoord CoordSub(SCoord cA, SCoord cB) | |
424 { | |
425 SCoord result; | |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
426 |
551 | 427 result.x = cA.x - cB.x; |
428 result.y = cA.y - cB.y; | |
429 result.z = cA.z - cB.z; | |
430 return result; | |
431 } | |
432 | |
433 SCoord CoordCross(SCoord cA, SCoord cB) | |
434 { | |
435 SCoord result; | |
436 | |
437 result.x = (cA.y * cB.z) - (cA.z * cB.y); | |
438 result.y = (cA.z * cB.x) - (cA.x * cB.z); | |
439 result.z = (cA.x * cB.y) - (cA.y * cB.x); | |
440 | |
441 return result; | |
442 | |
443 } | |
444 | |
445 SCoord CoordMulF(SCoord op, float factor) | |
446 { | |
447 SCoord result; | |
448 result.x = (op.x * factor); | |
449 result.y = (op.y * factor); | |
450 result.z = (op.z * factor); | |
451 | |
452 return result; | |
453 } | |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
454 |
551 | 455 SCoord CoordDivF(SCoord op, float factor) |
456 { | |
457 SCoord result; | |
458 result.x = (op.x / factor); | |
459 result.y = (op.y / factor); | |
460 result.z = (op.z / factor); | |
461 | |
462 return result; | |
463 } | |
464 | |
465 float CoordDot(SCoord cA, SCoord cB) | |
466 { | |
467 float result; | |
468 | |
469 result = cA.x * cB.x + cA.y * cB.y + cB.z*cA.z; | |
470 return result; | |
471 } | |
472 | |
473 void calibrateViewport(float roll, float pitch, float yaw) | |
474 { | |
475 SSettings* pSettings = settingsGetPointer(); | |
476 | |
621 | 477 pSettings->viewPitch = pitch + 180; |
478 pSettings->viewRoll = roll+ 180; | |
551 | 479 pSettings->viewYaw = yaw; |
480 } | |
481 | |
482 | |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
483 float checkViewport(float roll, float pitch, float yaw, uint8_t enableAxis) |
551 | 484 { |
485 uint8_t retval = 0; | |
486 float angleYaw; | |
487 float anglePitch; | |
488 float angleRoll; | |
489 float distance = 0; | |
490 float _a, _b; | |
491 SCoord u,v,n; | |
492 float r; | |
493 | |
494 SCoord refVec; | |
495 SCoord axis_1; | |
496 SCoord axis_2; | |
497 SCoord curVec; | |
498 SCoord resultVec; | |
499 | |
500 SSettings* pSettings = settingsGetPointer(); | |
501 | |
621 | 502 roll += 180; |
503 pitch += 180; | |
504 | |
551 | 505 /* calculate base vector taking calibration delta into account yaw (heading) */ |
621 | 506 float compYaw; |
574 | 507 |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
508 if(enableAxis & MOTION_ENABLE_YAW) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
509 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
510 compYaw = 360.0 - yaw; /* turn to 0° */ |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
511 compYaw += pSettings->viewYaw; /* consider calib yaw value */ |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
512 compYaw += yaw; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
513 |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
514 if (compYaw < 0.0) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
515 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
516 compYaw = 360.0 + compYaw; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
517 } |
574 | 518 |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
519 if (compYaw > 360.0) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
520 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
521 compYaw = compYaw - 360.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
522 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
523 if (compYaw > 360.0) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
524 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
525 compYaw = compYaw - 360.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
526 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
527 angleYaw = pSettings->viewYaw * M_PI / 180.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
528 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
529 else |
551 | 530 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
531 compYaw = 0.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
532 angleYaw = 0.0; |
381 | 533 } |
551 | 534 |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
535 if(enableAxis & MOTION_ENABLE_PITCH) |
381 | 536 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
537 anglePitch = pSettings->viewPitch * M_PI / 180.0; |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
538 } |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
539 else |
574 | 540 { |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
541 anglePitch = 0; |
574 | 542 } |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
543 if(enableAxis & MOTION_ENABLE_ROLL) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
544 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
545 angleRoll = pSettings->viewRoll * M_PI / 180.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
546 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
547 else |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
548 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
549 angleRoll = 0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
550 } |
551 | 551 |
552 refVec.x = 0; | |
553 refVec.y = 0; | |
554 refVec.z = 1.0; | |
555 | |
556 anglesToCoord(angleRoll,anglePitch,angleYaw, &refVec); | |
557 | |
558 /* assume x = 0 and y = 1 => find matching vector so axis_1 is 90° to axis_2 */ | |
559 axis_1.x = 0; | |
560 if(refVec.y >=0) | |
561 { | |
562 axis_2.y = 1; /* => Spawn y == refVec y */ | |
563 } | |
564 else axis_1.y = -1; | |
565 axis_1.z = -1.0 * refVec.y / refVec.z; | |
566 axis_2 = CoordCross(refVec, axis_1); /* Cross is 90° to refVec and Spawn as well => Plane Spawn / cross */ | |
567 | |
568 /* check if detection plane is correct */ | |
569 u = CoordSub(axis_1,refVec); | |
570 v = CoordSub(axis_2,refVec); | |
571 n = CoordCross(u,v); | |
572 | |
573 if((fabsf(n.x) <= 0.0001) && (fabsf(n.y) <= 0.0001) && (fabsf(n.z) <= 0.0001)) | |
574 { | |
575 retval = 2; | |
576 } | |
577 else | |
578 { | |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
579 if(enableAxis & MOTION_ENABLE_PITCH) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
580 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
581 anglePitch = pitch * M_PI / 180.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
582 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
583 else |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
584 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
585 anglePitch = 0.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
586 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
587 if(enableAxis & MOTION_ENABLE_ROLL) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
588 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
589 angleRoll = roll * M_PI / 180.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
590 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
591 else |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
592 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
593 angleRoll = 0.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
594 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
595 if(enableAxis & MOTION_ENABLE_YAW) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
596 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
597 angleYaw = compYaw * M_PI / 180.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
598 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
599 else |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
600 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
601 angleYaw = 0.0; |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
602 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
603 |
551 | 604 curVec.x = 0; |
605 curVec.y = 0; | |
606 curVec.z = 1.0; | |
607 anglesToCoord(angleRoll,anglePitch,angleYaw, &curVec); | |
608 | |
609 _a = CoordDot(curVec,n); | |
610 _b = CoordDot(refVec,n); | |
611 | |
612 if(_b>=(-0.0001)&&_b<=0.0001) /* Check if view port is parallel (no matchpoint) */ | |
613 { | |
614 retval = 3; | |
615 } | |
616 else | |
617 { | |
618 r=_a/_b; | |
619 if(r<0.00||r>1.40) /* are we looking into wrong direction? */ | |
620 { | |
621 retval = 4; | |
622 } | |
623 } | |
624 distance = retval * 1.0; /* just for debugging */ | |
625 if(retval == 0) | |
626 { | |
627 /* start calculating the matchpoint */ | |
628 curVec = CoordMulF(curVec,r); | |
629 resultVec = CoordSub(refVec,curVec); | |
630 | |
631 /* calculate the distance between reference and actual vector */ | |
632 resultVec.x = resultVec.x * resultVec.x; | |
633 resultVec.y = resultVec.y * resultVec.y; | |
634 resultVec.z = resultVec.z * resultVec.z; | |
635 | |
636 if((resultVec.x == 0) && (resultVec.y == 0) && (resultVec.z == 0)) | |
637 { | |
638 distance = 0.0; | |
639 } | |
640 else | |
641 { | |
642 distance = sqrtf((resultVec.x + resultVec.y + resultVec.z)); | |
643 } | |
644 } | |
645 } | |
646 | |
647 if(distance < 0.5) /* handle focus counter to avoid fast in/out focus changes */ | |
648 { | |
649 if(focusCnt < 10) | |
650 { | |
651 if((focusCnt == 9) && (inFocus == 0)) /* we will get into focus */ | |
652 { | |
653 resetMotionDeltaHistory(); | |
654 } | |
655 focusCnt++; | |
656 } | |
574 | 657 if((focusCnt == 10) && (inFocus == 0)) |
551 | 658 { |
659 inFocus = 1; | |
660 } | |
661 } | |
662 else | |
663 { | |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
664 if(focusCnt >= 5) /* Reset focus faster then setting focus */ |
551 | 665 { |
666 focusCnt--; | |
667 } | |
668 else | |
669 { | |
574 | 670 focusCnt = 0; |
551 | 671 inFocus = 0; |
672 } | |
673 } | |
674 return distance; | |
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
675 } |
551 | 676 uint8_t viewInFocus(void) |
677 { | |
678 return inFocus; | |
679 } | |
680 void resetFocusState(void) | |
681 { | |
682 inFocus = 0; | |
683 } | |
611
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
684 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
685 void suspendMotionDetection(uint8_t seconds) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
686 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
687 suspendMotionDetectionSec = seconds * 10; /* detection function is called every 100ms */ |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
688 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
689 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
690 void HandleMotionDetection(void) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
691 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
692 detectionState_t pitchstate = DETECT_NOTHING; |
618
96af74455420
Development bugfix: focus state not remembered:
Ideenmodellierer
parents:
611
diff
changeset
|
693 static uint8_t wasInFocus = 0; |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
694 float focusOffset = 0.0; |
611
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
695 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
696 evaluateMotionDelta(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading); |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
697 if(viewInFocus()) |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
698 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
699 focusOffset = checkViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading, (MOTION_ENABLE_PITCH | MOTION_ENABLE_YAW)); |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
700 } |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
701 else |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
702 { |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
703 focusOffset = checkViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading, MOTION_ENABLE_ALL); |
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
704 } |
611
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
705 if(viewInFocus()) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
706 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
707 wasInFocus = 1; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
708 set_Backlight_Boost(settingsGetPointer()->viewPortMode & 0x03); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
709 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
710 if(suspendMotionDetectionSec == 0) /* suspend detection while diver is manually operating the OSTC */ |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
711 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
712 switch(settingsGetPointer()->MotionDetection) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
713 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
714 case MOTION_DETECT_MOVE: pitchstate = detectPitch(stateRealGetPointer()->lifeData.compass_pitch); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
715 break; |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
716 case MOTION_DETECT_SECTOR: pitchstate = detectSectorButtonEvent(focusOffset); |
611
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
717 break; |
625
028d8f3a9410
Switch Sector / Scroll detection to vector implementation:
Ideenmodellierer
parents:
621
diff
changeset
|
718 case MOTION_DETECT_SCROLL: pitchstate = detectScrollButtonEvent(focusOffset); |
611
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
719 break; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
720 default: |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
721 pitchstate = DETECT_NOTHING; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
722 break; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
723 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
724 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
725 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
726 if(DETECT_NEG_PITCH == pitchstate) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
727 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
728 StoreButtonAction((uint8_t)ACTION_PITCH_NEG); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
729 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
730 if(DETECT_POS_PITCH == pitchstate) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
731 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
732 StoreButtonAction((uint8_t)ACTION_PITCH_POS); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
733 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
734 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
735 else |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
736 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
737 if(wasInFocus) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
738 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
739 wasInFocus = 0; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
740 if(suspendMotionDetectionSec == 0) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
741 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
742 if(settingsGetPointer()->design == 7) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
743 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
744 t7_set_customview_to_primary(); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
745 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
746 else |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
747 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
748 t3_set_customview_to_primary(); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
749 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
750 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
751 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
752 set_Backlight_Boost(0); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
753 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
754 if(suspendMotionDetectionSec != 0) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
755 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
756 suspendMotionDetectionSec--; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
757 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
758 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
759 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
760 |