Beispiel #1
0
	def putCellDataInDatabase(self):
		self.doc.MAVFSettings.inputRegs.input = []
		
		index = 0
		endFound = False
		while( (index < self.m_gridVirtual.GetNumberRows()) and (endFound == False) ):
			CellText = self.m_gridVirtual.GetCellValue( index, 0 )
			if(CellText == ""):
				endFound = True
			else:
				inputReg = MAVFSettingsAPI.inputSub(CellText)
				self.doc.MAVFSettings.inputRegs.input.append(inputReg)
			index += 1
		
		self.doc.MAVFSettings.outputRegs.output = []

		index = 0
		endFound = False
		while( (index < self.m_gridVirtual.GetNumberRows()) and (endFound == False) ):
			CellText = self.m_gridVirtual.GetCellValue( index, 1 )
			if(CellText == ""):
				endFound = True
			else:
				outputReg = MAVFSettingsAPI.outputSub(CellText)
				self.doc.MAVFSettings.outputRegs.output.append(outputReg)
			index += 1
Beispiel #2
0
    def m_openSettingsFile( self, filepath ):
        self.MAVFSettings = MAVFSettingsAPI.parse(filepath)

        self.selectedFunctionIndex = 0
        self.selectedRegisterIndex = 0

        self.registers = self.MAVFSettings.registers.register

        
        if(self.MAVFSettings.get_inputRegs() == None):
            try:
                inputRegs = MAVFSettingsAPI.inputsSub()
                self.MAVFSettings.set_inputRegs(inputRegs)

                inputReg = MAVFSettingsAPI.inputSub("PWIN_ROLL")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("PWIN_PITCH")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("PWIN_YAW")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("PWIN_THROTTLE")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("PWIN_FLAP")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("PWIN_CAMBER")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("PWIN_BRAKE")
                self.MAVFSettings.inputRegs.input.append(inputReg)

                inputReg = MAVFSettingsAPI.inputSub("APCON_ROLL")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("APCON_PITCH")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("APCON_YAW")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("APCON_THROTTLE")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("APCON_FLAP")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("APCON_CAMBER")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("APCON_BRAKE")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("APCON_WAGGLE")
                self.MAVFSettings.inputRegs.input.append(inputReg)

                inputReg = MAVFSettingsAPI.inputSub("APMODE_FULL")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("RADIO_MANUAL_MODE")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("APMODE_RADIO_ON")
                self.MAVFSettings.inputRegs.input.append(inputReg)
                inputReg = MAVFSettingsAPI.inputSub("GAIN_MAN_MIX")
                self.MAVFSettings.inputRegs.input.append(inputReg)

            except:
                print("summat wrong")
                
        
        if(self.MAVFSettings.get_outputRegs() == None):
            try:
                outputRegs = MAVFSettingsAPI.outputsSub()
                self.MAVFSettings.set_outputRegs(outputRegs)

                outputReg = MAVFSettingsAPI.outputSub("AILERON_L")
                self.MAVFSettings.outputRegs.output.append(outputReg)
                outputReg = MAVFSettingsAPI.outputSub("ELEVATOR")
                self.MAVFSettings.outputRegs.output.append(outputReg)
                outputReg = MAVFSettingsAPI.outputSub("THROTTLE")
                self.MAVFSettings.outputRegs.output.append(outputReg)
                outputReg = MAVFSettingsAPI.outputSub("RUDDER")
                self.MAVFSettings.outputRegs.output.append(outputReg)
                outputReg = MAVFSettingsAPI.outputSub("AILERON_R")
                self.MAVFSettings.outputRegs.output.append(outputReg)
                outputReg = MAVFSettingsAPI.outputSub("FLAPMID_L")
                self.MAVFSettings.outputRegs.output.append(outputReg)
                outputReg = MAVFSettingsAPI.outputSub("FLAPMID_R")
                self.MAVFSettings.outputRegs.output.append(outputReg)
                outputReg = MAVFSettingsAPI.outputSub("FLAP_L")
                self.MAVFSettings.outputRegs.output.append(outputReg)
                outputReg = MAVFSettingsAPI.outputSub("FLAP_R")
                self.MAVFSettings.outputRegs.output.append(outputReg)
                outputReg = MAVFSettingsAPI.outputSub("SPOILER")
                self.MAVFSettings.outputRegs.output.append(outputReg)
            except:
                print("summat else wrong")
            
            self.m_call_callbacks(callback_type.UPDATE_ALL)