diff --git a/files/px4/widgets/px4_calibration.qgw b/files/px4/widgets/px4_calibration.qgw index 2a498a3ebfdd93c12a8a8e89738eb3cf75496281..bb895bc3711fc1e8be882953522613cc90dd79f3 100644 --- a/files/px4/widgets/px4_calibration.qgw +++ b/files/px4/widgets/px4_calibration.qgw @@ -58,4 +58,16 @@ QGC_TOOL_WIDGET_ITEMS\5\QGC_COMMAND_BUTTON_PARAM4=1 QGC_TOOL_WIDGET_ITEMS\5\QGC_COMMAND_BUTTON_PARAM5=0 QGC_TOOL_WIDGET_ITEMS\5\QGC_COMMAND_BUTTON_PARAM6=0 QGC_TOOL_WIDGET_ITEMS\5\QGC_COMMAND_BUTTON_PARAM7=0 -QGC_TOOL_WIDGET_ITEMS\size=5 +QGC_TOOL_WIDGET_ITEMS\6\TYPE=COMMANDBUTTON +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_DESCRIPTION=Reboot to Bootloader +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_BUTTONTEXT=BOOTLOADER +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_COMMANDID=246 +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM1=3 +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM2=0 +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM3=0 +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM4=0 +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM5=0 +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM6=0 +QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM7=0 +QGC_TOOL_WIDGET_ITEMS\size=7 diff --git a/src/ui/QGCPX4VehicleConfig.cc b/src/ui/QGCPX4VehicleConfig.cc index c87306f9c5797e72858d7357b570b715e71ae72b..f4fbde4df571304cae869f864dfc75b74089f320 100644 --- a/src/ui/QGCPX4VehicleConfig.cc +++ b/src/ui/QGCPX4VehicleConfig.cc @@ -20,13 +20,13 @@ #include "UASManager.h" #include "UASParameterCommsMgr.h" #include "ui_QGCPX4VehicleConfig.h" - +#include "px4_configuration/QGCPX4AirframeConfig.h" #define WIDGET_INDEX_RC 0 #define WIDGET_INDEX_SENSOR_CAL 1 -#define WIDGET_INDEX_GENERAL_CONFIG 2 -#define WIDGET_INDEX_ADV_CONFIG 3 - +#define WIDGET_INDEX_AIRFRAME_CONFIG 2 +#define WIDGET_INDEX_GENERAL_CONFIG 3 +#define WIDGET_INDEX_ADV_CONFIG 4 #define MIN_PWM_VAL 800 #define MAX_PWM_VAL 2200 @@ -44,15 +44,33 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : rcAux2(0.0f), rcAux3(0.0f), dataModelChanged(true), + channelWanted(-1), rc_mode(RC_MODE_NONE), calibrationEnabled(false), + px4AirframeConfig(NULL), ui(new Ui::QGCPX4VehicleConfig) { doneLoadingConfig = false; + channelNames << "Roll / Aileron"; + channelNames << "Pitch / Elevator"; + channelNames << "Yaw / Rudder"; + channelNames << "Throttle"; + channelNames << "SW1 / Main Mode Switch"; + channelNames << "SW2 / Sub Mode Switch"; + channelNames << "Aux1 / Flaps"; + channelNames << "Aux2"; + channelNames << "Aux3"; + channelNames << "Aux4"; + channelNames << "Aux5"; + channelNames << "Aux6"; + setObjectName("QGC_VEHICLECONFIG"); ui->setupUi(this); + px4AirframeConfig = new QGCPX4AirframeConfig(this); + ui->airframeLayout->addWidget(px4AirframeConfig); + ui->rollWidget->setOrientation(Qt::Horizontal); ui->rollWidget->setName("Roll"); ui->yawWidget->setOrientation(Qt::Horizontal); @@ -72,19 +90,13 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : connect(ui->sensorMenuButton,SIGNAL(clicked()),this,SLOT(sensorMenuButtonClicked())); connect(ui->generalMenuButton,SIGNAL(clicked()),this,SLOT(generalMenuButtonClicked())); connect(ui->advancedMenuButton,SIGNAL(clicked()),this,SLOT(advancedMenuButtonClicked())); - - - int selectedRcModeIdx = (RC_MODE_NONE != rc_mode) ? (int)(rc_mode -1) : -1; - ui->rcModeComboBox->setCurrentIndex(selectedRcModeIdx); + connect(ui->airframeMenuButton, SIGNAL(clicked()), this, SLOT(airframeMenuButtonClicked())); ui->rcCalibrationButton->setCheckable(true); connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool))); connect(ui->writeButton, SIGNAL(clicked()), this, SLOT(writeParameters())); - connect(ui->rcModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setRCModeIndex(int))); - //connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions())); - //TODO connect buttons here to save/clear actions? UASInterface* tmpMav = UASManager::instance()->getActiveUAS(); if (tmpMav) { @@ -96,44 +108,48 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); - //TODO the following methods are not yet implemented - -// Connect RC mapping assignments -// connect(ui->rollSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setRollChan(int))); -// connect(ui->pitchSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPitchChan(int))); -// connect(ui->yawSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setYawChan(int))); -// connect(ui->throttleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setThrottleChan(int))); -// connect(ui->modeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setModeChan(int))); -// connect(ui->aux1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux1Chan(int))); -// connect(ui->aux2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux2Chan(int))); -// connect(ui->aux3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux3Chan(int))); - -// // Connect RC reverse assignments -// connect(ui->invertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setRollInverted(bool))); -// connect(ui->invertCheckBox_2, SIGNAL(clicked(bool)), this, SLOT(setPitchInverted(bool))); -// connect(ui->invertCheckBox_3, SIGNAL(clicked(bool)), this, SLOT(setYawInverted(bool))); -// connect(ui->invertCheckBox_4, SIGNAL(clicked(bool)), this, SLOT(setThrottleInverted(bool))); -// connect(ui->invertCheckBox_5, SIGNAL(clicked(bool)), this, SLOT(setModeInverted(bool))); -// connect(ui->invertCheckBox_6, SIGNAL(clicked(bool)), this, SLOT(setAux1Inverted(bool))); -// connect(ui->invertCheckBox_7, SIGNAL(clicked(bool)), this, SLOT(setAux2Inverted(bool))); -// connect(ui->invertCheckBox_8, SIGNAL(clicked(bool)), this, SLOT(setAux3Inverted(bool))); - - - - + // Connect RC mapping assignments + connect(ui->rollSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setRollChan(int))); + connect(ui->pitchSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPitchChan(int))); + connect(ui->yawSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setYawChan(int))); + connect(ui->throttleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setThrottleChan(int))); + connect(ui->modeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setModeChan(int))); + connect(ui->aux1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux1Chan(int))); + connect(ui->aux2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux2Chan(int))); + connect(ui->aux3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAux3Chan(int))); + + // Connect RC reverse assignments + connect(ui->invertCheckBox, SIGNAL(clicked(bool)), this, SLOT(setRollInverted(bool))); + connect(ui->invertCheckBox_2, SIGNAL(clicked(bool)), this, SLOT(setPitchInverted(bool))); + connect(ui->invertCheckBox_3, SIGNAL(clicked(bool)), this, SLOT(setYawInverted(bool))); + connect(ui->invertCheckBox_4, SIGNAL(clicked(bool)), this, SLOT(setThrottleInverted(bool))); + connect(ui->invertCheckBox_5, SIGNAL(clicked(bool)), this, SLOT(setModeInverted(bool))); + connect(ui->invertCheckBox_6, SIGNAL(clicked(bool)), this, SLOT(setAux1Inverted(bool))); + connect(ui->invertCheckBox_7, SIGNAL(clicked(bool)), this, SLOT(setAux2Inverted(bool))); + connect(ui->invertCheckBox_8, SIGNAL(clicked(bool)), this, SLOT(setAux3Inverted(bool))); + + connect(ui->rollButton, SIGNAL(clicked()), this, SLOT(identifyRollChannel())); + connect(ui->pitchButton, SIGNAL(clicked()), this, SLOT(identifyPitchChannel())); + connect(ui->yawButton, SIGNAL(clicked()), this, SLOT(identifyYawChannel())); + connect(ui->throttleButton, SIGNAL(clicked()), this, SLOT(identifyThrottleChannel())); + connect(ui->modeButton, SIGNAL(clicked()), this, SLOT(identifyModeChannel())); + connect(ui->subButton, SIGNAL(clicked()), this, SLOT(identifySubModeChannel())); + connect(ui->aux1Button, SIGNAL(clicked()), this, SLOT(identifyAux1Channel())); + connect(ui->aux2Button, SIGNAL(clicked()), this, SLOT(identifyAux2Channel())); for (unsigned int i = 0; i < chanMax; i++) { rcValue[i] = UINT16_MAX; rcMapping[i] = i; + channelWantedList[i] = UINT16_MAX; + rcMin[i] = 1000; + rcMax[i] = 2000; } updateTimer.setInterval(150); connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateView())); updateTimer.start(); - - ui->advancedGroupBox->hide(); - connect(ui->advancedCheckBox,SIGNAL(toggled(bool)),ui->advancedGroupBox,SLOT(setShown(bool))); } + void QGCPX4VehicleConfig::rcMenuButtonClicked() { //TODO eg ui->stackedWidget->findChild("rcConfig"); @@ -155,6 +171,28 @@ void QGCPX4VehicleConfig::advancedMenuButtonClicked() ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_ADV_CONFIG); } +void QGCPX4VehicleConfig::airframeMenuButtonClicked() +{ + ui->stackedWidget->setCurrentIndex(WIDGET_INDEX_AIRFRAME_CONFIG); +} + +void QGCPX4VehicleConfig::identifyChannelMapping(int aert_index) +{ + if (chanCount == 0) + return; + channelWanted = aert_index; + + for (unsigned i = 0; i < sizeof(channelWantedList) / sizeof(channelWantedList[0]); i++) + { + if (i >= chanCount) { + channelWantedList[i] = 0; + } else { + channelWantedList[i] = rcValue[i]; + } + } + +} + QGCPX4VehicleConfig::~QGCPX4VehicleConfig() { delete ui; @@ -863,6 +901,11 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active) child->deleteLater(); } + foreach(QWidget* child, ui->airframeLayout->findChildren()) + { + child->deleteLater(); + } + // And then delete any custom tabs foreach(QWidget* child, additionalTabs) { child->deleteLater(); @@ -956,6 +999,8 @@ void QGCPX4VehicleConfig::writeCalibrationRC() { if (!mav) return; + setTrimPositions(); + QString minTpl("RC%1_MIN"); QString maxTpl("RC%1_MAX"); QString trimTpl("RC%1_TRIM"); @@ -1019,6 +1064,9 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float val) chanCount = chan+1; } + // Raw value + rcValue[chan] = val; + // Update calibration data if (calibrationEnabled) { if (val < rcMin[chan]) { @@ -1029,8 +1077,40 @@ void QGCPX4VehicleConfig::remoteControlChannelRawChanged(int chan, float val) } } - // Raw value - rcValue[chan] = val; + if (channelWanted >= 0) { + // If the first channel moved considerably, pick it + if (fabsf(channelWantedList[chan] - val) > 300) + { + rcMapping[channelWanted] = chan; + updateInvertedCheckboxes(chan); + + int chanFound = channelWanted; + + channelWanted = -1; + + // Reject + QMessageBox msgBox; + msgBox.setText(tr("%1 Channel found.").arg(channelNames[chanFound])); + msgBox.setInformativeText(tr("Found %1 to be on the raw RC channel %2").arg(channelNames[chanFound]).arg(chan + 1)); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + (void)msgBox.exec(); + } + } + + // Find correct mapped channel + for (int i = 0; i < chanCount; i++) + { + if (chan == rcMapping[i]) + { + + rcMappedValue[i] = (rcRev[chan]) ? rcMax[chan] - (val - rcMin[chan]) : val; + + // Copy min / max + rcMappedMin[i] = rcMin[chan]; + rcMappedMax[i] = rcMax[chan]; + } + } // Normalized value float normalized; @@ -1367,55 +1447,21 @@ void QGCPX4VehicleConfig::checktimeOuts() void QGCPX4VehicleConfig::updateRcWidgetValues() { - //TODO set eg pitchSpinBox values - - switch (rc_mode) { - case RC_MODE_1: - ui->rollWidget->setValueAndRange(rcValue[0],rcMin[0],rcMax[0]); - ui->throttleWidget->setValueAndRange(rcValue[1],rcMin[1],rcMax[1]); - ui->yawWidget->setValueAndRange(rcValue[2],rcMin[2],rcMax[2]); - ui->pitchWidget->setValueAndRange(rcValue[3],rcMin[3],rcMax[3]); - setRollChan(1); - setThrottleChan(2); - - break; - - case RC_MODE_NONE: - case RC_MODE_2: - ui->rollWidget->setValueAndRange(rcValue[0],rcMin[0],rcMax[0]); - ui->pitchWidget->setValueAndRange(rcValue[1],rcMin[1],rcMax[1]); - ui->throttleWidget->setValueAndRange(rcValue[2],rcMin[2],rcMax[2]); - ui->yawWidget->setValueAndRange(rcValue[3],rcMin[3],rcMax[3]); - break; - - case RC_MODE_3: - ui->yawWidget->setValueAndRange(rcValue[0],rcMin[0],rcMax[0]); - ui->throttleWidget->setValueAndRange(rcValue[1],rcMin[1],rcMax[1]); - ui->rollWidget->setValueAndRange(rcValue[2],rcMin[2],rcMax[2]); - ui->pitchWidget->setValueAndRange(rcValue[3],rcMin[3],rcMax[3]); - break; - - case RC_MODE_4: - ui->yawWidget->setValueAndRange(rcValue[0],rcMin[0],rcMax[0]); - ui->pitchWidget->setValueAndRange(rcValue[1],rcMin[1],rcMax[1]); - ui->rollWidget->setValueAndRange(rcValue[2],rcMin[2],rcMax[2]); - ui->throttleWidget->setValueAndRange(rcValue[3],rcMin[3],rcMax[3]); - break; - } - - ui->radio5Widget->setValueAndRange(rcValue[4],rcMin[4],rcMax[4]); - ui->radio6Widget->setValueAndRange(rcValue[5],rcMin[5],rcMax[5]); - ui->radio7Widget->setValueAndRange(rcValue[6],rcMin[6],rcMax[6]); - ui->radio8Widget->setValueAndRange(rcValue[7],rcMin[7],rcMax[7]); + ui->rollWidget->setValueAndRange(rcMappedValue[0],rcMappedMin[0],rcMappedMax[0]); + ui->pitchWidget->setValueAndRange(rcMappedValue[1],rcMappedMin[1],rcMappedMax[1]); + ui->yawWidget->setValueAndRange(rcMappedValue[2],rcMappedMin[2],rcMappedMax[2]); + ui->throttleWidget->setValueAndRange(rcMappedValue[3],rcMappedMin[3],rcMappedMax[3]); + + ui->radio5Widget->setValueAndRange(rcMappedValue[4],rcMin[4],rcMax[4]); + ui->radio6Widget->setValueAndRange(rcMappedValue[5],rcMin[5],rcMax[5]); + ui->radio7Widget->setValueAndRange(rcMappedValue[6],rcMin[6],rcMax[6]); + ui->radio8Widget->setValueAndRange(rcMappedValue[7],rcMin[7],rcMax[7]); } void QGCPX4VehicleConfig::updateView() { if (dataModelChanged) { dataModelChanged = false; - //update the selected RC mode - int selectedRcModeIdx = (RC_MODE_NONE != rc_mode) ? (rc_mode -1) : -1; - ui->rcModeComboBox->setCurrentIndex(selectedRcModeIdx); updateRcWidgetValues(); diff --git a/src/ui/QGCPX4VehicleConfig.h b/src/ui/QGCPX4VehicleConfig.h index 217d72c66461bce818ad6327c7d77fb295c1efcc..8d735a175de8f6b0cededced0b3cfe6f74d5351f 100644 --- a/src/ui/QGCPX4VehicleConfig.h +++ b/src/ui/QGCPX4VehicleConfig.h @@ -6,9 +6,11 @@ #include #include #include +#include #include "QGCToolWidget.h" #include "UASInterface.h" +#include "px4_configuration/QGCPX4AirframeConfig.h" class UASParameterCommsMgr; @@ -37,6 +39,8 @@ public slots: void sensorMenuButtonClicked(); void generalMenuButtonClicked(); void advancedMenuButtonClicked(); + void airframeMenuButtonClicked(); + void identifyChannelMapping(int aert_index); /** Set the MAV currently being calibrated */ void setActiveUAS(UASInterface* active); @@ -136,6 +140,46 @@ public slots: rcRev[rcMapping[7]] = inverted; } + /** Identify roll */ + void identifyRollChannel() { + identifyChannelMapping(0); + } + + /** Identify pitch */ + void identifyPitchChannel() { + identifyChannelMapping(1); + } + + /** Identify yaw */ + void identifyYawChannel() { + identifyChannelMapping(2); + } + + /** Identify throttle */ + void identifyThrottleChannel() { + identifyChannelMapping(3); + } + + /** Identify mode */ + void identifyModeChannel() { + identifyChannelMapping(4); + } + + /** Identify sub mode */ + void identifySubModeChannel() { + identifyChannelMapping(5); + } + + /** Identify aux 1 */ + void identifyAux1Channel() { + identifyChannelMapping(6); + } + + /** Identify aux 2 */ + void identifyAux2Channel() { + identifyChannelMapping(7); + } + protected slots: void menuButtonClicked(); /** Reset the RC calibration */ @@ -174,6 +218,12 @@ protected: float rcScaling[chanMax]; ///< Scaling of channel input to control commands bool rcRev[chanMax]; ///< Channel reverse int rcValue[chanMax]; ///< Last values + float rcMappedMin[chanMax]; ///< Mapped channels in default order + float rcMappedMax[chanMax]; ///< Mapped channels in default order + float rcMappedValue[chanMax]; ///< Mapped channels in default order + int channelWanted; ///< During channel assignment search the requested default index + float channelWantedList[chanMax]; ///< During channel assignment search the start values + QStringList channelNames; ///< List of channel names in standard order float rcRoll; ///< PPM input channel used as roll control input float rcPitch; ///< PPM input channel used as pitch control input float rcYaw; ///< PPM input channel used as yaw control input @@ -197,6 +247,8 @@ protected: QMap toolToBoxMap; ///< Easy method of figuring out which QGroupBox is tied to which ToolWidget. QMap paramTooltips; ///< Tooltips for the ? button next to a parameter. + QGCPX4AirframeConfig* px4AirframeConfig; + private: Ui::QGCPX4VehicleConfig *ui; QMap buttonToWidgetMap; diff --git a/src/ui/QGCPX4VehicleConfig.ui b/src/ui/QGCPX4VehicleConfig.ui index fd13f905e204e51cb9d0f63559925dccd3bc4282..058ddfc4a61b5076578f742fc3ff42e548ed3f19 100644 --- a/src/ui/QGCPX4VehicleConfig.ui +++ b/src/ui/QGCPX4VehicleConfig.ui @@ -86,6 +86,14 @@ Calibration + + + + Airframe +Config + + + @@ -138,7 +146,7 @@ Config - 3 + 2 @@ -305,96 +313,28 @@ Config - - - - - - Show advanced RC settings - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - Advanced + Stick to Channel Mapping and Reverse - - - - - RC Transmitter Mode - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - + + + - true - - - - 320 - 16777215 - + false - - - Mode 1 - - - - - Mode 2 - - - - - Mode 3 - - - - - Mode 4 - - - - - - - - - - - - 0000 + + 1 - - Qt::AlignCenter + + 8 - + Aux 3 @@ -404,8 +344,8 @@ Config - - + + false @@ -417,66 +357,79 @@ Config - - + + - Invert + Reverse - - - - Roll / Ailerons + + + + false - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + 1 + + + 8 - - + + - Aux 1 + Reverse + + + + + + + Mode Switch Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - Invert + Reverse - - + + - Mode Switch + 0000 - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignCenter - - + + - Invert + 0000 + + + Qt::AlignCenter - - + + - Invert + Reverse - - + + false @@ -488,8 +441,8 @@ Config - - + + false @@ -501,58 +454,48 @@ Config - - + + - 0000 + Aux 1 - Qt::AlignCenter - - - - - - - false - - - 1 - - - 8 + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - Yaw / Rudder + 0000 - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignCenter - - + + - Invert + 0000 + + + Qt::AlignCenter - - + + - Throttle + Aux 2 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + 0000 @@ -561,31 +504,57 @@ Config - - - - false + + + + Reverse - - 1 + + + + + + Identify Roll Channel - - 8 + + + + + + Identify Pitch Channel - - + + - Pitch / Elevator + Identify Yaw Channel - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + Identify Main Mode Switch - - + + + + Identify Aux 1 Channel + + + + + + + Identify Aux 2 Channel + + + + + 0000 @@ -594,28 +563,36 @@ Config - - + + - Aux 2 + Identify Sub Mode Switch - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + Identify Throttle Channel - - + + - 0000 + Reverse - - Qt::AlignCenter + + + + + + Reverse - + false @@ -627,18 +604,8 @@ Config - - - - 0000 - - - Qt::AlignCenter - - - - - + + false @@ -650,25 +617,28 @@ Config - - + + - 0000 + Yaw / Rudder - Qt::AlignCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - Invert + Throttle + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + false @@ -680,8 +650,18 @@ Config + + + + Pitch / Elevator + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + - + 0000 @@ -690,71 +670,60 @@ Config - - + + - Invert + Reverse - - + + - Invert + 0000 + + + Qt::AlignCenter - - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + Roll / Ailerons + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + - - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + Control Channel Name + + - - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + Normalized Value + + + + + + + Reverse Direction / Invert + + - - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + Index of RC Channel used + + @@ -835,6 +804,9 @@ p, li { white-space: pre-wrap; } + + + @@ -1035,8 +1007,8 @@ p, li { white-space: pre-wrap; } 0 0 - 597 - 569 + 98 + 28 diff --git a/src/ui/uas/UASControlWidget.cc b/src/ui/uas/UASControlWidget.cc index aae864499177b8e089fba0510bf4e8e8c299dc72..ebc1934c3adf204453ceca76521ff5ef86347b62 100644 --- a/src/ui/uas/UASControlWidget.cc +++ b/src/ui/uas/UASControlWidget.cc @@ -116,15 +116,17 @@ void UASControlWidget::updateModesList() void UASControlWidget::setUAS(UASInterface* uas) { - if (this->uasID) { + if (this->uasID > 0) { UASInterface* oldUAS = UASManager::instance()->getUASForId(this->uasID); - disconnect(ui.controlButton, SIGNAL(clicked()), oldUAS, SLOT(armSystem())); - disconnect(ui.liftoffButton, SIGNAL(clicked()), oldUAS, SLOT(launch())); - disconnect(ui.landButton, SIGNAL(clicked()), oldUAS, SLOT(home())); - disconnect(ui.shutdownButton, SIGNAL(clicked()), oldUAS, SLOT(shutdown())); - //connect(ui.setHomeButton, SIGNAL(clicked()), uas, SLOT(setLocalOriginAtCurrentGPSPosition())); - disconnect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int, QString, QString))); - disconnect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int))); + if (oldUAS) { + disconnect(ui.controlButton, SIGNAL(clicked()), oldUAS, SLOT(armSystem())); + disconnect(ui.liftoffButton, SIGNAL(clicked()), oldUAS, SLOT(launch())); + disconnect(ui.landButton, SIGNAL(clicked()), oldUAS, SLOT(home())); + disconnect(ui.shutdownButton, SIGNAL(clicked()), oldUAS, SLOT(shutdown())); + //connect(ui.setHomeButton, SIGNAL(clicked()), uas, SLOT(setLocalOriginAtCurrentGPSPosition())); + disconnect(oldUAS, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int, QString, QString))); + disconnect(oldUAS, SIGNAL(statusChanged(int)), this, SLOT(updateState(int))); + } } // Connect user interface controls @@ -141,11 +143,13 @@ void UASControlWidget::setUAS(UASInterface* uas) this->uasID = uas->getUASID(); setBackgroundColor(uas->getColor()); + + this->updateModesList(); + this->updateArmText(); + } else { this->uasID = -1; } - this->updateModesList(); - this->updateArmText(); } UASControlWidget::~UASControlWidget()