Changeset 559:54fa2efc1dc2
- Timestamp:
- 02/06/14 16:47:52 (11 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/fsuipc.py
r545 r559 1178 1178 ("flapsLeft", 0x0be0, "d"), 1179 1179 ("flapsRight", 0x0be4, "d"), 1180 ("flapsAxis", 0x3414, "H"), 1181 ("flapsIncrement", 0x3bfa, "H"), 1180 1182 ("lights", 0x0d0c, "H"), 1181 1183 ("pitot", 0x029c, "b"), … … 1270 1272 self._flapsNotches = flapsNotches 1271 1273 self._xpdrReliable = False 1274 self._flapsSet = -1 1272 1275 1273 1276 @property … … 1358 1361 flapsIndex += 1 1359 1362 state.flapsSet = self._flapsNotches[flapsIndex] 1363 if state.flapsSet != self._flapsSet: 1364 print "flapsControl: %d, flapsLeft: %d, flapsRight: %d, flapsAxis: %d, flapsIncrement: %d, flapsSet: %d, numNotchesM1: %d" % \ 1365 (flapsControl, data[self._monidx_flapsLeft], 1366 data[self._monidx_flapsRight], data[self._monidx_flapsAxis], 1367 data[self._monidx_flapsIncrement], state.flapsSet, numNotchesM1) 1368 self._flapsSet = state.flapsSet 1360 1369 1361 1370 flapsLeft = data[self._monidx_flapsLeft] -
src/mlx/pyuipc_sim.py
r443 r559 342 342 print "failed to read offset %04x: %s" % (offset, str(e)) 343 343 raise FSUIPCException(ERR_DATA) 344 345 def _getFlapsControl(self): 346 """Get the flaps control value""" 347 numNotchesM1 = len(self.flapsNotches) - 1 348 flapsIncrement = 16383.0 / numNotchesM1 349 index = 0 350 while index<numNotchesM1 and \ 351 self.flapsControl>self.flapsNotches[index]: 352 index += 1 353 354 if index==numNotchesM1: 355 return 16383 356 else: 357 return int(index * flapsIncrement + 358 (self.flapsControl-self.flapsNotches[index]) * 359 flapsIncrement / 360 (self.flapsNotches[index+1] - self.flapsNotches[index])) 344 361 345 362 def _read(self, offset, type): … … 473 490 else int(self.spoilers * (16383 - 4800) + 4800) 474 491 elif offset==0x0bdc: # Flaps control 475 numNotchesM1 = len(self.flapsNotches) - 1 476 flapsIncrement = 16383.0 / numNotchesM1 477 index = 0 478 while index<numNotchesM1 and \ 479 self.flapsControl>self.flapsNotches[index]: 480 index += 1 481 482 if index==numNotchesM1: 483 return 16383 484 else: 485 return int(index * flapsIncrement + 486 (self.flapsControl-self.flapsNotches[index]) * 487 flapsIncrement / 488 (self.flapsNotches[index+1] - self.flapsNotches[index])) 492 return self._getFlapsControl() 489 493 elif offset==0x0be0 or offset==0x0be4: # Flaps left and right 490 494 return self.flaps * 16383.0 / self.flapsNotches[-1] … … 592 596 elif offset==0x3364: # Frozen 593 597 return 1 if self.frozen else 0 598 elif offset==0x3414: # Flaps axis 599 return self._getFlapsControl() 600 elif offset==0x3bfa: # Flaps increment 601 return 16383 / (len(self.flapsNotches)-1) 594 602 elif offset==0x3bfc: # ZFW 595 603 return int(self.zfw * 256.0 * const.KGSTOLB)
Note:
See TracChangeset
for help on using the changeset viewer.