Mercurial > public > ostc4
annotate Discovery/Src/motion.c @ 623:ba83a8ef9bad
Improvment frame Handling:
In previous version, especially during fast menu operations, from time to time a flicker (in case of cyclic updated views) or corrupted menus appeared. Possible root cause is a interferance in the chain: refresh display (~100ms) => release frame (in parallel to) provide frame (~45ms) => clear frame (~45ms). to improve the behaviour the clear frame loop is not iterated until all bufferes are cleared (before one buffer every~45ms). getFrame() does now iterate through all frame buffers instead reusing the first possible (to avoid ghoust views and to provide more time to housekeeping function for cleanup)
author | Ideenmodellierer |
---|---|
date | Sun, 07 Feb 2021 22:04:43 +0100 |
parents | 6826731ff2be |
children | 028d8f3a9410 |
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 |
585
4dfdf230d8ba
Reduced view angle and number of vusiualized custom views in setor mode:
Ideenmodellierer
parents:
578
diff
changeset
|
22 #define SECTOR_WINDOW 30.0 /* Pitch window which is used for custom view projection */ |
381 | 23 #define SECTOR_WINDOW_MAX 120.0 /* Pitch window which will be greater than the divers field of view */ |
385
0cd862e501f6
Finetune parameter for detection of small sectors as used for the pitch detection
ideenmodellierer
parents:
384
diff
changeset
|
24 #define SECTOR_HYSTERY 2 /* Additional offset to avoid fast changing displays */ |
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
|
25 #define SECTOR_BORDER 400.0 /* Define a value which is out of limit to avoid not wanted key events */ |
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
|
26 #define SECTOR_FILTER 10 /* Define speed for calculated angle to follow real value */ |
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
|
27 |
385
0cd862e501f6
Finetune parameter for detection of small sectors as used for the pitch detection
ideenmodellierer
parents:
384
diff
changeset
|
28 #define SECTOR_MAX 24 /* maximum number of sectors */ |
378
834e087505ec
Incremented "idle window" for scroll detection
ideenmodellierer
parents:
373
diff
changeset
|
29 #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
|
30 #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
|
31 |
551 | 32 #define MOTION_DELTA_STABLE 0 |
33 #define MOTION_DELTA_JITTER 1 | |
34 #define MOTION_DELTA_RAISE 2 | |
35 #define MOTION_DELTA_FALL 3 | |
36 | |
37 #define MOTION_DELTA_JITTER_LEVEL 3.0 /* lower values are considered as stable */ | |
574 | 38 #define MOTION_DELTA_RAISE_LEVEL 6.0 /* Movement causing a significant change detected */ |
551 | 39 #define MOTION_DELTA_FALL_LEVEL -6.0 /* Movement causing a significant change detected */ |
40 | |
41 #define MOTION_DELTA_HISTORY_SIZE 20 /* Number of history data sets */ | |
42 | |
385
0cd862e501f6
Finetune parameter for detection of small sectors as used for the pitch detection
ideenmodellierer
parents:
384
diff
changeset
|
43 detectionState_t detectionState = DETECT_NOTHING; |
0cd862e501f6
Finetune parameter for detection of small sectors as used for the pitch detection
ideenmodellierer
parents:
384
diff
changeset
|
44 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
|
45 |
551 | 46 static uint8_t motionDeltaHistory[3][MOTION_DELTA_HISTORY_SIZE]; /* Change history of roll, pitch and yaw */ |
47 static uint8_t motionDeltaHistoryIdx; /* Current index of history data */ | |
48 | |
49 static uint8_t focusCnt = 0; | |
50 static uint8_t inFocus = 0; | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
51 static uint8_t sectorMap[SECTOR_MAX_CNT]; |
551 | 52 |
611
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
53 static uint8_t suspendMotionDetectionSec = 0; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
54 |
551 | 55 void resetMotionDeltaHistory() |
56 { | |
57 motionDeltaHistoryIdx = 0; | |
58 memset(motionDeltaHistory, 0, sizeof(motionDeltaHistory)); | |
59 } | |
60 | |
61 void evaluateMotionDelta(float roll, float pitch, float yaw) | |
62 { | |
63 static float lastValue[3] = {0.0,0.0,0.0}; | |
64 uint8_t nextIndex = motionDeltaHistoryIdx + 1; | |
65 uint8_t axis; | |
66 float curValue; | |
67 | |
68 if(nextIndex == MOTION_DELTA_HISTORY_SIZE) | |
69 { | |
70 nextIndex = 0; | |
71 } | |
72 for(axis=0; axis < 3; axis++) | |
73 { | |
74 switch(axis) | |
75 { | |
76 case MOTION_HISTORY_ROLL: curValue = roll; | |
77 break; | |
78 case MOTION_HISTORY_PITCH: curValue = pitch; | |
79 break; | |
80 default: | |
81 case MOTION_HISTORY_YAW: if((yaw < 90) && (lastValue[MOTION_HISTORY_YAW] > 270.0)) /* transition 360 => 0 */ | |
82 { | |
83 lastValue[MOTION_HISTORY_YAW] -= 360; | |
84 } | |
85 else if((yaw > 270) && (lastValue[MOTION_HISTORY_YAW] < 90.0)) /* transition 0 => 360 */ | |
86 { | |
87 lastValue[MOTION_HISTORY_YAW] += 360; | |
88 } | |
89 curValue = yaw; | |
90 break; | |
91 } | |
92 if(curValue - lastValue[axis] > MOTION_DELTA_RAISE_LEVEL) | |
93 { | |
94 motionDeltaHistory[axis][nextIndex] = MOTION_DELTA_RAISE; | |
95 } | |
96 if(fabsf(curValue - lastValue[axis]) < MOTION_DELTA_RAISE_LEVEL) | |
97 { | |
98 motionDeltaHistory[axis][nextIndex] = MOTION_DELTA_JITTER; | |
99 } | |
100 if(fabsf(curValue - lastValue[axis]) < MOTION_DELTA_JITTER_LEVEL) | |
101 { | |
102 motionDeltaHistory[axis][nextIndex] = MOTION_DELTA_STABLE; | |
103 } | |
104 if(curValue - lastValue[axis] < MOTION_DELTA_FALL_LEVEL) | |
105 { | |
106 motionDeltaHistory[axis][nextIndex] = MOTION_DELTA_FALL; | |
107 } | |
108 lastValue[axis] = curValue; | |
109 } | |
110 motionDeltaHistoryIdx = nextIndex; | |
111 } | |
112 | |
113 SDeltaHistory GetDeltaHistory(uint8_t stepback) | |
114 { | |
578 | 115 uint8_t loop; |
551 | 116 uint8_t index = motionDeltaHistoryIdx; |
117 | |
118 SDeltaHistory result = {0,0,0}; | |
119 | |
578 | 120 stepback++; /* motionDeltaHistoryIdx is pointing to future entry => step back one to get the latest */ |
121 loop = stepback; | |
551 | 122 if(stepback < MOTION_DELTA_HISTORY_SIZE) |
123 { | |
124 while(loop != 0) /* find requested entry */ | |
125 { | |
126 loop--; | |
127 index--; | |
128 if(index == 0) | |
129 { | |
130 index = MOTION_DELTA_HISTORY_SIZE - 1; | |
131 } | |
132 } | |
133 result.roll = motionDeltaHistory[MOTION_HISTORY_ROLL][index]; | |
134 result.pitch = motionDeltaHistory[MOTION_HISTORY_PITCH][index]; | |
135 result.yaw = motionDeltaHistory[MOTION_HISTORY_YAW][index]; | |
136 } | |
137 return result; | |
138 } | |
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
|
139 |
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
|
140 uint8_t GetSectorForPitch(float pitch) |
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
|
141 { |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
142 static uint8_t lastsector = 0; |
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
|
143 float newPitch; |
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
|
144 uint8_t sector = 0; |
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
|
145 |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
146 newPitch = pitch + sectorDetection.offset + sectorDetection.center; /* do not use negative values and consider offset to center position */ |
381 | 147 if (newPitch < 0.0) /* clip value */ |
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
|
148 { |
381 | 149 newPitch = 0.0; |
150 } | |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
151 if (newPitch > sectorDetection.window) /* clip value */ |
381 | 152 { |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
153 newPitch = sectorDetection.window; |
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
|
154 } |
381 | 155 |
156 /* switch to other sector? */ | |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
157 if((newPitch > sectorDetection.upperborder) || (newPitch <= sectorDetection.lowerborder)) |
381 | 158 { |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
159 sector = (uint16_t) newPitch / sectorDetection.size; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
160 sectorDetection.lowerborder = sector * sectorDetection.size - SECTOR_HYSTERY; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
161 sectorDetection.upperborder = (sector + 1) * sectorDetection.size + SECTOR_HYSTERY; |
381 | 162 lastsector = sector; |
163 } | |
164 | |
165 return lastsector; | |
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
|
166 } |
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
|
167 |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
168 void DefinePitchSectors(float centerPitch,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
|
169 { |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
170 if(numOfSectors == CUSTOMER_DEFINED_VIEWS) |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
171 { |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
172 if(settingsGetPointer()->design == 3) /* Big font view ? */ |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
173 { |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
174 sectorDetection.count = t3_GetEnabled_customviews(); |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
175 } |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
176 else |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
177 { |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
178 sectorDetection.count = t7_GetEnabled_customviews(); |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
383
diff
changeset
|
179 } |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
180 if(sectorDetection.count > SECTOR_MAX_CNT) |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
181 { |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
182 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
|
183 } |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
184 } |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
185 else |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
186 if(numOfSectors != CUSTOMER_KEEP_LAST_SECTORS) |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
187 { |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
188 sectorDetection.count = numOfSectors; |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
189 } |
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
|
190 |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
191 if(sectorDetection.count == SECTOR_MAX) |
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
|
192 { |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
193 sectorDetection.window = SECTOR_WINDOW_MAX; |
381 | 194 } |
195 else | |
196 { | |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
197 sectorDetection.window = SECTOR_WINDOW; |
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
|
198 } |
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
|
199 |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
200 sectorDetection.offset = (centerPitch - (sectorDetection.window / 2)) * -1.0; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
201 sectorDetection.size = sectorDetection.window / sectorDetection.count; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
202 sectorDetection.center = 0; |
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
|
203 |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
204 /* reset border values */ |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
205 sectorDetection.lowerborder = SECTOR_BORDER; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
206 sectorDetection.upperborder = SECTOR_BORDER * -1.0; |
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
|
207 /* get the current sector */ |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
208 sectorDetection.current = GetSectorForPitch(stateRealGetPointer()->lifeData.compass_pitch); |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
209 sectorDetection.target = sectorDetection.current; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
210 /* do a small adjustment to center pitch to make sure the actual pitch is in the center of the current sector */ |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
211 sectorDetection.center = (sectorDetection.upperborder) - ((sectorDetection.size + 2 *SECTOR_HYSTERY) / 2.0) - (centerPitch + sectorDetection.offset); |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
212 |
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
|
213 } |
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
|
214 |
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 uint8_t GetCVForSector(uint8_t selSector) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
217 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
218 if(selSector < sectorDetection.count) |
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 return sectorMap[selSector]; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
221 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
222 else |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
223 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
224 return 0; |
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 void MapCVToSector() |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
228 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
229 uint8_t centerView = 0; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
230 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
231 memset(sectorMap, 0, sizeof(sectorMap)); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
232 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
233 switch(sectorDetection.count) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
234 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
235 case 1: centerView = 0; break; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
236 case 2: centerView = 0; break; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
237 case 3: centerView = 1; break; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
238 case 4: centerView = 1; break; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
239 case 5: centerView = 2; break; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
240 default: centerView = sectorDetection.count / 2 - 1; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
241 break; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
242 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
243 if(settingsGetPointer()->design == 3) /* Big font view ? */ |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
244 { |
595 | 245 t3_set_customview_to_primary(); |
246 sectorMap[centerView] = t3_change_customview(ACTION_END); | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
247 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
248 else |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
249 { |
595 | 250 t7_set_customview_to_primary(); |
251 sectorMap[centerView] = t7_change_customview(ACTION_END); | |
252 | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
253 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
254 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
255 centerView++; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
256 while(sectorMap[centerView] == 0) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
257 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
258 if(settingsGetPointer()->design == 3) /* Big font view ? */ |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
259 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
260 sectorMap[centerView] = t3_change_customview(ACTION_BUTTON_ENTER); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
261 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
262 else |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
263 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
264 sectorMap[centerView] = t7_change_customview(ACTION_BUTTON_ENTER); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
265 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
266 centerView++; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
267 if(centerView == sectorDetection.count) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
268 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
269 centerView = 0; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
270 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
271 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
272 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
273 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
274 |
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 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
|
276 { |
621 | 277 float sensorPitch = settingsGetPointer()->viewPitch - 180.0; /* calib values are stored as 360° values. Sensor uses +/- 180° */ |
383
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
278 sectorDetection.target = 0; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
279 sectorDetection.current = 0; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
280 sectorDetection.size = 0; |
49a02dea8ae3
Combine variables in a structure to improve readability of code
ideenmodellierer
parents:
381
diff
changeset
|
281 sectorDetection.count = 0; |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
282 |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
283 switch(settingsGetPointer()->MotionDetection) |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
284 { |
621 | 285 case MOTION_DETECT_SECTOR: DefinePitchSectors(sensorPitch,CUSTOMER_DEFINED_VIEWS); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
286 MapCVToSector(); |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
287 break; |
621 | 288 case MOTION_DETECT_MOVE: DefinePitchSectors(sensorPitch,SECTOR_MAX); |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
289 break; |
621 | 290 case MOTION_DETECT_SCROLL: DefinePitchSectors(sensorPitch,SECTOR_SCROLL); |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
291 break; |
371
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
292 default: |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
293 break; |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
294 } |
fca370f847f8
Added parameter for number of sectors to be defined
ideenmodellierer
parents:
370
diff
changeset
|
295 |
551 | 296 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
|
297 } |
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
|
298 |
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
|
299 /* Map the current pitch value to a sector and create button event in case the sector is left */ |
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
|
300 detectionState_t detectSectorButtonEvent(float curPitch) |
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
|
301 { |
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
|
302 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
|
303 |
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
|
304 newTargetSector = GetSectorForPitch(stateRealGetPointer()->lifeData.compass_pitch); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
305 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
306 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
|
307 { |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
308 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
|
309 } |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
310 else |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
311 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
312 t7_select_customview(GetCVForSector(newTargetSector)); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
313 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
314 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
585
diff
changeset
|
315 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
|
316 } |
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
|
317 |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
318 /* Check if pitch is not in center position and trigger a button action if needed */ |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
319 detectionState_t detectScrollButtonEvent(float curPitch) |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
320 { |
378
834e087505ec
Incremented "idle window" for scroll detection
ideenmodellierer
parents:
373
diff
changeset
|
321 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
|
322 |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
323 uint8_t PitchEvent = DETECT_NOTHING; |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
324 uint8_t newSector; |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
325 |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
326 if(delayscroll == 0) |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
327 { |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
328 newSector = GetSectorForPitch(stateRealGetPointer()->lifeData.compass_pitch); |
551 | 329 /* for scroll detection the motion window is split into 6 sectors => set event accoring to the sector number*/ |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
330 switch(newSector) |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
331 { |
574 | 332 case 0: PitchEvent = DETECT_POS_PITCH; |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
333 break; |
378
834e087505ec
Incremented "idle window" for scroll detection
ideenmodellierer
parents:
373
diff
changeset
|
334 case 6: PitchEvent = DETECT_NEG_PITCH; |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
335 break; |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
336 default: |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
337 break; |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
338 } |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
339 if(PitchEvent != DETECT_NOTHING) |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
340 { |
574 | 341 delayscroll = 7; |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
342 } |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
343 } |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
344 else |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
345 { |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
346 delayscroll--; |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
347 } |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
348 return PitchEvent; |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
349 } |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
350 |
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
351 |
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
|
352 /* 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
|
353 /* 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
|
354 detectionState_t detectPitch(float currentPitch) |
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
355 { |
578 | 356 static int8_t lastStart = 0; |
551 | 357 uint8_t exit = 0; |
578 | 358 int8_t step = 0; |
574 | 359 uint8_t duration = 0; |
551 | 360 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
|
361 |
578 | 362 if(lastStart < 0) |
363 { | |
364 detectionState = DETECT_NOTHING; | |
365 lastStart = 0; | |
366 } | |
367 else | |
368 { | |
369 detectionState = DETECT_START; | |
370 } | |
371 step = lastStart; | |
372 do | |
551 | 373 { |
374 test = GetDeltaHistory(step); | |
574 | 375 duration++; |
551 | 376 switch (detectionState) |
377 { | |
378 case DETECT_NOTHING: if(test.pitch > MOTION_DELTA_STABLE) | |
379 { | |
380 exit = 1; | |
578 | 381 lastStart = -2; |
551 | 382 } |
383 else | |
384 { | |
385 detectionState = DETECT_START; | |
578 | 386 lastStart = -1; |
551 | 387 } |
388 break; | |
389 case DETECT_START: if(test.pitch == MOTION_DELTA_RAISE) | |
390 { | |
391 detectionState = DETECT_POS_MOVE; | |
578 | 392 lastStart = step; |
551 | 393 } |
578 | 394 else |
551 | 395 if(test.pitch == MOTION_DELTA_FALL) |
396 { | |
397 detectionState = DETECT_NEG_MOVE; | |
578 | 398 lastStart = step; |
399 } | |
400 else | |
401 { | |
402 lastStart = -1; | |
551 | 403 } |
574 | 404 duration = 0; |
551 | 405 break; |
578 | 406 case DETECT_NEG_MOVE: if((test.pitch <= MOTION_DELTA_JITTER) || (test.pitch == MOTION_DELTA_RAISE)) |
407 { | |
408 detectionState++; | |
409 } | |
410 break; | |
411 case DETECT_POS_MOVE: if((test.pitch <= MOTION_DELTA_JITTER) || (test.pitch == MOTION_DELTA_FALL)) | |
551 | 412 { |
413 detectionState++; | |
414 } | |
415 break; | |
416 case DETECT_MAXIMA: if(test.pitch == MOTION_DELTA_FALL) | |
417 { | |
418 detectionState = DETECT_FALLBACK; | |
419 } | |
420 break; | |
421 case DETECT_MINIMA: if(test.pitch == MOTION_DELTA_RAISE) | |
422 { | |
423 detectionState = DETECT_RISEBACK; | |
424 } | |
425 break; | |
426 case DETECT_RISEBACK: | |
427 case DETECT_FALLBACK: if(test.pitch == MOTION_DELTA_STABLE) | |
428 { | |
578 | 429 if(duration > 4) /* avoid detection triggered by short moves */ |
574 | 430 { |
431 detectionState++; | |
432 } | |
578 | 433 exit = 1; |
434 lastStart = -2; | |
551 | 435 } |
436 break; | |
437 default: | |
438 detectionState = DETECT_NOTHING; | |
439 exit = 1; | |
440 break; | |
441 } | |
578 | 442 step--; |
443 } while((step >= 0) && (!exit)); | |
444 | |
445 if((lastStart < MOTION_DELTA_HISTORY_SIZE)) | |
446 { | |
447 lastStart++; /* prepare value for next iteration (history index will be increased) */ | |
448 } | |
449 else | |
450 { | |
451 lastStart = -1; | |
551 | 452 } |
453 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
|
454 { |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
455 detectionState = DETECT_NOTHING; |
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
456 } |
551 | 457 else /* dont detect the same event twice */ |
458 { | |
459 resetMotionDeltaHistory(); | |
460 } | |
461 return detectionState; | |
462 } | |
363 | 463 |
551 | 464 void anglesToCoord(float roll, float pitch, float yaw, SCoord *pCoord) |
465 { | |
466 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); | |
467 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); | |
468 pCoord->z = ((-1*sinf(pitch)) * pCoord->x + (cosf(pitch) *sinf(roll)) * pCoord->y + (cosf(pitch) * cosf(roll))* pCoord->z); | |
469 } | |
470 | |
471 SCoord CoordAdd(SCoord cA, SCoord cB) | |
472 { | |
473 SCoord result; | |
474 | |
475 result.x = cA.x + cB.x; | |
476 result.y = cA.y + cB.y; | |
477 result.z = cA.z + cB.z; | |
478 return result; | |
479 } | |
480 | |
481 SCoord CoordSub(SCoord cA, SCoord cB) | |
482 { | |
483 SCoord result; | |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
484 |
551 | 485 result.x = cA.x - cB.x; |
486 result.y = cA.y - cB.y; | |
487 result.z = cA.z - cB.z; | |
488 return result; | |
489 } | |
490 | |
491 SCoord CoordCross(SCoord cA, SCoord cB) | |
492 { | |
493 SCoord result; | |
494 | |
495 result.x = (cA.y * cB.z) - (cA.z * cB.y); | |
496 result.y = (cA.z * cB.x) - (cA.x * cB.z); | |
497 result.z = (cA.x * cB.y) - (cA.y * cB.x); | |
498 | |
499 return result; | |
500 | |
501 } | |
502 | |
503 SCoord CoordMulF(SCoord op, float factor) | |
504 { | |
505 SCoord result; | |
506 result.x = (op.x * factor); | |
507 result.y = (op.y * factor); | |
508 result.z = (op.z * factor); | |
509 | |
510 return result; | |
511 } | |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
512 |
551 | 513 SCoord CoordDivF(SCoord op, float factor) |
514 { | |
515 SCoord result; | |
516 result.x = (op.x / factor); | |
517 result.y = (op.y / factor); | |
518 result.z = (op.z / factor); | |
519 | |
520 return result; | |
521 } | |
522 | |
523 float CoordDot(SCoord cA, SCoord cB) | |
524 { | |
525 float result; | |
526 | |
527 result = cA.x * cB.x + cA.y * cB.y + cB.z*cA.z; | |
528 return result; | |
529 } | |
530 | |
531 void calibrateViewport(float roll, float pitch, float yaw) | |
532 { | |
533 SSettings* pSettings = settingsGetPointer(); | |
534 | |
621 | 535 pSettings->viewPitch = pitch + 180; |
536 pSettings->viewRoll = roll+ 180; | |
551 | 537 pSettings->viewYaw = yaw; |
538 } | |
539 | |
540 | |
541 float checkViewport(float roll, float pitch, float yaw) | |
542 { | |
574 | 543 static float freezeRoll = 0; |
544 static float freezeYaw = 0; | |
545 | |
551 | 546 uint8_t retval = 0; |
547 float angleYaw; | |
548 float anglePitch; | |
549 float angleRoll; | |
550 float distance = 0; | |
551 float _a, _b; | |
552 SCoord u,v,n; | |
553 float r; | |
554 | |
555 SCoord refVec; | |
556 SCoord axis_1; | |
557 SCoord axis_2; | |
558 SCoord curVec; | |
559 SCoord resultVec; | |
574 | 560 SDeltaHistory test; |
551 | 561 |
562 SSettings* pSettings = settingsGetPointer(); | |
563 | |
621 | 564 roll += 180; |
565 pitch += 180; | |
566 | |
551 | 567 /* calculate base vector taking calibration delta into account yaw (heading) */ |
621 | 568 float compYaw; |
574 | 569 |
570 compYaw = 360.0 - yaw; /* turn to 0° */ | |
571 compYaw += pSettings->viewYaw; /* consider calib yaw value */ | |
572 compYaw += yaw; | |
573 | |
551 | 574 if (compYaw < 0.0) |
575 { | |
576 compYaw = 360.0 + compYaw; | |
381 | 577 } |
551 | 578 |
579 if (compYaw > 360.0) | |
381 | 580 { |
574 | 581 compYaw = compYaw - 360.0; |
373
7b981f8bdd41
Add scroll event by pitch angle detection:
ideenmodellierer
parents:
371
diff
changeset
|
582 } |
574 | 583 if (compYaw > 360.0) |
584 { | |
585 compYaw = compYaw - 360.0; | |
586 } | |
587 angleYaw = pSettings->viewYaw * M_PI / 180.0; | |
551 | 588 anglePitch = pSettings->viewPitch * M_PI / 180.0; |
589 angleRoll = pSettings->viewRoll * M_PI / 180.0; | |
590 | |
591 refVec.x = 0; | |
592 refVec.y = 0; | |
593 refVec.z = 1.0; | |
594 | |
595 anglesToCoord(angleRoll,anglePitch,angleYaw, &refVec); | |
596 | |
597 anglePitch = pitch * M_PI / 180.0; | |
598 angleRoll = roll * M_PI / 180.0; | |
599 angleYaw = yaw * M_PI / 180.0; | |
600 | |
601 /* assume x = 0 and y = 1 => find matching vector so axis_1 is 90° to axis_2 */ | |
602 axis_1.x = 0; | |
603 if(refVec.y >=0) | |
604 { | |
605 axis_2.y = 1; /* => Spawn y == refVec y */ | |
606 } | |
607 else axis_1.y = -1; | |
608 axis_1.z = -1.0 * refVec.y / refVec.z; | |
609 axis_2 = CoordCross(refVec, axis_1); /* Cross is 90° to refVec and Spawn as well => Plane Spawn / cross */ | |
610 | |
611 /* check if detection plane is correct */ | |
612 u = CoordSub(axis_1,refVec); | |
613 v = CoordSub(axis_2,refVec); | |
614 n = CoordCross(u,v); | |
615 | |
616 if((fabsf(n.x) <= 0.0001) && (fabsf(n.y) <= 0.0001) && (fabsf(n.z) <= 0.0001)) | |
617 { | |
618 retval = 2; | |
619 } | |
620 else | |
621 { | |
574 | 622 angleYaw = compYaw * M_PI / 180.0; |
551 | 623 anglePitch = pitch * M_PI / 180.0; |
624 angleRoll = roll * M_PI / 180.0; | |
625 curVec.x = 0; | |
626 curVec.y = 0; | |
627 curVec.z = 1.0; | |
628 anglesToCoord(angleRoll,anglePitch,angleYaw, &curVec); | |
629 | |
630 _a = CoordDot(curVec,n); | |
631 _b = CoordDot(refVec,n); | |
632 | |
633 if(_b>=(-0.0001)&&_b<=0.0001) /* Check if view port is parallel (no matchpoint) */ | |
634 { | |
635 retval = 3; | |
636 } | |
637 else | |
638 { | |
639 r=_a/_b; | |
640 if(r<0.00||r>1.40) /* are we looking into wrong direction? */ | |
641 { | |
642 retval = 4; | |
643 } | |
644 } | |
645 distance = retval * 1.0; /* just for debugging */ | |
646 if(retval == 0) | |
647 { | |
648 | |
649 /* start calculating the matchpoint */ | |
650 curVec = CoordMulF(curVec,r); | |
651 resultVec = CoordSub(refVec,curVec); | |
652 | |
653 /* calculate the distance between reference and actual vector */ | |
654 resultVec.x = resultVec.x * resultVec.x; | |
655 resultVec.y = resultVec.y * resultVec.y; | |
656 resultVec.z = resultVec.z * resultVec.z; | |
657 | |
658 if((resultVec.x == 0) && (resultVec.y == 0) && (resultVec.z == 0)) | |
659 { | |
660 distance = 0.0; | |
661 } | |
662 else | |
663 { | |
664 distance = sqrtf((resultVec.x + resultVec.y + resultVec.z)); | |
665 } | |
666 } | |
667 } | |
668 | |
669 if(distance < 0.5) /* handle focus counter to avoid fast in/out focus changes */ | |
670 { | |
671 if(focusCnt < 10) | |
672 { | |
673 if((focusCnt == 9) && (inFocus == 0)) /* we will get into focus */ | |
674 { | |
675 resetMotionDeltaHistory(); | |
676 } | |
677 focusCnt++; | |
678 } | |
574 | 679 if((focusCnt == 10) && (inFocus == 0)) |
551 | 680 { |
681 inFocus = 1; | |
574 | 682 freezeRoll = roll; |
683 freezeYaw = yaw; | |
551 | 684 } |
685 } | |
686 else | |
687 { | |
574 | 688 if(focusCnt >= 5) /* Reset focus faster then setting focus */ |
551 | 689 { |
574 | 690 if(pSettings->MotionDetection != MOTION_DETECT_MOVE) /* only apply extended focus for methods using absolute pitch values */ |
691 { | |
692 test = GetDeltaHistory(0); | |
693 if((test.yaw == MOTION_DELTA_STABLE) && (test.roll == MOTION_DELTA_STABLE)) | |
694 { | |
695 if((fabsf(freezeRoll - roll) < MOTION_DELTA_JITTER_LEVEL) && (fabsf(freezeYaw - yaw) < MOTION_DELTA_JITTER_LEVEL)) | |
696 { | |
697 focusCnt++; | |
698 } | |
699 } | |
700 else | |
701 { | |
702 if(freezeRoll != 0.0) | |
703 { | |
704 focusCnt = 1; | |
705 } | |
706 } | |
707 } | |
551 | 708 focusCnt--; |
709 } | |
710 else | |
711 { | |
574 | 712 focusCnt = 0; |
551 | 713 inFocus = 0; |
574 | 714 freezeRoll = 0; |
715 freezeYaw = 0; | |
551 | 716 } |
717 } | |
718 return distance; | |
359
4258ea9b67fa
Added new files for motion detection (shaking) detection
ideenmodellierer
parents:
diff
changeset
|
719 } |
551 | 720 uint8_t viewInFocus(void) |
721 { | |
722 return inFocus; | |
723 } | |
724 void resetFocusState(void) | |
725 { | |
726 inFocus = 0; | |
727 } | |
611
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
728 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
729 void suspendMotionDetection(uint8_t seconds) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
730 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
731 suspendMotionDetectionSec = seconds * 10; /* detection function is called every 100ms */ |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
732 } |
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 void HandleMotionDetection(void) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
735 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
736 detectionState_t pitchstate = DETECT_NOTHING; |
618
96af74455420
Development bugfix: focus state not remembered:
Ideenmodellierer
parents:
611
diff
changeset
|
737 static uint8_t wasInFocus = 0; |
611
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 evaluateMotionDelta(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
740 checkViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading); |
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(viewInFocus()) |
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 wasInFocus = 1; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
745 set_Backlight_Boost(settingsGetPointer()->viewPortMode & 0x03); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
746 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
747 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
|
748 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
749 switch(settingsGetPointer()->MotionDetection) |
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 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
|
752 break; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
753 case MOTION_DETECT_SECTOR: pitchstate = detectSectorButtonEvent(stateRealGetPointer()->lifeData.compass_pitch); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
754 break; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
755 case MOTION_DETECT_SCROLL: pitchstate = detectScrollButtonEvent(stateRealGetPointer()->lifeData.compass_pitch); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
756 break; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
757 default: |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
758 pitchstate = DETECT_NOTHING; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
759 break; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
760 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
761 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
762 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
763 if(DETECT_NEG_PITCH == pitchstate) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
764 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
765 StoreButtonAction((uint8_t)ACTION_PITCH_NEG); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
766 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
767 if(DETECT_POS_PITCH == pitchstate) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
768 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
769 StoreButtonAction((uint8_t)ACTION_PITCH_POS); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
770 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
771 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
772 else |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
773 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
774 if(wasInFocus) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
775 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
776 wasInFocus = 0; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
777 if(suspendMotionDetectionSec == 0) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
778 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
779 if(settingsGetPointer()->design == 7) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
780 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
781 t7_set_customview_to_primary(); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
782 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
783 else |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
784 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
785 t3_set_customview_to_primary(); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
786 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
787 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
788 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
789 set_Backlight_Boost(0); |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
790 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
791 if(suspendMotionDetectionSec != 0) |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
792 { |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
793 suspendMotionDetectionSec--; |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
794 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
795 } |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
796 |
916998f90e39
Suspend MotionDetection events while diver is operationg the OSTC:
Ideenmodellierer
parents:
595
diff
changeset
|
797 |