Changeset 6:db83d19666dc


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

A bit of work on the constants

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/const.py

    r4 r6  
    33#-------------------------------------------------------------------------------
    44
     5# The ratio between lbs and kg
     6LBSTOKG=0.4536
     7
     8# The ratio between feet and metre
     9FEETTOMETRES=0.3048
     10
     11#-------------------------------------------------------------------------------
     12
    513# Flight simulator type: MS Flight Simulator 2004
    6 TYPE_MSFS9 = 1
     14SIM_MSFS9 = 1
    715
    816# Flight simulator type: MS Flight Simulator X
    9 TYPE_MSFSX = 2
     17SIM_MSFSX = 2
    1018
    1119# Flight simulator type: X-Plane 9
    12 TYPE_XPLANE9 = 3
     20SIM_XPLANE9 = 3
    1321
    1422# Flight simulator type: X-Plane 10
    15 TYPE_XPLANE10 = 4
     23SIM_XPLANE10 = 4
    1624
    1725#-------------------------------------------------------------------------------
  • src/fs.py

    r5 r6  
    3232    FIXME: add info
    3333    """
    34     assert type==const.TYPE_MSFS9, "Only MS Flight Simulator 2004 is supported"
     34    assert type==const.SIM_MSFS9, "Only MS Flight Simulator 2004 is supported"
    3535    import fsuipc
    3636    return fsuipc.Simulator(connectionListener, aircraft)
  • src/fsuipc.py

    r5 r6  
    254254                     pyuipc.fs_version)
    255255                Handler._callSafe(lambda:     
    256                                   self._connectionListener.connected(const.TYPE_MSFS9,
     256                                  self._connectionListener.connected(const.SIM_MSFS9,
    257257                                                                     description))
    258258                return True
     
    578578        state.onTheGround = data[self._monidx_onTheGround]!=0
    579579
    580         state.grossWeight = data[self._monidx_grossWeight] * util.LBSTOKG
     580        state.grossWeight = data[self._monidx_grossWeight] * const.LBSTOKG
    581581       
    582582        state.heading = data[self._monidx_heading]*360.0/65536.0/65536.0
     
    588588        state.ias = data[self._monidx_ias]/128.0
    589589        state.groundSpeed = data[self._monidx_groundSpeed]* 3600.0/65536.0/1852.0
    590         state.vs = data[self._monidx_vs]*60.0*3.28984/256.0
    591 
    592         state.altitude = data[self._monidx_altitude]*3.28084/65536.0/65536.0
     590        state.vs = data[self._monidx_vs]*60.0/const.FEETTOMETRES/256.0
     591
     592        state.altitude = data[self._monidx_altitude]/const.FEETTOMETRES/65536.0/65536.0
    593593
    594594        state.gLoad = data[self._monidx_gLoad] / 625.0
  • src/test.py

    r5 r6  
    1010
    1111def main():
    12     simulator = fs.createSimulator(const.TYPE_MSFS9, fs.ConnectionListener(),
     12    simulator = fs.createSimulator(const.SIM_MSFS9, fs.ConnectionListener(),
    1313                                   acft.Aircraft(const.AIRCRAFT_B737))
    1414    simulator.connect()
  • src/util.py

    r4 r6  
    11# Various utilities
    22
    3 # The ratio between lbs and kg
    4 LBSTOKG=0.4536
Note: See TracChangeset for help on using the changeset viewer.