Changeset 85:42b688827d63


Ignore:
Timestamp:
04/15/12 13:06:17 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Added the handling of the TD rate and the visiblity

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/pyuipc_sim.py

    r83 r85  
    205205        self.ias = 0.0
    206206        self.vs = 0.0
     207        self.tdRate = 0.0
    207208
    208209        self.radioAltitude = None
     
    235236        self.windSpeed = 8.0
    236237        self.windDirection = 300.0
     238        self.visibility = 10000
    237239       
    238240        self.n1 = [0.0, 0.0, 0.0]
     
    273275        elif offset==0x02c8:       # VS
    274276            return int(self.vs * const.FEETTOMETRES * 256.0 / 60.0)
     277        elif offset==0x030c:       # TD rate
     278            return int(self.tdRate * const.FEETTOMETRES * 256.0 / 60.0)
    275279        elif offset==0x0330:       # Altimeter
    276280            return int(self.altimeter * 16.0)
     
    367371            if self.strobeLightsOn: lights |= 0x10
    368372            return lights
     373        elif offset==0x0e8a:       # Visibility
     374            return int(self.visibility * 100.0 / 1609.344)
    369375        elif offset==0x0e90:       # Wind speed
    370376            return int(self.windSpeed)
     
    447453        elif offset==0x02c8:       # VS
    448454            self.vs = value * 60.0 / const.FEETTOMETRES / 256.0
     455            if not self.onTheGround:
     456                self.tdRate = self.vs
    449457        elif offset==0x0330:       # Altimeter
    450458            self.altimeter = value / 16.0
     
    455463        elif offset==0x0354:       # Squawk
    456464            self.squawk = Values._writeBCD(value)
    457         elif offset==0x0366:       # Stalled
     465        elif offset==0x0366:       # On the groud
    458466            self.onTheGround = value!=0
     467            if not self.onTheGround:
     468                self.tdRate = self.vs
    459469        elif offset==0x036c:       # Stalled
    460470            self.stalled = value!=0
     
    536546            self.landingLightsOn = (value&0x04)!=0
    537547            self.strobeLightsOn = (value&0x10)!=0
     548        elif offset==0x0e8a:       # Visibility
     549            self.visibility = value * 1609.344 / 100.0
    538550        elif offset==0x0e90:       # Wind speed
    539551            self.windSpeed = value
     
    935947                                                      const.FEETTOMETRES *
    936948                                                      256.0 / 60.0))
     949        self._valueHandlers["tdRate"] = (0x030c, "d",
     950                                         lambda value: value * 60 /                                     
     951                                         const.FEETTOMETRES / 256.0,
     952                                         lambda word: int(float(word) *
     953                                                          const.FEETTOMETRES *
     954                                                          256.0 / 60.0))
    937955        self._valueHandlers["radioAltitude"] = (0x31e4, "d",
    938956                                                lambda value: value /
     
    10671085                                             CLI.throttle2pyuipc)
    10681086                                                           
     1087        self._valueHandlers["visibility"] = (0x0e8a, "H",
     1088                                             lambda value: value*1609.344/100.0,
     1089                                             lambda word: int(float(word)*
     1090                                                              100.0/1609.344))
     1091                                                           
    10691092    def default(self, line):
    10701093        """Handle unhandle commands."""
Note: See TracChangeset for help on using the changeset viewer.