Changeset 541:0369dcfecaae for src


Ignore:
Timestamp:
09/19/13 09:19:19 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The NAV2 frequency is logged only when not using the FMS as the NAV source

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/xplane.py

    r535 r541  
    733733        self._fuelCallback = None
    734734
    735         self._hasXFMC = None
    736 
    737     @property
    738     def hasXFMC(self):
    739         """Indicate if the simulator has the X-FMC plugin."""
    740         return self._hasXFMC
    741 
    742735    def connect(self, aircraft):
    743736        """Initiate a connection to the simulator."""
     
    915908        self._fsType = fsType
    916909
    917         self._handler.requestRead([("xfmc/Status", TYPE_INT)],
    918                                   self._xfmcStatusRead)
    919 
    920910        with self._hotkeyLock:
    921911            if self._hotkeyCodes is not None:
     
    937927    def disconnected(self):
    938928        """Called when a connection to the flight simulator has been broken."""
    939         self._hasXFMC = None
    940929        with self._hotkeyLock:
    941930            self._clearHotkeyRequest()
     
    956945        self._normalRequestID = None
    957946        self._monitoring = False
    958 
    959     def _xfmcStatusRead(self, data, extra):
    960         """Called when the xfmc/Status dataref is read or not."""
    961         self._hasXFMC = data is not None
    962         print "xplane.Simulator: XFMC is %savailable" % \
    963           ("" if self._hasXFMC else "not ")
    964947
    965948    def _handleNormal(self, data, extra):
     
    12911274                        "sim/cockpit/switches/anti_ice_surf_heat", TYPE_INT),
    12921275                       ("propHeat",
    1293                         "sim/cockpit/switches/anti_ice_prop_heat", TYPE_INT) ]
     1276                        "sim/cockpit/switches/anti_ice_prop_heat", TYPE_INT),
     1277                       ("autopilotOn",
     1278                        "sim/cockpit2/autopilot/autopilot_on", TYPE_INT),
     1279                       ("apHeadingMode",
     1280                        "sim/cockpit2/autopilot/heading_mode", TYPE_INT)]
     1281
    12941282
    12951283    specialModels = []
     
    13851373        self._addDataWithIndexMembers(data, "_monidx_",
    13861374                                      AircraftModel.monitoringData)
    1387         if self.simulator.hasXFMC:
    1388             print "xplane.AircraftModel.addMonitoringData: adding XFMC status dataref"""
    1389             self._addDatarefWithIndexMember(data, "xfmc/Status", TYPE_INT,
    1390                                             attrName = "_monidx_xfmcStatus")
    13911375
    13921376    def getAircraftState(self, aircraft, timestamp, data):
     
    13941378        state = fs.AircraftState()
    13951379
    1396         xfmcLNAVOn = self.simulator.hasXFMC and \
    1397                      (data[self._monidx_xfmcStatus]&0x03==0x03)
     1380        lnavOn = data[self._monidx_autopilotOn]!=0 and \
     1381                 data[self._monidx_apHeadingMode]==2
    13981382
    13991383        state.timestamp = timestamp
     
    14641448        state.nav2 = self._convertFrequency(data[self._monidx_nav2])
    14651449        state.nav2_obs = self._convertOBS(data[self._monidx_nav2_obs])
    1466         state.nav2_manual = not xfmcLNAVOn
     1450        state.nav2_manual = not lnavOn
    14671451        state.adf1 = str(data[self._monidx_adf1])
    14681452        state.adf2 = str(data[self._monidx_adf2])
     
    14831467        state.apMaster = data[self._monidx_apMaster]==2
    14841468        apState = data[self._monidx_apState]
    1485         if xfmcLNAVOn:
     1469        if lnavOn:
    14861470           state.apHeadingHold = None
    14871471           state.apHeading = None
Note: See TracChangeset for help on using the changeset viewer.