Changeset 424:3512d665bdfe for src/mlx
- Timestamp:
- 02/16/13 16:39:14 (12 years ago)
- Branch:
- xplane
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/xplane.py
r423 r424 746 746 These values will be passed to the callback function in this order, as 747 747 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, 750 752 extra = callback) 751 753 … … 1087 1089 callback(Simulator._getTimestamp(data)) 1088 1090 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 1099 1091 def _handleWeights(self, data, callback): 1100 1092 """Callback for the weights retrieval request.""" 1101 zfw = data[0] * const.LBSTOKG / 256.01102 grossWeight = data[1] * const.LBSTOKG1103 payload = sum(data[2:]) * const.LBSTOKG1104 dow = zfw - payload1093 dow = data[0] 1094 payload = data[1] 1095 zfw = dow + payload 1096 grossWeight = data[2] 1105 1097 callback(dow, payload, zfw, grossWeight) 1106 1098
Note:
See TracChangeset
for help on using the changeset viewer.