Changeset 559:54fa2efc1dc2


Ignore:
Timestamp:
02/06/14 16:47:52 (10 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Added debug printout to see what is read from FS when the flaps settings change (re #225)

Location:
src/mlx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/fsuipc.py

    r545 r559  
    11781178                      ("flapsLeft", 0x0be0, "d"),
    11791179                      ("flapsRight", 0x0be4, "d"),
     1180                      ("flapsAxis", 0x3414, "H"),
     1181                      ("flapsIncrement", 0x3bfa, "H"),
    11801182                      ("lights", 0x0d0c, "H"),
    11811183                      ("pitot", 0x029c, "b"),
     
    12701272        self._flapsNotches = flapsNotches
    12711273        self._xpdrReliable = False
     1274        self._flapsSet = -1
    12721275
    12731276    @property
     
    13581361                flapsIndex += 1
    13591362        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
    13601369
    13611370        flapsLeft = data[self._monidx_flapsLeft]
  • src/mlx/pyuipc_sim.py

    r443 r559  
    342342            print "failed to read offset %04x: %s" % (offset, str(e))
    343343            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]))
    344361
    345362    def _read(self, offset, type):
     
    473490                else int(self.spoilers * (16383 - 4800) + 4800)
    474491        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()
    489493        elif offset==0x0be0 or offset==0x0be4:    # Flaps left and  right
    490494            return self.flaps * 16383.0 / self.flapsNotches[-1]
     
    592596        elif offset==0x3364:       # Frozen
    593597            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)
    594602        elif offset==0x3bfc:       # ZFW
    595603            return int(self.zfw * 256.0 * const.KGSTOLB)
Note: See TracChangeset for help on using the changeset viewer.