Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1538 | killagreg | 1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 | // + Copyright (c) Holger Buss, Ingo Busker |
||
3 | // + Nur für den privaten Gebrauch |
||
4 | // + www.MikroKopter.com |
||
5 | // + porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
||
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
7 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
||
8 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
||
9 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
||
10 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
||
11 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
||
12 | // + Verkauf von Luftbildaufnahmen, usw. |
||
13 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
14 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
||
15 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
||
16 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
17 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
||
18 | // + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
||
19 | // + eindeutig als Ursprung verlinkt werden |
||
20 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
21 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
||
22 | // + Benutzung auf eigene Gefahr |
||
23 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
||
24 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
25 | // + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
||
26 | // + mit unserer Zustimmung zulässig |
||
27 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
28 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
||
29 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
30 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
||
31 | // + this list of conditions and the following disclaimer. |
||
32 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
||
33 | // + from this software without specific prior written permission. |
||
34 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
||
35 | // + for non-commercial use (directly or indirectly) |
||
36 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
||
37 | // + with our written permission |
||
38 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
||
39 | // + clearly linked as origin |
||
40 | // + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
||
41 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
42 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
43 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
44 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
||
45 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
46 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
47 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
48 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
49 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
50 | // + POSSIBILITY OF SUCH DAMAGE. |
||
51 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
52 | #include <inttypes.h> |
||
53 | #include <stdlib.h> |
||
54 | #include "fc.h" |
||
55 | #include "ubx.h" |
||
56 | #include "mymath.h" |
||
57 | #include "timer0.h" |
||
58 | #include "uart0.h" |
||
59 | #include "rc.h" |
||
60 | #include "eeprom.h" |
||
61 | |||
62 | typedef enum |
||
63 | { |
||
64 | GPS_FLIGHT_MODE_UNDEF, |
||
65 | GPS_FLIGHT_MODE_FREE, |
||
66 | GPS_FLIGHT_MODE_AID, |
||
67 | GPS_FLIGHT_MODE_HOME, |
||
68 | } FlightMode_t; |
||
69 | |||
70 | #define GPS_POSINTEGRAL_LIMIT 32000 |
||
71 | #define GPS_STICK_LIMIT 45 // limit of gps stick control to avoid critical flight attitudes |
||
72 | #define GPS_P_LIMIT 25 |
||
73 | |||
74 | |||
75 | typedef struct |
||
76 | { |
||
77 | int32_t Longitude; |
||
78 | int32_t Latitude; |
||
79 | int32_t Altitude; |
||
80 | Status_t Status; |
||
81 | } GPS_Pos_t; |
||
82 | |||
83 | // GPS coordinates for hold position |
||
84 | GPS_Pos_t HoldPosition = {0,0,0,INVALID}; |
||
85 | // GPS coordinates for home position |
||
86 | GPS_Pos_t HomePosition = {0,0,0,INVALID}; |
||
87 | // the current flight mode |
||
88 | FlightMode_t FlightMode = GPS_FLIGHT_MODE_UNDEF; |
||
89 | |||
90 | |||
91 | // --------------------------------------------------------------------------------- |
||
92 | void GPS_UpdateParameter(void) |
||
93 | { |
||
94 | static FlightMode_t FlightModeOld = GPS_FLIGHT_MODE_UNDEF; |
||
95 | |||
96 | if((RC_Quality < 100) || (MKFlags & MKFLAG_EMERGENCY_LANDING)) |
||
97 | { |
||
98 | FlightMode = GPS_FLIGHT_MODE_FREE; |
||
99 | } |
||
100 | else |
||
101 | { |
||
102 | if (FCParam.NaviGpsModeControl < 50) FlightMode = GPS_FLIGHT_MODE_AID; |
||
103 | else if(FCParam.NaviGpsModeControl < 180) FlightMode = GPS_FLIGHT_MODE_FREE; |
||
104 | else FlightMode = GPS_FLIGHT_MODE_HOME; |
||
105 | } |
||
106 | if (FlightMode != FlightModeOld) |
||
107 | { |
||
108 | BeepTime = 100; |
||
109 | } |
||
110 | FlightModeOld = FlightMode; |
||
111 | } |
||
112 | |||
113 | |||
114 | |||
115 | // --------------------------------------------------------------------------------- |
||
116 | // This function defines a good GPS signal condition |
||
117 | uint8_t GPS_IsSignalOK(void) |
||
118 | { |
||
119 | static uint8_t GPSFix = 0; |
||
120 | if( (GPSInfo.status != INVALID) && (GPSInfo.satfix == SATFIX_3D) && (GPSInfo.flags & FLAG_GPSFIXOK) && ((GPSInfo.satnum >= ParamSet.NaviGpsMinSat) || GPSFix)) |
||
121 | { |
||
122 | GPSFix = 1; |
||
123 | return(1); |
||
124 | |||
125 | } |
||
126 | else return (0); |
||
127 | |||
128 | } |
||
129 | // --------------------------------------------------------------------------------- |
||
130 | // rescale xy-vector length to limit |
||
131 | uint8_t GPS_LimitXY(int32_t *x, int32_t *y, int32_t limit) |
||
132 | { |
||
133 | uint8_t retval = 0; |
||
134 | int32_t len; |
||
135 | len = (int32_t)c_sqrt(*x * *x + *y * *y); |
||
136 | if (len > limit) |
||
137 | { |
||
138 | // normalize control vector components to the limit |
||
139 | *x = (*x * limit) / len; |
||
140 | *y = (*y * limit) / len; |
||
141 | retval = 1; |
||
142 | } |
||
143 | return(retval); |
||
144 | } |
||
145 | |||
146 | // checks nick and roll sticks for manual control |
||
147 | uint8_t GPS_IsManualControlled(void) |
||
148 | { |
||
149 | if ( (abs(PPM_in[ParamSet.ChannelAssignment[CH_NICK]]) < ParamSet.NaviStickThreshold) && (abs(PPM_in[ParamSet.ChannelAssignment[CH_ROLL]]) < ParamSet.NaviStickThreshold)) return 0; |
||
150 | else return 1; |
||
151 | } |
||
152 | |||
153 | // set given position to current gps position |
||
154 | uint8_t GPS_SetCurrPosition(GPS_Pos_t * pGPSPos) |
||
155 | { |
||
156 | uint8_t retval = 0; |
||
157 | if(pGPSPos == NULL) return(retval); // bad pointer |
||
158 | |||
159 | if(GPS_IsSignalOK()) |
||
160 | { // is GPS signal condition is fine |
||
161 | pGPSPos->Longitude = GPSInfo.longitude; |
||
162 | pGPSPos->Latitude = GPSInfo.latitude; |
||
163 | pGPSPos->Altitude = GPSInfo.altitude; |
||
164 | pGPSPos->Status = NEWDATA; |
||
165 | retval = 1; |
||
166 | } |
||
167 | else |
||
168 | { // bad GPS signal condition |
||
169 | pGPSPos->Status = INVALID; |
||
170 | retval = 0; |
||
171 | } |
||
172 | return(retval); |
||
173 | } |
||
174 | |||
175 | // clear position |
||
176 | uint8_t GPS_ClearPosition(GPS_Pos_t * pGPSPos) |
||
177 | { |
||
178 | uint8_t retval = 0; |
||
179 | if(pGPSPos == NULL) return(retval); // bad pointer |
||
180 | else |
||
181 | { |
||
182 | pGPSPos->Longitude = 0; |
||
183 | pGPSPos->Latitude = 0; |
||
184 | pGPSPos->Altitude = 0; |
||
185 | pGPSPos->Status = INVALID; |
||
186 | retval = 1; |
||
187 | } |
||
188 | return (retval); |
||
189 | } |
||
190 | |||
191 | // disable GPS control sticks |
||
192 | void GPS_Neutral(void) |
||
193 | { |
||
194 | GPSStickNick = 0; |
||
195 | GPSStickRoll = 0; |
||
196 | } |
||
197 | |||
198 | // calculates the GPS control stick values from the deviation to target position |
||
199 | // if the pointer to the target positin is NULL or is the target position invalid |
||
200 | // then the P part of the controller is deactivated. |
||
201 | void GPS_PIDController(GPS_Pos_t *pTargetPos) |
||
202 | { |
||
203 | static int32_t PID_Nick, PID_Roll; |
||
204 | int32_t coscompass, sincompass; |
||
205 | int32_t GPSPosDev_North, GPSPosDev_East; // Position deviation in cm |
||
206 | int32_t P_North = 0, D_North = 0, P_East = 0, D_East = 0, I_North = 0, I_East = 0; |
||
207 | int32_t PID_North = 0, PID_East = 0; |
||
208 | static int32_t cos_target_latitude = 1; |
||
209 | static int32_t GPSPosDevIntegral_North = 0, GPSPosDevIntegral_East = 0; |
||
210 | static GPS_Pos_t *pLastTargetPos = 0; |
||
211 | |||
212 | // if GPS data and Compass are ok |
||
213 | if( GPS_IsSignalOK() && (CompassHeading >= 0) ) |
||
214 | { |
||
215 | |||
216 | if(pTargetPos != NULL) // if there is a target position |
||
217 | { |
||
218 | if(pTargetPos->Status != INVALID) // and the position data are valid |
||
219 | { |
||
220 | // if the target data are updated or the target pointer has changed |
||
221 | if ((pTargetPos->Status != PROCESSED) || (pTargetPos != pLastTargetPos) ) |
||
222 | { |
||
223 | // reset error integral |
||
224 | GPSPosDevIntegral_North = 0; |
||
225 | GPSPosDevIntegral_East = 0; |
||
226 | // recalculate latitude projection |
||
227 | cos_target_latitude = (int32_t)c_cos_8192((int16_t)(pTargetPos->Latitude/10000000L)); |
||
228 | // remember last target pointer |
||
229 | pLastTargetPos = pTargetPos; |
||
230 | // mark data as processed |
||
231 | pTargetPos->Status = PROCESSED; |
||
232 | } |
||
233 | // calculate position deviation from latitude and longitude differences |
||
234 | GPSPosDev_North = (GPSInfo.latitude - pTargetPos->Latitude); // to calculate real cm we would need *111/100 additionally |
||
235 | GPSPosDev_East = (GPSInfo.longitude - pTargetPos->Longitude); // to calculate real cm we would need *111/100 additionally |
||
236 | // calculate latitude projection |
||
237 | GPSPosDev_East *= cos_target_latitude; |
||
238 | GPSPosDev_East /= 8192; |
||
239 | } |
||
240 | else // no valid target position available |
||
241 | { |
||
242 | // reset error |
||
243 | GPSPosDev_North = 0; |
||
244 | GPSPosDev_East = 0; |
||
245 | // reset error integral |
||
246 | GPSPosDevIntegral_North = 0; |
||
247 | GPSPosDevIntegral_East = 0; |
||
248 | } |
||
249 | } |
||
250 | else // no target position available |
||
251 | { |
||
252 | // reset error |
||
253 | GPSPosDev_North = 0; |
||
254 | GPSPosDev_East = 0; |
||
255 | // reset error integral |
||
256 | GPSPosDevIntegral_North = 0; |
||
257 | GPSPosDevIntegral_East = 0; |
||
258 | } |
||
259 | |||
260 | //Calculate PID-components of the controller |
||
261 | |||
262 | // D-Part |
||
263 | D_North = ((int32_t)FCParam.NaviGpsD * GPSInfo.velnorth)/512; |
||
264 | D_East = ((int32_t)FCParam.NaviGpsD * GPSInfo.veleast)/512; |
||
265 | |||
266 | // P-Part |
||
267 | P_North = ((int32_t)FCParam.NaviGpsP * GPSPosDev_North)/2048; |
||
268 | P_East = ((int32_t)FCParam.NaviGpsP * GPSPosDev_East)/2048; |
||
269 | |||
270 | // I-Part |
||
271 | I_North = ((int32_t)FCParam.NaviGpsI * GPSPosDevIntegral_North)/8192; |
||
272 | I_East = ((int32_t)FCParam.NaviGpsI * GPSPosDevIntegral_East)/8192; |
||
273 | |||
274 | |||
275 | // combine P & I |
||
276 | PID_North = P_North + I_North; |
||
277 | PID_East = P_East + I_East; |
||
278 | if(!GPS_LimitXY(&PID_North, &PID_East, GPS_P_LIMIT)) |
||
279 | { |
||
280 | GPSPosDevIntegral_North += GPSPosDev_North/16; |
||
281 | GPSPosDevIntegral_East += GPSPosDev_East/16; |
||
282 | GPS_LimitXY(&GPSPosDevIntegral_North, &GPSPosDevIntegral_East, GPS_POSINTEGRAL_LIMIT); |
||
283 | } |
||
284 | |||
285 | // combine PI- and D-Part |
||
286 | PID_North += D_North; |
||
287 | PID_East += D_East; |
||
288 | |||
289 | |||
290 | // scale combination with gain. |
||
291 | PID_North = (PID_North * (int32_t)FCParam.NaviGpsGain) / 100; |
||
292 | PID_East = (PID_East * (int32_t)FCParam.NaviGpsGain) / 100; |
||
293 | |||
294 | // GPS to nick and roll settings |
||
295 | |||
296 | // A positive nick angle moves head downwards (flying forward). |
||
297 | // A positive roll angle tilts left side downwards (flying left). |
||
298 | // If compass heading is 0 the head of the copter is in north direction. |
||
299 | // A positive nick angle will fly to north and a positive roll angle will fly to west. |
||
300 | // In case of a positive north deviation/velocity the |
||
301 | // copter should fly to south (negative nick). |
||
302 | // In case of a positive east position deviation and a positive east velocity the |
||
303 | // copter should fly to west (positive roll). |
||
304 | // The influence of the GPSStickNick and GPSStickRoll variable is contrarily to the stick values |
||
305 | // in the fc.c. Therefore a positive north deviation/velocity should result in a positive |
||
306 | // GPSStickNick and a positive east deviation/velocity should result in a negative GPSStickRoll. |
||
307 | |||
308 | coscompass = (int32_t)c_cos_8192(YawGyroHeading / GYRO_DEG_FACTOR); |
||
309 | sincompass = (int32_t)c_sin_8192(YawGyroHeading / GYRO_DEG_FACTOR); |
||
310 | PID_Nick = (coscompass * PID_North + sincompass * PID_East) / 8192; |
||
311 | PID_Roll = (sincompass * PID_North - coscompass * PID_East) / 8192; |
||
312 | |||
313 | |||
314 | // limit resulting GPS control vector |
||
315 | GPS_LimitXY(&PID_Nick, &PID_Roll, GPS_STICK_LIMIT); |
||
316 | |||
317 | GPSStickNick = (int16_t)PID_Nick; |
||
318 | GPSStickRoll = (int16_t)PID_Roll; |
||
319 | } |
||
320 | else // invalid GPS data or bad compass reading |
||
321 | { |
||
322 | GPS_Neutral(); // do nothing |
||
323 | // reset error integral |
||
324 | GPSPosDevIntegral_North = 0; |
||
325 | GPSPosDevIntegral_East = 0; |
||
326 | } |
||
327 | } |
||
328 | |||
329 | |||
330 | |||
331 | |||
332 | void GPS_Main(void) |
||
333 | { |
||
334 | static uint8_t GPS_P_Delay = 0; |
||
335 | static uint16_t beep_rythm = 0; |
||
336 | |||
337 | GPS_UpdateParameter(); |
||
338 | |||
339 | // store home position if start of flight flag is set |
||
340 | if(MKFlags & MKFLAG_CALIBRATE) |
||
341 | { |
||
342 | if(GPS_SetCurrPosition(&HomePosition)) BeepTime = 700; |
||
343 | } |
||
344 | |||
345 | switch(GPSInfo.status) |
||
346 | { |
||
347 | case INVALID: // invalid gps data |
||
348 | GPS_Neutral(); |
||
349 | if(FlightMode != GPS_FLIGHT_MODE_FREE) |
||
350 | { |
||
351 | BeepTime = 100; // beep if signal is neccesary |
||
352 | } |
||
353 | break; |
||
354 | case PROCESSED: // if gps data are already processed do nothing |
||
355 | // downcount timeout |
||
356 | if(GPSTimeout) GPSTimeout--; |
||
357 | // if no new data arrived within timeout set current data invalid |
||
358 | // and therefore disable GPS |
||
359 | else |
||
360 | { |
||
361 | GPS_Neutral(); |
||
362 | GPSInfo.status = INVALID; |
||
363 | } |
||
364 | break; |
||
365 | case NEWDATA: // new valid data from gps device |
||
366 | // if the gps data quality is good |
||
367 | beep_rythm++; |
||
368 | |||
369 | if (GPS_IsSignalOK()) |
||
370 | { |
||
371 | switch(FlightMode) // check what's to do |
||
372 | { |
||
373 | case GPS_FLIGHT_MODE_FREE: |
||
374 | // update hold position to current gps position |
||
375 | GPS_SetCurrPosition(&HoldPosition); // can get invalid if gps signal is bad |
||
376 | // disable gps control |
||
377 | GPS_Neutral(); |
||
378 | break; |
||
379 | |||
380 | case GPS_FLIGHT_MODE_AID: |
||
381 | if(HoldPosition.Status != INVALID) |
||
382 | { |
||
383 | if( GPS_IsManualControlled() ) // MK controlled by user |
||
384 | { |
||
385 | // update hold point to current gps position |
||
386 | GPS_SetCurrPosition(&HoldPosition); |
||
387 | // disable gps control |
||
388 | GPS_Neutral(); |
||
389 | GPS_P_Delay = 0; |
||
390 | } |
||
391 | else // GPS control active |
||
392 | { |
||
393 | if(GPS_P_Delay < 7) |
||
394 | { // delayed activation of P-Part for 8 cycles (8*0.25s = 2s) |
||
395 | GPS_P_Delay++; |
||
396 | GPS_SetCurrPosition(&HoldPosition); // update hold point to current gps position |
||
397 | GPS_PIDController(NULL); // activates only the D-Part |
||
398 | } |
||
399 | else GPS_PIDController(&HoldPosition);// activates the P&D-Part |
||
400 | } |
||
401 | } |
||
402 | else // invalid Hold Position |
||
403 | { // try to catch a valid hold position from gps data input |
||
404 | GPS_SetCurrPosition(&HoldPosition); |
||
405 | GPS_Neutral(); |
||
406 | } |
||
407 | break; |
||
408 | |||
409 | case GPS_FLIGHT_MODE_HOME: |
||
410 | if(HomePosition.Status != INVALID) |
||
411 | { |
||
412 | // update hold point to current gps position |
||
413 | // to avoid a flight back if home comming is deactivated |
||
414 | GPS_SetCurrPosition(&HoldPosition); |
||
415 | if( GPS_IsManualControlled() ) // MK controlled by user |
||
416 | { |
||
417 | GPS_Neutral(); |
||
418 | } |
||
419 | else // GPS control active |
||
420 | { |
||
421 | GPS_PIDController(&HomePosition); |
||
422 | } |
||
423 | } |
||
424 | else // bad home position |
||
425 | { |
||
426 | BeepTime = 50; // signal invalid home position |
||
427 | // try to hold at least the position as a fallback option |
||
428 | |||
429 | if (HoldPosition.Status != INVALID) |
||
430 | { |
||
431 | if( GPS_IsManualControlled() ) // MK controlled by user |
||
432 | { |
||
433 | GPS_Neutral(); |
||
434 | } |
||
435 | else // GPS control active |
||
436 | { |
||
437 | GPS_PIDController(&HoldPosition); |
||
438 | } |
||
439 | } |
||
440 | else |
||
441 | { // try to catch a valid hold position |
||
442 | GPS_SetCurrPosition(&HoldPosition); |
||
443 | GPS_Neutral(); |
||
444 | } |
||
445 | } |
||
446 | break; // eof TSK_HOME |
||
447 | default: // unhandled task |
||
448 | GPS_Neutral(); |
||
449 | break; // eof default |
||
450 | } // eof switch GPS_Task |
||
451 | } // eof gps data quality is good |
||
452 | else // gps data quality is bad |
||
453 | { // disable gps control |
||
454 | GPS_Neutral(); |
||
455 | if(FlightMode != GPS_FLIGHT_MODE_FREE) |
||
456 | { |
||
457 | // beep if signal is not sufficient |
||
458 | if(!(GPSInfo.flags & FLAG_GPSFIXOK) && !(beep_rythm % 5)) BeepTime = 100; |
||
459 | else if (GPSInfo.satnum < ParamSet.NaviGpsMinSat && !(beep_rythm % 5)) BeepTime = 10; |
||
460 | } |
||
461 | } |
||
462 | // set current data as processed to avoid further calculations on the same gps data |
||
463 | GPSInfo.status = PROCESSED; |
||
464 | break; |
||
465 | } // eof GPSInfo.status |
||
466 | } |
||
467 |