Rev 95 | Rev 97 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 95 | Rev 96 | ||
---|---|---|---|
Line 161... | Line 161... | ||
161 | { |
161 | { |
162 | // update parameter from FC |
162 | // update parameter from FC |
163 | if(StopNavigation) GPS_Parameter.FlightMode = GPS_FLIGHT_MODE_FREE; |
163 | if(StopNavigation) GPS_Parameter.FlightMode = GPS_FLIGHT_MODE_FREE; |
164 | else |
164 | else |
165 | { |
165 | { |
- | 166 | if(Parameter.NaviGpsModeControl < 50) |
|
- | 167 | { |
|
166 | if (Parameter.NaviGpsModeControl < 50) GPS_Parameter.FlightMode = GPS_FLIGHT_MODE_FREE; |
168 | GPS_Parameter.FlightMode = GPS_FLIGHT_MODE_FREE; |
- | 169 | NCFlags &= ~(NC_FLAG_PH | NC_FLAG_CH); |
|
- | 170 | NCFlags |= NC_FLAG_FREE; |
|
- | 171 | } |
|
- | 172 | else if(Parameter.NaviGpsModeControl < 180) |
|
- | 173 | { |
|
167 | else if(Parameter.NaviGpsModeControl < 180) GPS_Parameter.FlightMode = GPS_FLIGHT_MODE_AID; |
174 | GPS_Parameter.FlightMode = GPS_FLIGHT_MODE_AID; |
- | 175 | NCFlags &= ~(NC_FLAG_FREE | NC_FLAG_CH); |
|
- | 176 | NCFlags |= NC_FLAG_PH; |
|
- | 177 | } |
|
- | 178 | else |
|
- | 179 | { |
|
168 | else GPS_Parameter.FlightMode = GPS_FLIGHT_MODE_WAYPOINT; |
180 | GPS_Parameter.FlightMode = GPS_FLIGHT_MODE_WAYPOINT; |
- | 181 | NCFlags &= ~(NC_FLAG_FREE | NC_FLAG_PH); |
|
- | 182 | NCFlags |= NC_FLAG_CH; |
|
- | 183 | } |
|
169 | } |
184 | } |
170 | GPS_Parameter.Gain = (float)Parameter.NaviGpsGain; |
185 | GPS_Parameter.Gain = (float)Parameter.NaviGpsGain; |
171 | GPS_Parameter.P = (float)Parameter.NaviGpsP; |
186 | GPS_Parameter.P = (float)Parameter.NaviGpsP; |
172 | GPS_Parameter.I = (float)Parameter.NaviGpsI; |
187 | GPS_Parameter.I = (float)Parameter.NaviGpsI; |
173 | GPS_Parameter.D = (float)Parameter.NaviGpsD; |
188 | GPS_Parameter.D = (float)Parameter.NaviGpsD; |
Line 427... | Line 442... | ||
427 | // check for current flight mode and set the target pointer GPS_pTargetPosition respectively |
442 | // check for current flight mode and set the target pointer GPS_pTargetPosition respectively |
428 | switch(GPS_Parameter.FlightMode) |
443 | switch(GPS_Parameter.FlightMode) |
429 | { |
444 | { |
430 | // the GPS control is deactived |
445 | // the GPS control is deactived |
431 | case GPS_FLIGHT_MODE_FREE: |
446 | case GPS_FLIGHT_MODE_FREE: |
432 | NCFlags &= ~(NC_FLAG_PH | NC_FLAG_CH); |
- | |
433 | NCFlags |= NC_FLAG_FREE; |
- | |
- | 447 | ||
434 | GPS_Parameter.PID_Limit = 0; // disables PID output |
448 | GPS_Parameter.PID_Limit = 0; // disables PID output |
435 | // update hold position |
449 | // update hold position |
436 | GPS_CopyPosition(&(GPSData.Position), &GPS_HoldPosition); |
450 | GPS_CopyPosition(&(GPSData.Position), &GPS_HoldPosition); |
437 | // no target position |
451 | // no target position |
438 | GPS_pTargetPosition = NULL; |
452 | GPS_pTargetPosition = NULL; |
439 | GPS_TargetRadius = 0; |
453 | GPS_TargetRadius = 0; |
440 | break; |
454 | break; |
Line 441... | Line 455... | ||
441 | 455 | ||
442 | // the GPS supports the position hold, if the pilot takes no action |
456 | // the GPS supports the position hold, if the pilot takes no action |
443 | case GPS_FLIGHT_MODE_AID: |
- | |
444 | NCFlags &= ~(NC_FLAG_FREE | NC_FLAG_CH); |
- | |
- | 457 | case GPS_FLIGHT_MODE_AID: |
|
445 | NCFlags |= NC_FLAG_PH; |
458 | |
446 | // reset WPList to begin |
459 | // reset WPList to begin |
Line 447... | Line 460... | ||
447 | GPS_pWaypoint = WPList_Begin(); |
460 | GPS_pWaypoint = WPList_Begin(); |
448 | 461 | ||
Line 461... | Line 474... | ||
461 | break; |
474 | break; |
Line 462... | Line 475... | ||
462 | 475 | ||
463 | // the GPS control is directed to a target position |
476 | // the GPS control is directed to a target position |
464 | // given by a waypoint or by the home position |
477 | // given by a waypoint or by the home position |
465 | case GPS_FLIGHT_MODE_WAYPOINT: |
- | |
466 | NCFlags &= ~(NC_FLAG_FREE | NC_FLAG_PH); |
- | |
Line 467... | Line 478... | ||
467 | NCFlags |= NC_FLAG_CH; |
478 | case GPS_FLIGHT_MODE_WAYPOINT: |
468 | 479 | ||
469 | if(GPS_IsManuallyControlled()) // the human pilot takes the action |
480 | if(GPS_IsManuallyControlled()) // the human pilot takes the action |
470 | { |
481 | { |