ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_aircraft = new Ui_AircraftWidget(); m_aircraft->setupUi(this); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>(); if (!settings->useExpertMode()) { m_aircraft->saveAircraftToRAM->setVisible(false); } ConfigGadgetFactory *configGadgetFactory = pm->getObject<ConfigGadgetFactory>(); connect(m_aircraft->vehicleSetupWizardButton, SIGNAL(clicked()), configGadgetFactory, SIGNAL(onOpenVehicleConfigurationWizard())); SystemSettings *syssettings = SystemSettings::GetInstance(getObjectManager()); Q_ASSERT(syssettings); m_aircraft->nameEdit->setMaxLength(syssettings->VEHICLENAME_NUMELEM); addApplySaveButtons(m_aircraft->saveAircraftToRAM, m_aircraft->saveAircraftToSD); addUAVObject("SystemSettings"); addUAVObject("MixerSettings"); addUAVObject("ActuatorSettings"); m_ffTuningInProgress = false; m_ffTuningPhase = false; // The order of the tabs is important since they correspond with the AirframCategory enum m_aircraft->aircraftType->addTab(tr("Multirotor")); m_aircraft->aircraftType->addTab(tr("Fixed Wing")); m_aircraft->aircraftType->addTab(tr("Helicopter")); m_aircraft->aircraftType->addTab(tr("Ground")); m_aircraft->aircraftType->addTab(tr("Custom")); // Connect aircraft type selection dropbox to callback function connect(m_aircraft->aircraftType, SIGNAL(currentChanged(int)), this, SLOT(switchAirframeType(int))); // Connect the three feed forward test checkboxes connect(m_aircraft->ffTestBox1, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox3, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); // Connect the help pushbutton connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp())); refreshWidgetsValues(); // register FF widgets for dirty state management addWidget(m_aircraft->feedForwardSlider); addWidget(m_aircraft->accelTime); addWidget(m_aircraft->decelTime); addWidget(m_aircraft->maxAccelSlider); addWidget(m_aircraft->ffTestBox1); addWidget(m_aircraft->ffTestBox2); addWidget(m_aircraft->ffTestBox3); addWidget(m_aircraft->nameEdit); disableMouseWheelEvents(); updateEnableControls(); }
ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent),wasItMe(false) { m_config = new Ui_OutputWidget(); m_config->setupUi(this); ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>(); if(!settings->useExpertMode()) m_config->saveRCOutputToRAM->setVisible(false); UAVSettingsImportExportFactory * importexportplugin = pm->getObject<UAVSettingsImportExportFactory>(); connect(importexportplugin,SIGNAL(importAboutToBegin()),this,SLOT(stopTests())); // NOTE: we have channel indices from 0 to 9, but the convention for OP is Channel 1 to Channel 10. // Register for ActuatorSettings changes: for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { OutputChannelForm *outputForm = new OutputChannelForm(i, this, i==0); m_config->channelLayout->addWidget(outputForm); connect(m_config->channelOutTest, SIGNAL(toggled(bool)), outputForm, SLOT(enableChannelTest(bool))); connect(outputForm, SIGNAL(channelChanged(int,int)), this, SLOT(sendChannelTest(int,int))); connect(outputForm, SIGNAL(formChanged()), this, SLOT(do_SetDirty())); } connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool))); // Configure the task widget // Connect the help button connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp())); addApplySaveButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); // Track the ActuatorSettings object addUAVObject("ActuatorSettings"); // Associate the buttons with their UAVO fields addWidget(m_config->cb_outputRate4); addWidget(m_config->cb_outputRate3); addWidget(m_config->cb_outputRate2); addWidget(m_config->cb_outputRate1); addWidget(m_config->spinningArmed); disconnect(this, SLOT(refreshWidgetsValues(UAVObject*))); UAVObjectManager *objManager = pm->getObject<UAVObjectManager>(); UAVObject* obj = objManager->getObject(QString("ActuatorCommand")); if(UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE) this->setEnabled(false); connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(disableIfNotMe(UAVObject*))); connect(SystemSettings::GetInstance(objManager), SIGNAL(objectUpdated(UAVObject*)),this,SLOT(assignOutputChannels(UAVObject*))); refreshWidgetsValues(); }
ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) : ConfigTaskWidget(parent), ui(new Ui_ccattitude) { ui->setupUi(this); // Initialization of the Paper plane widget ui->sixPointHelp->setScene(new QGraphicsScene(this)); paperplane = new QGraphicsSvgItem(); paperplane->setSharedRenderer(new QSvgRenderer()); paperplane->renderer()->load(QString(":/configgadget/images/paper-plane.svg")); paperplane->setElementId("plane-horizontal"); ui->sixPointHelp->scene()->addItem(paperplane); ui->sixPointHelp->setSceneRect(paperplane->boundingRect()); //dynamic widgets don't recieve the connected signal forceConnectedState(); ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>(); if(!settings->useExpertMode()) ui->applyButton->setVisible(false); addApplySaveButtons(ui->applyButton,ui->saveButton); addUAVObject("AttitudeSettings"); addUAVObject("InertialSensorSettings"); addUAVObject("HwCopterControl"); // Load UAVObjects to widget relations from UI file // using objrelation dynamic property autoLoadWidgets(); addUAVObjectToWidgetRelation("AttitudeSettings","ZeroDuringArming",ui->zeroGyroBiasOnArming); // Connect signals connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp())); connect(ui->sixPointStart, SIGNAL(clicked()), &calibration, SLOT(doStartSixPoint())); connect(ui->sixPointSave, SIGNAL(clicked()), &calibration, SLOT(doSaveSixPointPosition())); connect(ui->levelButton ,SIGNAL(clicked()), &calibration, SLOT(doStartLeveling())); connect(ui->sixPointCancel, SIGNAL(clicked()), &calibration ,SLOT(doCancelSixPoint())); // Let calibration update the UI connect(&calibration, SIGNAL(levelingProgressChanged(int)), ui->levelProgress, SLOT(setValue(int))); connect(&calibration, SIGNAL(sixPointProgressChanged(int)), ui->sixPointProgress, SLOT(setValue(int))); connect(&calibration, SIGNAL(showSixPointMessage(QString)), ui->sixPointCalibInstructions, SLOT(setText(QString))); connect(&calibration, SIGNAL(updatePlane(int)), this, SLOT(displayPlane(int))); // Let the calibration gadget control some control enables connect(&calibration, SIGNAL(toggleSavePosition(bool)), ui->sixPointSave, SLOT(setEnabled(bool))); connect(&calibration, SIGNAL(toggleControls(bool)), ui->sixPointCancel, SLOT(setDisabled(bool))); connect(&calibration, SIGNAL(toggleControls(bool)), ui->sixPointStart, SLOT(setEnabled(bool))); connect(&calibration, SIGNAL(toggleControls(bool)), ui->levelButton, SLOT(setEnabled(bool))); addWidget(ui->levelButton); refreshWidgetsValues(); }
ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_aircraft = new Ui_AircraftWidget(); m_aircraft->setupUi(this); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>(); if (!settings->useExpertMode()) { m_aircraft->saveAircraftToRAM->setVisible(false); } addApplySaveButtons(m_aircraft->saveAircraftToRAM, m_aircraft->saveAircraftToSD); addUAVObject("SystemSettings"); addUAVObject("MixerSettings"); addUAVObject("ActuatorSettings"); ffTuningInProgress = false; ffTuningPhase = false; QStringList airframeTypes; airframeTypes << "Fixed Wing" << "Multirotor" << "Helicopter" << "Ground" << "Custom"; m_aircraft->aircraftType->addItems(airframeTypes); // Set default vehicle to MultiRotor // m_aircraft->aircraftType->setCurrentIndex(3); // Connect aircraft type selection dropbox to callback function connect(m_aircraft->aircraftType, SIGNAL(currentIndexChanged(int)), this, SLOT(switchAirframeType(int))); // Connect the three feed forward test checkboxes connect(m_aircraft->ffTestBox1, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox3, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); // Connect the help pushbutton connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp())); refreshWidgetsValues(); // register widgets for dirty state management addWidget(m_aircraft->aircraftType); // register FF widgets for dirty state management addWidget(m_aircraft->feedForwardSlider); addWidget(m_aircraft->accelTime); addWidget(m_aircraft->decelTime); addWidget(m_aircraft->maxAccelSlider); addWidget(m_aircraft->ffTestBox1); addWidget(m_aircraft->ffTestBox2); addWidget(m_aircraft->ffTestBox3); disableMouseWheelEvents(); updateEnableControls(); }
ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_telemetry = new Ui_CC_HW_Widget(); m_telemetry->setupUi(this); ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>(); if(!settings->useExpertMode()) m_telemetry->saveTelemetryToRAM->setVisible(false); UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>(); int id = utilMngr->getBoardModel(); switch (id) { case 0x0101: m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0101.svg")); break; case 0x0301: m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0301.svg")); break; case 0x0401: m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg")); break; case 0x0402: m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg")); break; case 0x0201: m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0201.svg")); break; default: m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg")); break; } addApplySaveButtons(m_telemetry->saveTelemetryToRAM,m_telemetry->saveTelemetryToSD); addUAVObjectToWidgetRelation("HwCopterControl","FlexiPort",m_telemetry->cbFlexi); addUAVObjectToWidgetRelation("HwCopterControl","MainPort",m_telemetry->cbTele); addUAVObjectToWidgetRelation("HwCopterControl","RcvrPort",m_telemetry->cbRcvr); addUAVObjectToWidgetRelation("HwCopterControl","USB_HIDPort",m_telemetry->cbUsbHid); addUAVObjectToWidgetRelation("HwCopterControl","USB_VCPPort",m_telemetry->cbUsbVcp); addUAVObjectToWidgetRelation("ModuleSettings","TelemetrySpeed",m_telemetry->telemetrySpeed); addUAVObjectToWidgetRelation("ModuleSettings","GPSSpeed",m_telemetry->gpsSpeed); addUAVObjectToWidgetRelation("ModuleSettings","ComUsbBridgeSpeed",m_telemetry->comUsbBridgeSpeed); // Load UAVObjects to widget relations from UI file // using objrelation dynamic property autoLoadWidgets(); connect(m_telemetry->cchwHelp,SIGNAL(clicked()),this,SLOT(openHelp())); enableControls(false); populateWidgets(); refreshWidgetsValues(); forceConnectedState(); }
ConfigRevoNanoHWWidget::ConfigRevoNanoHWWidget(QWidget *parent) : ConfigTaskWidget(parent), m_refreshing(true) { m_ui = new Ui_RevoNanoHWWidget(); m_ui->setupUi(this); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>(); if (!settings->useExpertMode()) { m_ui->saveTelemetryToRAM->setEnabled(false); m_ui->saveTelemetryToRAM->setVisible(false); } addApplySaveButtons(m_ui->saveTelemetryToRAM, m_ui->saveTelemetryToSD); forceConnectedState(); addWidgetBinding("HwSettings", "RM_FlexiPort", m_ui->cbFlexi); addWidgetBinding("HwSettings", "RM_MainPort", m_ui->cbMain); addWidgetBinding("HwSettings", "RM_RcvrPort", m_ui->cbRcvr, 0, 1, true); addWidgetBinding("HwSettings", "USB_HIDPort", m_ui->cbUSBHIDFunction); addWidgetBinding("HwSettings", "USB_VCPPort", m_ui->cbUSBVCPFunction); addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbUSBVCPSpeed); addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbFlexiTelemSpeed); addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbFlexiGPSSpeed); addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbFlexiComSpeed); addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbMainTelemSpeed); addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbMainGPSSpeed); addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbMainComSpeed); addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbRcvrTelemSpeed); addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbRcvrComSpeed); // Add Gps protocol configuration addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol); addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbFlexiGPSProtocol); connect(m_ui->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp())); setupCustomCombos(); enableControls(true); populateWidgets(); refreshWidgetsValues(); setDirty(false); m_refreshing = false; }
/** Sends the config to the board (airframe type) We do all the tasks common to all airframes, or family of airframes, and we call additional methods for specific frames, so that we do not have a code that is too heavy. Note: The default behavior of ConfigTaskWidget is bypassed. Therefore no automatic synchronization of UI to UAV Objects is done. */ void ConfigVehicleTypeWidget::updateObjectsFromWidgets() { // Airframe type defaults to Custom QString airframeType = "Custom"; VehicleConfig *vehicleConfig = (VehicleConfig *)m_aircraft->airframesWidget->currentWidget(); if (vehicleConfig) { airframeType = vehicleConfig->updateConfigObjectsFromWidgets(); } // set the airframe type UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings"))); Q_ASSERT(system); QPointer<UAVObjectField> field = system->getField(QString("AirframeType")); if (field) { field->setValue(airframeType); } // Update feed forward settings UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(mixer); QPointer<VehicleConfig> vconfig = new VehicleConfig(); vconfig->setMixerValue(mixer, "FeedForward", m_aircraft->feedForwardSlider->value() / 100.0); vconfig->setMixerValue(mixer, "AccelTime", m_aircraft->accelTime->value()); vconfig->setMixerValue(mixer, "DecelTime", m_aircraft->decelTime->value()); vconfig->setMixerValue(mixer, "MaxAccel", m_aircraft->maxAccelSlider->value()); field = system->getField(QString("VehicleName")); Q_ASSERT(field); QString name = m_aircraft->nameEdit->text(); for (uint i = 0; i < field->getNumElements(); ++i) { if (i < (uint)name.length()) { field->setValue(name.at(i).toLatin1(), i); } else { field->setValue(0, i); } } // call refreshWidgetsValues() to reflect actual saved values refreshWidgetsValues(); updateFeedForwardUI(); }
ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_config = new Ui_OutputWidget(); m_config->setupUi(this); ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>(); if(!settings->useExpertMode()) m_config->saveRCOutputToRAM->setVisible(false); /* There's lots of situations where it's unsafe to run tests. * Import/export: */ UAVSettingsImportExportFactory * importexportplugin = pm->getObject<UAVSettingsImportExportFactory>(); connect(importexportplugin,SIGNAL(importAboutToBegin()),this,SLOT(stopTests())); /* Board connection/disconnection: */ TelemetryManager* telMngr = pm->getObject<TelemetryManager>(); connect(telMngr, SIGNAL(connected()), this, SLOT(stopTests())); connect(telMngr, SIGNAL(disconnected()), this, SLOT(stopTests())); /* When we go into wizards, etc.. time to stop this too. */ Core::ModeManager *modeMngr = Core::ModeManager::instance(); connect(modeMngr, SIGNAL(currentModeAboutToChange(Core::IMode *)), this, SLOT(stopTests())); connect(modeMngr, SIGNAL(currentModeChanged(Core::IMode *)), this, SLOT(stopTests())); // NOTE: we have channel indices from 0 to 9, but the convention for OP is Channel 1 to Channel 10. // Register for ActuatorSettings changes: for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { OutputChannelForm *outputForm = new OutputChannelForm(i, this, i==0); m_config->channelLayout->addWidget(outputForm); connect(m_config->channelOutTest, SIGNAL(toggled(bool)), outputForm, SLOT(enableChannelTest(bool))); connect(outputForm, SIGNAL(channelChanged(int,int)), this, SLOT(sendChannelTest(int,int))); connect(outputForm, SIGNAL(formChanged()), this, SLOT(do_SetDirty())); } connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool))); connect(m_config->calibrateESC, SIGNAL(clicked()), this, SLOT(startESCCalibration())); // Configure the task widget // Connect the help button connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp())); addApplySaveButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); // Track the ActuatorSettings object addUAVObject("ActuatorSettings"); // Associate the buttons with their UAVO fields addWidget(m_config->cb_outputRate6); addWidget(m_config->cb_outputRate5); addWidget(m_config->cb_outputRate4); addWidget(m_config->cb_outputRate3); addWidget(m_config->cb_outputRate2); addWidget(m_config->cb_outputRate1); addWidget(m_config->spinningArmed); // Cache all the combo boxes and labels lblList.clear(); lblList << m_config->chBank1 << m_config->chBank2 << m_config->chBank3 << m_config->chBank4 << m_config->chBank5 << m_config->chBank6; rateList.clear(); rateList << m_config->cb_outputRate1 << m_config->cb_outputRate2 << m_config->cb_outputRate3 << m_config->cb_outputRate4 << m_config->cb_outputRate5 << m_config->cb_outputRate6; resList.clear(); resList << m_config->cb_outputResolution1 << m_config->cb_outputResolution2 << m_config->cb_outputResolution3 << m_config->cb_outputResolution4 << m_config->cb_outputResolution5 << m_config->cb_outputResolution6; // Get the list of output resolutions and assign to the resolution dropdowns ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager()); Q_ASSERT(actuatorSettings); UAVObjectField *resolutions = actuatorSettings->getField("TimerPwmResolution"); Q_ASSERT(resolutions); QList<QComboBox*>::iterator resIter; for (resIter = resList.begin(); resIter != resList.end(); resIter++) { QComboBox *res = *resIter; res->clear(); res->addItems(resolutions->getOptions()); addWidget(res); connect(res, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshWidgetRanges())); } QList<QComboBox*>::iterator rateIter; for (rateIter = rateList.begin(); rateIter != rateList.end(); rateIter++) { QComboBox *rate = *rateIter; connect(rate, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshWidgetRanges())); } disconnect(this, SLOT(refreshWidgetsValues(UAVObject*))); UAVObjectManager *objManager = pm->getObject<UAVObjectManager>(); UAVObject* obj = objManager->getObject(QString("ActuatorCommand")); if(UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE) this->setEnabled(false); connect(SystemSettings::GetInstance(objManager), SIGNAL(objectUpdated(UAVObject*)),this,SLOT(assignOutputChannels(UAVObject*))); refreshWidgetsValues(); }
ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_telemetry = new Ui_CC_HW_Widget(); m_telemetry->setupUi(this); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>(); if (!settings->useExpertMode()) { m_telemetry->saveTelemetryToRAM->setVisible(false); } UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>(); int id = utilMngr->getBoardModel(); switch (id) { case 0x0101: m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0101.svg")); break; case 0x0301: m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0301.svg")); break; case 0x0401: m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg")); break; case 0x0402: m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg")); break; case 0x0201: m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0201.svg")); break; default: m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg")); break; } addApplySaveButtons(m_telemetry->saveTelemetryToRAM, m_telemetry->saveTelemetryToSD); addWidgetBinding("HwSettings", "CC_FlexiPort", m_telemetry->cbFlexi); addWidgetBinding("HwSettings", "CC_MainPort", m_telemetry->cbTele); addWidgetBinding("HwSettings", "CC_RcvrPort", m_telemetry->cbRcvr); addWidgetBinding("HwSettings", "USB_HIDPort", m_telemetry->cbUsbHid); addWidgetBinding("HwSettings", "USB_VCPPort", m_telemetry->cbUsbVcp); addWidgetBinding("HwSettings", "TelemetrySpeed", m_telemetry->telemetrySpeed); addWidgetBinding("HwSettings", "GPSSpeed", m_telemetry->gpsSpeed); // Add Gps protocol configuration HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager()); HwSettings::DataFields hwSettingsData = hwSettings->getData(); if (hwSettingsData.OptionalModules[HwSettings::OPTIONALMODULES_GPS] != HwSettings::OPTIONALMODULES_ENABLED) { m_telemetry->gpsProtocol->setEnabled(false); m_telemetry->gpsProtocol->setToolTip(tr("Enable GPS module and reboot the board to be able to select GPS protocol")); } else { addWidgetBinding("GPSSettings", "DataProtocol", m_telemetry->gpsProtocol); } addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_telemetry->comUsbBridgeSpeed); connect(m_telemetry->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp())); enableSaveButtons(false); populateWidgets(); refreshWidgetsValues(); forceConnectedState(); }
ConfigModuleWidget::ConfigModuleWidget(QWidget *parent) : ConfigTaskWidget(parent) { ui = new Ui::Modules(); ui->setupUi(this); connect(this, SIGNAL(autoPilotConnected()), this, SLOT(recheckTabs())); // Populate UAVO strings AirspeedSettings *airspeedSettings; airspeedSettings = AirspeedSettings::GetInstance(getObjectManager()); QString airspeedSettingsName = airspeedSettings->getName(); FlightBatterySettings batterySettings; QString batterySettingsName = batterySettings.getName(); FlightBatteryState batteryState; QString batteryStateName = batteryState.getName(); ModuleSettings moduleSettings; QString moduleSettingsName = moduleSettings.getName(); VibrationAnalysisSettings vibrationAnalysisSettings; QString vibrationAnalysisSettingsName = vibrationAnalysisSettings.getName(); HoTTSettings hoTTSettings; QString hoTTSettingsName = hoTTSettings.getName(); PicoCSettings picoCSettings; QString picoCSettingsName = picoCSettings.getName(); // Link the checkboxes addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbAirspeed, ModuleSettings::ADMINSTATE_AIRSPEED); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbAltitudeHold, ModuleSettings::ADMINSTATE_ALTITUDEHOLD); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbBattery, ModuleSettings::ADMINSTATE_BATTERY); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbComBridge, ModuleSettings::ADMINSTATE_COMUSBBRIDGE); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbGPS, ModuleSettings::ADMINSTATE_GPS); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbUavoMavlink, ModuleSettings::ADMINSTATE_UAVOMAVLINKBRIDGE); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbOveroSync, ModuleSettings::ADMINSTATE_OVEROSYNC); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbVibrationAnalysis, ModuleSettings::ADMINSTATE_VIBRATIONANALYSIS); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbVtolFollower, ModuleSettings::ADMINSTATE_VTOLPATHFOLLOWER); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbPathPlanner, ModuleSettings::ADMINSTATE_PATHPLANNER); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbPicoC, ModuleSettings::ADMINSTATE_PICOC); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbUAVOHottBridge, ModuleSettings::ADMINSTATE_UAVOHOTTBRIDGE); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbUAVOLighttelemetryBridge, ModuleSettings::ADMINSTATE_UAVOLIGHTTELEMETRYBRIDGE); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbUAVOFrskyBridge, ModuleSettings::ADMINSTATE_UAVOFRSKYSENSORHUBBRIDGE); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbUAVOFrSkySPortBridge, ModuleSettings::ADMINSTATE_UAVOFRSKYSPORTBRIDGE); addUAVObjectToWidgetRelation(moduleSettingsName, "AdminState", ui->cbGeofence, ModuleSettings::ADMINSTATE_GEOFENCE); addUAVObjectToWidgetRelation(batterySettingsName, "SensorType", ui->gb_measureVoltage, FlightBatterySettings::SENSORTYPE_BATTERYVOLTAGE); addUAVObjectToWidgetRelation(batterySettingsName, "SensorType", ui->gb_measureCurrent, FlightBatterySettings::SENSORTYPE_BATTERYCURRENT); // Link the fields addUAVObjectToWidgetRelation(airspeedSettingsName, "GPSSamplePeriod_ms", ui->sb_gpsUpdateRate); addUAVObjectToWidgetRelation(airspeedSettingsName, "Scale", ui->sb_pitotScale); addUAVObjectToWidgetRelation(airspeedSettingsName, "ZeroPoint", ui->sb_pitotZeroPoint); addUAVObjectToWidgetRelation(airspeedSettingsName, "AnalogPin", ui->cbAirspeedAnalog); addUAVObjectToWidgetRelation(batterySettingsName, "Type", ui->cb_batteryType); addUAVObjectToWidgetRelation(batterySettingsName, "NbCells", ui->sb_numBatteryCells); addUAVObjectToWidgetRelation(batterySettingsName, "Capacity", ui->sb_batteryCapacity); addUAVObjectToWidgetRelation(batterySettingsName, "VoltagePin", ui->cbVoltagePin); addUAVObjectToWidgetRelation(batterySettingsName, "CurrentPin", ui->cbCurrentPin); addUAVObjectToWidgetRelation(batterySettingsName, "VoltageThresholds", ui->sb_lowVoltageAlarm, FlightBatterySettings::VOLTAGETHRESHOLDS_ALARM); addUAVObjectToWidgetRelation(batterySettingsName, "VoltageThresholds", ui->sb_lowVoltageWarning, FlightBatterySettings::VOLTAGETHRESHOLDS_WARNING); addUAVObjectToWidgetRelation(batterySettingsName, "SensorCalibrationFactor", ui->sb_voltageFactor, FlightBatterySettings::SENSORCALIBRATIONFACTOR_VOLTAGE); addUAVObjectToWidgetRelation(batterySettingsName, "SensorCalibrationFactor", ui->sb_currentFactor, FlightBatterySettings::SENSORCALIBRATIONFACTOR_CURRENT); addUAVObjectToWidgetRelation(batterySettingsName, "SensorCalibrationOffset", ui->sb_voltageOffSet, FlightBatterySettings::SENSORCALIBRATIONOFFSET_VOLTAGE); addUAVObjectToWidgetRelation(batterySettingsName, "SensorCalibrationOffset", ui->sb_currentOffSet, FlightBatterySettings::SENSORCALIBRATIONOFFSET_CURRENT); addUAVObjectToWidgetRelation(batteryStateName, "Voltage", ui->le_liveVoltageReading); addUAVObjectToWidgetRelation(batteryStateName, "Current", ui->le_liveCurrentReading); addUAVObjectToWidgetRelation(vibrationAnalysisSettingsName, "SampleRate", ui->sb_sampleRate); addUAVObjectToWidgetRelation(vibrationAnalysisSettingsName, "FFTWindowSize", ui->cb_windowSize); //HoTT Sensor addUAVObjectToWidgetRelation(hoTTSettingsName, "Sensor", ui->cb_GAM, HoTTSettings::SENSOR_GAM); addUAVObjectToWidgetRelation(hoTTSettingsName, "Sensor", ui->cb_EAM, HoTTSettings::SENSOR_EAM); addUAVObjectToWidgetRelation(hoTTSettingsName, "Sensor", ui->cb_Vario, HoTTSettings::SENSOR_VARIO); addUAVObjectToWidgetRelation(hoTTSettingsName, "Sensor", ui->cb_GPS, HoTTSettings::SENSOR_GPS); addUAVObjectToWidgetRelation(hoTTSettingsName, "Sensor", ui->cb_ESC, HoTTSettings::SENSOR_ESC); ui->cb_GAM->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_GAM->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_EAM->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_EAM->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_Vario->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_Vario->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_GPS->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_GPS->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_ESC->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_ESC->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings POWERVOLTAGE addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINPOWERVOLTAGE, HoTTSettings::LIMIT_MINPOWERVOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXPOWERVOLTAGE, HoTTSettings::LIMIT_MAXPOWERVOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINPOWERVOLTAGE, HoTTSettings::WARNING_MINPOWERVOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXPOWERVOLTAGE, HoTTSettings::WARNING_MAXPOWERVOLTAGE); ui->cb_MINPOWERVOLTAGE->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINPOWERVOLTAGE->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_MAXPOWERVOLTAGE->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXPOWERVOLTAGE->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings CURRENT addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXCURRENT, HoTTSettings::LIMIT_MAXCURRENT); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXCURRENT, HoTTSettings::WARNING_MAXCURRENT); ui->cb_MAXCURRENT->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXCURRENT->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings USEDCAPACITY addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXUSEDCAPACITY, HoTTSettings::LIMIT_MAXUSEDCAPACITY); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXUSEDCAPACITY, HoTTSettings::WARNING_MAXUSEDCAPACITY); ui->cb_MAXUSEDCAPACITY->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXUSEDCAPACITY->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings CELLVOLTAGE addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINCELLVOLTAGE, HoTTSettings::LIMIT_MINCELLVOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINCELLVOLTAGE, HoTTSettings::WARNING_MINCELLVOLTAGE); ui->cb_MINCELLVOLTAGE->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINCELLVOLTAGE->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SENSOR1VOLTAGE addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINSENSOR1VOLTAGE, HoTTSettings::LIMIT_MINSENSOR1VOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXSENSOR1VOLTAGE, HoTTSettings::LIMIT_MAXSENSOR1VOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINSENSOR1VOLTAGE, HoTTSettings::WARNING_MINSENSOR1VOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXSENSOR1VOLTAGE, HoTTSettings::WARNING_MAXSENSOR1VOLTAGE); ui->cb_MINSENSOR1VOLTAGE->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINSENSOR1VOLTAGE->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_MAXSENSOR1VOLTAGE->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXSENSOR1VOLTAGE->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SENSOR2VOLTAGE addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINSENSOR2VOLTAGE, HoTTSettings::LIMIT_MINSENSOR2VOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXSENSOR2VOLTAGE, HoTTSettings::LIMIT_MAXSENSOR2VOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINSENSOR2VOLTAGE, HoTTSettings::WARNING_MINSENSOR2VOLTAGE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXSENSOR2VOLTAGE, HoTTSettings::WARNING_MAXSENSOR2VOLTAGE); ui->cb_MINSENSOR2VOLTAGE->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINSENSOR2VOLTAGE->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_MAXSENSOR2VOLTAGE->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXSENSOR2VOLTAGE->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SENSOR1TEMP addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINSENSOR1TEMP, HoTTSettings::LIMIT_MINSENSOR1TEMP); addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXSENSOR1TEMP, HoTTSettings::LIMIT_MAXSENSOR1TEMP); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINSENSOR1TEMP, HoTTSettings::WARNING_MINSENSOR1TEMP); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXSENSOR1TEMP, HoTTSettings::WARNING_MAXSENSOR1TEMP); ui->cb_MINSENSOR1TEMP->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINSENSOR1TEMP->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_MAXSENSOR1TEMP->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXSENSOR1TEMP->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SENSOR2TEMP addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINSENSOR2TEMP, HoTTSettings::LIMIT_MINSENSOR2TEMP); addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXSENSOR2TEMP, HoTTSettings::LIMIT_MAXSENSOR2TEMP); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINSENSOR2TEMP, HoTTSettings::WARNING_MINSENSOR2TEMP); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXSENSOR2TEMP, HoTTSettings::WARNING_MAXSENSOR2TEMP); ui->cb_MINSENSOR2TEMP->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINSENSOR2TEMP->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_MAXSENSOR2TEMP->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXSENSOR2TEMP->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings FUEL addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINFUEL, HoTTSettings::LIMIT_MINFUEL); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINFUEL, HoTTSettings::WARNING_MINFUEL); ui->cb_MINFUEL->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINFUEL->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SENSOR1TEMP addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINRPM, HoTTSettings::LIMIT_MINRPM); addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXRPM, HoTTSettings::LIMIT_MAXRPM); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINRPM, HoTTSettings::WARNING_MINRPM); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXRPM, HoTTSettings::WARNING_MAXRPM); ui->cb_MINRPM->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINRPM->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_MAXRPM->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXRPM->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SERVOTEMP addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXSERVOTEMP, HoTTSettings::LIMIT_MAXSERVOTEMP); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXSERVOTEMP, HoTTSettings::WARNING_MAXSERVOTEMP); ui->cb_MAXSERVOTEMP->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXSERVOTEMP->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SERVODIFFERENCE addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXSERVODIFFERENCE, HoTTSettings::LIMIT_MAXSERVODIFFERENCE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXSERVODIFFERENCE, HoTTSettings::WARNING_MAXSERVODIFFERENCE); ui->cb_MAXSERVODIFFERENCE->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXSERVODIFFERENCE->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SPEED addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINSPEED, HoTTSettings::LIMIT_MINSPEED); addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXSPEED, HoTTSettings::LIMIT_MAXSPEED); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINSPEED, HoTTSettings::WARNING_MINSPEED); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXSPEED, HoTTSettings::WARNING_MAXSPEED); ui->cb_MINSPEED->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINSPEED->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_MAXSPEED->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXSPEED->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SPEED addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MINHEIGHT, HoTTSettings::LIMIT_MINHEIGHT); addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXHEIGHT, HoTTSettings::LIMIT_MAXHEIGHT); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MINHEIGHT, HoTTSettings::WARNING_MINHEIGHT); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXHEIGHT, HoTTSettings::WARNING_MAXHEIGHT); ui->cb_MINHEIGHT->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MINHEIGHT->setProperty(falseString.toLatin1(), "Disabled"); ui->cb_MAXHEIGHT->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXHEIGHT->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings SERVOTEMP addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_MAXDISTANCE, HoTTSettings::LIMIT_MAXDISTANCE); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_MAXDISTANCE, HoTTSettings::WARNING_MAXDISTANCE); ui->cb_MAXDISTANCE->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_MAXDISTANCE->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings NEGDIFFERENCE1 addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_NEGDIFFERENCE1, HoTTSettings::LIMIT_NEGDIFFERENCE1); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_NEGDIFFERENCE1, HoTTSettings::WARNING_NEGDIFFERENCE1); ui->cb_NEGDIFFERENCE1->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_NEGDIFFERENCE1->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings NEGDIFFERENCE2 addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_NEGDIFFERENCE2, HoTTSettings::LIMIT_NEGDIFFERENCE2); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_NEGDIFFERENCE2, HoTTSettings::WARNING_NEGDIFFERENCE2); ui->cb_NEGDIFFERENCE2->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_NEGDIFFERENCE2->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings POSDIFFERENCE1 addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_POSDIFFERENCE1, HoTTSettings::LIMIT_POSDIFFERENCE1); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_POSDIFFERENCE1, HoTTSettings::WARNING_POSDIFFERENCE1); ui->cb_POSDIFFERENCE1->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_POSDIFFERENCE1->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings POSDIFFERENCE2 addUAVObjectToWidgetRelation(hoTTSettingsName, "Limit", ui->sb_POSDIFFERENCE2, HoTTSettings::LIMIT_POSDIFFERENCE2); addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_POSDIFFERENCE2, HoTTSettings::WARNING_POSDIFFERENCE2); ui->cb_POSDIFFERENCE2->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_POSDIFFERENCE2->setProperty(falseString.toLatin1(), "Disabled"); //HoTT Settings ALTITUDEBEEP addUAVObjectToWidgetRelation(hoTTSettingsName, "Warning", ui->cb_ALTITUDEBEEP, HoTTSettings::WARNING_ALTITUDEBEEP); ui->cb_ALTITUDEBEEP->setProperty(trueString.toLatin1(), "Enabled"); ui->cb_ALTITUDEBEEP->setProperty(falseString.toLatin1(), "Disabled"); // Connect PicoC settings addUAVObjectToWidgetRelation(picoCSettingsName, "MaxFileSize", ui->sb_picocMaxFileSize); addUAVObjectToWidgetRelation(picoCSettingsName, "TaskStackSize", ui->sb_picocTaskStackSize); addUAVObjectToWidgetRelation(picoCSettingsName, "PicoCStackSize", ui->sb_picocPicoCStackSize); addUAVObjectToWidgetRelation(picoCSettingsName, "BootFileID", ui->sb_picocBootFileID); addUAVObjectToWidgetRelation(picoCSettingsName, "Startup", ui->cb_picocStartup); addUAVObjectToWidgetRelation(picoCSettingsName, "Source", ui->cb_picocSource); addUAVObjectToWidgetRelation(picoCSettingsName, "ComSpeed", ui->cb_picocComSpeed); //Help button addHelpButton(ui->inputHelp,"https://github.com/TauLabs/TauLabs/wiki/OnlineHelp:-Modules"); // Connect any remaining widgets connect(airspeedSettings, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateAirspeedUAVO(UAVObject *))); connect(ui->pb_startVibrationTest, SIGNAL(clicked()), this, SLOT(toggleVibrationTest())); // Set text properties for checkboxes. The second argument is the UAVO field that corresponds // to the checkbox's true (respectively, false) state. ui->cbAirspeed->setProperty(trueString.toLatin1(), "Enabled"); ui->cbAirspeed->setProperty(falseString.toLatin1(), "Disabled"); ui->cbAltitudeHold->setProperty(trueString.toLatin1(), "Enabled"); ui->cbAltitudeHold->setProperty(falseString.toLatin1(), "Disabled"); ui->cbBattery->setProperty(trueString.toLatin1(), "Enabled"); ui->cbBattery->setProperty(falseString.toLatin1(), "Disabled"); ui->cbComBridge->setProperty(trueString.toLatin1(), "Enabled"); ui->cbComBridge->setProperty(falseString.toLatin1(), "Disabled"); ui->cbGPS->setProperty(trueString.toLatin1(), "Enabled"); ui->cbGPS->setProperty(falseString.toLatin1(), "Disabled"); ui->cbUavoMavlink->setProperty(trueString.toLatin1(), "Enabled"); ui->cbUavoMavlink->setProperty(falseString.toLatin1(), "Disabled"); ui->cbOveroSync->setProperty(trueString.toLatin1(), "Enabled"); ui->cbOveroSync->setProperty(falseString.toLatin1(), "Disabled"); ui->cbVibrationAnalysis->setProperty(trueString.toLatin1(), "Enabled"); ui->cbVibrationAnalysis->setProperty(falseString.toLatin1(), "Disabled"); ui->cbVtolFollower->setProperty(trueString.toLatin1(), "Enabled"); ui->cbVtolFollower->setProperty(falseString.toLatin1(), "Disabled"); ui->cbPathPlanner->setProperty(trueString.toLatin1(), "Enabled"); ui->cbPathPlanner->setProperty(falseString.toLatin1(), "Disabled"); ui->cbPicoC->setProperty(trueString.toLatin1(), "Enabled"); ui->cbPicoC->setProperty(falseString.toLatin1(), "Disabled"); ui->cbUAVOHottBridge->setProperty(trueString.toLatin1(), "Enabled"); ui->cbUAVOHottBridge->setProperty(falseString.toLatin1(), "Disabled"); ui->cbUAVOFrskyBridge->setProperty(trueString.toLatin1(), "Enabled"); ui->cbUAVOFrskyBridge->setProperty(falseString.toLatin1(), "Disabled"); ui->cbUAVOFrSkySPortBridge->setProperty(trueString.toLatin1(), "Enabled"); ui->cbUAVOFrSkySPortBridge->setProperty(falseString.toLatin1(), "Disabled"); ui->cbUAVOLighttelemetryBridge->setProperty(trueString.toLatin1(), "Enabled"); ui->cbUAVOLighttelemetryBridge->setProperty(falseString.toLatin1(), "Disabled"); ui->cbGeofence->setProperty(trueString.toLatin1(), "Enabled"); ui->cbGeofence->setProperty(falseString.toLatin1(), "Disabled"); ui->gb_measureVoltage->setProperty(trueString.toLatin1(), "Enabled"); ui->gb_measureVoltage->setProperty(falseString.toLatin1(), "Disabled"); ui->gb_measureCurrent->setProperty(trueString.toLatin1(), "Enabled"); ui->gb_measureCurrent->setProperty(falseString.toLatin1(), "Disabled"); enableBatteryTab(false); enableAirspeedTab(false); enableVibrationTab(false); enableHoTTTelemetryTab(false); enableGeofenceTab(false); enablePicoCTab(false); // Load UAVObjects to widget relations from UI file // using objrelation dynamic property autoLoadWidgets(); // Refresh widget contents refreshWidgetsValues(); // Prevent mouse wheel from changing values disableMouseWheelEvents(); setNotMandatory(batterySettingsName); setNotMandatory(airspeedSettingsName); setNotMandatory(vibrationAnalysisSettingsName); setNotMandatory(hoTTSettingsName); setNotMandatory(picoCSettingsName); setNotMandatory(GeoFenceSettings::NAME); }
ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTaskWidget(parent) { stabSettings = StabilizationSettings::GetInstance(getObjectManager()); m_stabilization = new Ui_StabilizationWidget(); m_stabilization->setupUi(this); setupButtons(m_stabilization->saveStabilizationToRAM, m_stabilization->saveStabilizationToSD); addUAVObject("StabilizationSettings"); refreshWidgetsValues(); // Create a timer to regularly send the object update in case // we want realtime updates. connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateObjectsFromWidgets())); connect(m_stabilization->realTimeUpdates, SIGNAL(toggled(bool)), this, SLOT(realtimeUpdateToggle(bool))); // Connect the updates of the stab values connect(m_stabilization->rateRollKp, SIGNAL(valueChanged(double)), this, SLOT(updateRateRollKP(double))); connect(m_stabilization->rateRollKi, SIGNAL(valueChanged(double)), this, SLOT(updateRateRollKI(double))); connect(m_stabilization->rateRollILimit, SIGNAL(valueChanged(double)), this, SLOT(updateRateRollILimit(double))); connect(m_stabilization->ratePitchKp, SIGNAL(valueChanged(double)), this, SLOT(updateRatePitchKP(double))); connect(m_stabilization->ratePitchKi, SIGNAL(valueChanged(double)), this, SLOT(updateRatePitchKI(double))); connect(m_stabilization->ratePitchILimit, SIGNAL(valueChanged(double)), this, SLOT(updateRatePitchILimit(double))); connect(m_stabilization->rollKp, SIGNAL(valueChanged(double)), this, SLOT(updateRollKP(double))); connect(m_stabilization->rollKi, SIGNAL(valueChanged(double)), this, SLOT(updateRollKI(double))); connect(m_stabilization->rollILimit, SIGNAL(valueChanged(double)), this, SLOT(updateRollILimit(double))); connect(m_stabilization->pitchKp, SIGNAL(valueChanged(double)), this, SLOT(updatePitchKP(double))); connect(m_stabilization->pitchKi, SIGNAL(valueChanged(double)), this, SLOT(updatePitchKI(double))); connect(m_stabilization->pitchILimit, SIGNAL(valueChanged(double)), this, SLOT(updatePitchILimit(double))); addWidget(m_stabilization->rateRollKp); addWidget(m_stabilization->rateRollKi); addWidget(m_stabilization->rateRollILimit); addWidget(m_stabilization->ratePitchKp); addWidget(m_stabilization->ratePitchKi); addWidget(m_stabilization->ratePitchILimit); addWidget(m_stabilization->rateYawKp); addWidget(m_stabilization->rateYawKi); addWidget(m_stabilization->rateYawILimit); addWidget(m_stabilization->rollKp); addWidget(m_stabilization->rollKi); addWidget(m_stabilization->rollILimit); addWidget(m_stabilization->yawILimit); addWidget(m_stabilization->yawKi); addWidget(m_stabilization->yawKp); addWidget(m_stabilization->pitchKp); addWidget(m_stabilization->pitchKi); addWidget(m_stabilization->pitchILimit); addWidget(m_stabilization->rollMax); addWidget(m_stabilization->pitchMax); addWidget(m_stabilization->yawMax); addWidget(m_stabilization->manualRoll); addWidget(m_stabilization->manualPitch); addWidget(m_stabilization->manualYaw); addWidget(m_stabilization->maximumRoll); addWidget(m_stabilization->maximumPitch); addWidget(m_stabilization->maximumYaw); addWidget(m_stabilization->lowThrottleZeroIntegral); // Connect buttons connect(m_stabilization->stabilizationResetToDefaults, SIGNAL(clicked()), this, SLOT(resetToDefaults())); connect(m_stabilization->stabilizationHelp, SIGNAL(clicked()), this, SLOT(openHelp())); }