def m_changeSelectedFunctionType ( self, functionTypeIndex ): self.m_clearSelectedFunctionParamList() prntstr = 'Change selected function type, function{:d}, type index{:d}'.format(self.selectedFunctionIndex, functionTypeIndex) print(prntstr) sourceFBlock = self.FBlocks[functionTypeIndex] self.functions[self.selectedFunctionIndex].header.functionType = sourceFBlock.header.name print("Setting function to name ", self.functions[self.selectedFunctionIndex].header.functionType) for item in self.FBlocks[functionTypeIndex].setting: newParameter = MAVFSettingsAPI.functionBlockDataSub(item.name, item.default) self.functions[self.selectedFunctionIndex].setting.append(newParameter) print("insert new parameter into function") self.m_refreshParametersGrid() self.m_refreshSettingsGrid()
def m_changeFunctionType ( self, functionIndex, functionTypeIndex ): self.selectedFunctionIndex = functionIndex self.m_clearSelectedFunctionParamList() prntstr = 'Change selected function type, function{:d}, type index{:d}'.format(self.selectedFunctionIndex, functionTypeIndex) print(prntstr) sourceFBlock = self.FBlocks[functionTypeIndex] self.MAVFSettings.functions.function[self.selectedFunctionIndex].header.functionType = sourceFBlock.header.name print("Setting function to name ", self.MAVFSettings.functions.function[functionIndex].header.functionType) for item in self.FBlocks[functionTypeIndex].setting: newParameter = MAVFSettingsAPI.functionBlockDataSub(item.name, item.default) self.MAVFSettings.functions.function[functionIndex].setting.append(newParameter) print("insert new parameter into function") self.m_call_callbacks(callback_type.FUNCTION_CHANGED, functionIndex) self.m_call_callbacks(callback_type.REGISTERS_CHANGED, functionIndex)