X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fgps.cxx;h=729ad0526f70460098d9127db6f3a991713e3f6e;hb=4a94071ed78efdb6c8a9c5d44102dd48a001d920;hp=8fff9cd65e506ec67589f725c3db932a200fd577;hpb=1df5347a06d5f38bc6d6267f242d5331b7c6f02b;p=flightgear.git diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index 8fff9cd65..729ad0526 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -201,7 +201,6 @@ GPS::Config::Config() : _turnRate(3.0), // degrees-per-second, so 180 degree turn takes 60 seconds _overflightArmDistance(1.0), _waypointAlertTime(30.0), - _minRunwayLengthFt(0.0), _requireHardSurface(true), _cdiMaxDeflectionNm(3.0), // linear mode, 3nm at the peg _driveAutopilot(true), @@ -215,7 +214,6 @@ void GPS::Config::bind(GPS* aOwner, SGPropertyNode* aCfg) aOwner->tie(aCfg, "turn-rate-deg-sec", SGRawValuePointer(&_turnRate)); aOwner->tie(aCfg, "turn-anticipation", SGRawValuePointer(&_enableTurnAnticipation)); aOwner->tie(aCfg, "wpt-alert-time", SGRawValuePointer(&_waypointAlertTime)); - aOwner->tie(aCfg, "min-runway-length-ft", SGRawValuePointer(&_minRunwayLengthFt)); aOwner->tie(aCfg, "hard-surface-runways-only", SGRawValuePointer(&_requireHardSurface)); aOwner->tie(aCfg, "cdi-max-deflection-nm", SGRawValuePointer(&_cdiMaxDeflectionNm)); aOwner->tie(aCfg, "drive-autopilot", SGRawValuePointer(&_driveAutopilot)); @@ -330,7 +328,11 @@ GPS::init () // last thing, add the deprecated prop watcher new DeprecatedPropListener(_gpsNode); - +} + +void +GPS::reinit () +{ clearOutput(); } @@ -480,8 +482,6 @@ GPS::update (double delta_time_sec) } if (_dataValid && (_mode == "init")) { - // allow a realistic delay in the future, here - SG_LOG(SG_INSTR, SG_INFO, "GPS initialisation complete"); if (_route_active_node->getBoolValue()) { // GPS init with active route @@ -498,6 +498,12 @@ GPS::update (double delta_time_sec) selectOBSMode(); } } + + if (_mode != "init") + { + // allow a realistic delay in the future, here + SG_LOG(SG_INSTR, SG_INFO, "GPS initialisation complete"); + } } // of init mode check _last_pos = _indicated_pos; @@ -671,7 +677,7 @@ void GPS::referenceNavaidSet(const std::string& aNavaid) if (_ref_navaid) { _ref_navaid_set = true; - SG_LOG(SG_INSTR, SG_INFO, "GPS code set explict ref-navaid:" << _ref_navaid->ident()); + SG_LOG(SG_INSTR, SG_INFO, "GPS code set explicit ref-navaid:" << _ref_navaid->ident()); _ref_navaid_id_node->setStringValue(_ref_navaid->ident().c_str()); _ref_navaid_name_node->setStringValue(_ref_navaid->name().c_str()); FGNavRecord* vor = (FGNavRecord*) _ref_navaid.ptr(); @@ -720,7 +726,7 @@ void GPS::routeManagerSequenced() SG_LOG(SG_INSTR, SG_INFO, "GPS waypoint index is now " << index); if (index > 0) { - _prevWaypt = _routeMgr->previousWaypt(); + _prevWaypt = _routeMgr->wayptAtIndex(index - 1); if (_prevWaypt->flag(WPT_DYNAMIC)) { _wp0_position = _indicated_pos; } else { @@ -825,7 +831,7 @@ void GPS::updateOverflight() // check for wp1 being on active route - resume leg mode if (_routeMgr->isRouteActive()) { - int index = _routeMgr->findWayptIndex(_currentWaypt->position()); + int index = _routeMgr->flightPlan()->findWayptIndex(_currentWaypt->position()); if (index >= 0) { SG_LOG(SG_INSTR, SG_INFO, "GPS DTO, resuming LEG mode at wp:" << index); _mode = "leg"; @@ -853,7 +859,7 @@ void GPS::beginTurn() { _inTurn = true; _turnSequenced = false; - SG_LOG(SG_INSTR, SG_INFO, "begining turn"); + SG_LOG(SG_INSTR, SG_INFO, "beginning turn"); } void GPS::endTurn() @@ -877,7 +883,7 @@ void GPS::computeTurnData() return; } - WayptRef next = _routeMgr->nextWaypt(); + WayptRef next = _routeMgr->wayptAtIndex(_routeMgr->currentIndex() + 1); if (!next || next->flag(WPT_DYNAMIC)) { _anticipateTurn = false; return; @@ -1435,7 +1441,7 @@ FGPositioned::Type GPS::SearchFilter::maxType() const FGPositioned::Filter* GPS::createFilter(FGPositioned::Type aTy) { if (aTy == FGPositioned::AIRPORT) { - return new FGAirport::HardSurfaceFilter(_config.minRunwayLengthFt()); + return new FGAirport::HardSurfaceFilter(); } // if we were passed INVALID, assume it means 'all types interesting to a GPS' @@ -1680,7 +1686,7 @@ void GPS::insertWaypointAtIndex(int aIndex) string ident = _scratchNode->getStringValue("ident"); WayptRef wpt = new BasicWaypt(_scratchPos, ident, NULL); - _routeMgr->insertWayptAtIndex(wpt, aIndex); + _routeMgr->flightPlan()->insertWayptAtIndex(wpt, aIndex); } void GPS::removeWaypointAtIndex(int aIndex) @@ -1689,7 +1695,7 @@ void GPS::removeWaypointAtIndex(int aIndex) throw sg_range_exception("GPS::removeWaypointAtIndex: index out of bounds"); } - _routeMgr->removeWayptAtIndex(aIndex); + _routeMgr->removeLegAtIndex(aIndex); } void GPS::tieSGGeod(SGPropertyNode* aNode, SGGeod& aRef,