Changeset 424:3512d665bdfe


Ignore:
Timestamp:
02/16/13 16:39:14 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
xplane
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Weight query for the help window works too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/xplane.py

    r423 r424  
    746746        These values will be passed to the callback function in this order, as
    747747        separate arguments."""
    748         # TODO: implement this for X-Plane
    749         self._handler.requestRead([(0x13fc, "d")], self._handlePayloadCount,
     748        data = [ ("sim/aircraft/weight/acf_m_empty", TYPE_FLOAT),
     749                 ("sim/flightmodel/weight/m_fixed", TYPE_FLOAT),
     750                 ("sim/flightmodel/weight/m_total", TYPE_FLOAT) ]
     751        self._handler.requestRead(data, self._handleWeights,
    750752                                  extra = callback)
    751753
     
    10871089        callback(Simulator._getTimestamp(data))
    10881090
    1089     def _handlePayloadCount(self, data, callback):
    1090         """Callback for the payload count retrieval request."""
    1091         payloadCount = data[0]
    1092         data = [(0x3bfc, "d"), (0x30c0, "f")]
    1093         for i in range(0, payloadCount):
    1094             data.append((0x1400 + i*48, "f"))
    1095 
    1096         self._handler.requestRead(data, self._handleWeights,
    1097                                   extra = callback)
    1098 
    10991091    def _handleWeights(self, data, callback):
    11001092        """Callback for the weights retrieval request."""
    1101         zfw = data[0] * const.LBSTOKG / 256.0
    1102         grossWeight = data[1] * const.LBSTOKG
    1103         payload = sum(data[2:]) * const.LBSTOKG
    1104         dow = zfw - payload
     1093        dow = data[0]
     1094        payload = data[1]
     1095        zfw = dow + payload
     1096        grossWeight = data[2]
    11051097        callback(dow, payload, zfw, grossWeight)
    11061098
Note: See TracChangeset for help on using the changeset viewer.