Beispiel #1
0
    def initInput(self, aircraft):
        Input.initInput(self, aircraft)  # call parent init Input.

        if aircraft.demoMode:
            # if in demo mode then load example data file.
            # get demo file to read from config.  else default to..
            if not len(aircraft.demoFile):
                defaultTo = "mgl_data1.bin"
                #defaultTo = "mgl_G430_v6_HSI_Nedl_2degsRtt_Vert_2Degs_Up.bin"
                #defaultTo = "mgl_G430_v7_Horz_Vert_Nedl_come to center.bin"
                aircraft.demoFile = hud_utils.readConfig(
                    self.name, "demofile", defaultTo)
            self.ser = open(
                "lib/inputs/_example_data/%s" % (aircraft.demoFile), "r")
        else:
            self.efis_data_format = hud_utils.readConfig(
                "DataInput", "format", "none")
            self.efis_data_port = hud_utils.readConfig("DataInput", "port",
                                                       "/dev/ttyS0")
            self.efis_data_baudrate = hud_utils.readConfigInt(
                "DataInput", "baudrate", 115200)

            # open serial connection.
            self.ser = serial.Serial(
                port=self.efis_data_port,
                baudrate=self.efis_data_baudrate,
                parity=serial.PARITY_NONE,
                stopbits=serial.STOPBITS_ONE,
                bytesize=serial.EIGHTBITS,
                timeout=1,
            )
Beispiel #2
0
    def initInput(self,aircraft):
        Input.initInput( self, aircraft )  # call parent init Input.
        
        if aircraft.demoMode:
            # if in demo mode then load example data file.
            self.ser = open("lib/inputs/_example_data/flyonspeed2efisdata_data1.csv", "r") 
        else:
            self.efis_data_format = hud_utils.readConfig("DataInput", "format", "none")
            self.efis_data_port = hud_utils.readConfig("DataInput", "port", "/dev/ttyS0")
            self.efis_data_baudrate = hud_utils.readConfigInt(
                "DataInput", "baudrate", 115200
            )

            # open serial connection.
            self.ser = serial.Serial(
                port=self.efis_data_port,
                baudrate=self.efis_data_baudrate,
                parity=serial.PARITY_NONE,
                stopbits=serial.STOPBITS_ONE,
                bytesize=serial.EIGHTBITS,
                timeout=1,
            )
Beispiel #3
0
    class_ = getattr(mod, ScreenNameToLoad)
    CurrentScreen = class_()
    pygamescreen, screen_size = hud_graphics.initDisplay(0)
    width, height = screen_size
    pygame.mouse.set_visible(False)  # hide the mouse
    CurrentScreen.initDisplay(pygamescreen, width,
                              height)  # tell the screen we are about to start.
    drawTimer.addGrowlNotice(ScreenNameToLoad, 3000, drawTimer.nerd_yellow)


#############################################
#############################################
# Hud start code.
#
aircraft = aircraft.Aircraft()
ScreenNameToLoad = hud_utils.readConfig(
    "HUD", "screen", "DefaultScreen")  # default screen to load
DataInputToLoad = hud_utils.readConfig("DataInput", "inputsource",
                                       "none")  # input method

# check args passed in.
if __name__ == "__main__":
    #print 'ARGV      :', sys.argv[1:]
    try:
        opts, args = getopt.getopt(sys.argv[1:], "hs:i:tec:")
    except getopt.GetoptError:
        print("unknown command line args given..")
        hud_utils.showArgs()
    for opt, arg in opts:
        #print("opt: %s  arg: %s"%(opt,arg))
        if opt == '-t':
            aircraft.textMode = True