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