diff --git a/files/images/px4/airframes/hexa_+.png b/files/images/px4/airframes/hexa_+.png new file mode 100755 index 0000000..486d63a Binary files /dev/null and b/files/images/px4/airframes/hexa_+.png differ diff --git a/files/images/px4/airframes/hexa_x.png b/files/images/px4/airframes/hexa_x.png new file mode 100755 index 0000000..cd1fe50 Binary files /dev/null and b/files/images/px4/airframes/hexa_x.png differ diff --git a/files/images/px4/airframes/octo_+.png b/files/images/px4/airframes/octo_+.png new file mode 100755 index 0000000..df6eeff Binary files /dev/null and b/files/images/px4/airframes/octo_+.png differ diff --git a/files/images/px4/airframes/octo_x.png b/files/images/px4/airframes/octo_x.png new file mode 100755 index 0000000..41faf99 Binary files /dev/null and b/files/images/px4/airframes/octo_x.png differ diff --git a/files/images/px4/airframes/quad_+.png b/files/images/px4/airframes/quad_+.png new file mode 100755 index 0000000..4832def Binary files /dev/null and b/files/images/px4/airframes/quad_+.png differ diff --git a/files/images/px4/airframes/quad_x.png b/files/images/px4/airframes/quad_x.png new file mode 100755 index 0000000..ea68355 Binary files /dev/null and b/files/images/px4/airframes/quad_x.png differ diff --git a/files/styles/style-dark.css b/files/styles/style-dark.css index 762299c..3287e30 100644 --- a/files/styles/style-dark.css +++ b/files/styles/style-dark.css @@ -345,6 +345,16 @@ QPushButton, QToolButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777, stop: 1 #333); } +QPushButton#planePushButton, QPushButton#flyingWingPushButton, QPushButton#quadXPushButton, QPushButton#quadPlusPushButton, QPushButton#hPushButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777, stop: 1 #333); + border-radius: 12px; + min-height: 120px; + max-height: 140px; + min-width: 120px; + max-width: 140px; + border: 3px solid #465158; +} + QPushButton#viewModeGeneric, QPushButton#viewModePX4, QPushButton#viewModeAPM, QPushButton#viewModeAR { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #73D95D, stop: 1 #18A154); border-radius: 12px; diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index c6abb52..664a8d1 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -157,6 +157,12 @@ files/images/firmware/X8_on.png files/images/firmware/Y6_off.png files/images/firmware/Y6_on.png + files/images/px4/airframes/quad_x.png + files/images/px4/airframes/quad_+.png + files/images/px4/airframes/octo_+.png + files/images/px4/airframes/hexa_+.png + files/images/px4/airframes/hexa_x.png + files/images/px4/airframes/octo_x.png files/styles/Vera.ttf diff --git a/src/ui/QGCPX4VehicleConfig.cc b/src/ui/QGCPX4VehicleConfig.cc index f4fbde4..c37c134 100644 --- a/src/ui/QGCPX4VehicleConfig.cc +++ b/src/ui/QGCPX4VehicleConfig.cc @@ -465,6 +465,7 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary) } } + // Load general calibration for autopilot //TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries? tool = new QGCToolWidget("", ui->sensorContents); @@ -496,11 +497,11 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary) delete tool; } - //description.txt - QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt"); - sensortipsfile.open(QIODevice::ReadOnly); - ui->sensorTips->setHtml(sensortipsfile.readAll()); - sensortipsfile.close(); +// //description.txt +// QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt"); +// sensortipsfile.open(QIODevice::ReadOnly); +//// ui->sensorTips->setHtml(sensortipsfile.readAll()); +// sensortipsfile.close(); } void QGCPX4VehicleConfig::menuButtonClicked() { diff --git a/src/ui/QGCPX4VehicleConfig.ui b/src/ui/QGCPX4VehicleConfig.ui index 058ddfc..9f2942d 100644 --- a/src/ui/QGCPX4VehicleConfig.ui +++ b/src/ui/QGCPX4VehicleConfig.ui @@ -146,7 +146,7 @@ Config - 2 + 1 @@ -753,54 +753,31 @@ Config true - + - - - Sensor Calibration - - + - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Lucida Grande'; font-size:16pt; font-weight:600; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400;"><br /></p></body></html> - - - - - + + + true + + + + + 0 + 0 + 1039 + 731 + + + - - - true - - - - - 0 - 0 - 98 - 28 - - - - - - - - - + - - + + @@ -1206,6 +1183,12 @@ p, li { white-space: pre-wrap; }
ui/QGCPendingParamWidget.h
1 + + QGCMessageView + QWidget +
QGCMessageView.h
+ 1 +
diff --git a/src/ui/px4_configuration/QGCPX4AirframeConfig.cc b/src/ui/px4_configuration/QGCPX4AirframeConfig.cc index 6c448b3..f049fee 100644 --- a/src/ui/px4_configuration/QGCPX4AirframeConfig.cc +++ b/src/ui/px4_configuration/QGCPX4AirframeConfig.cc @@ -1,13 +1,194 @@ #include "QGCPX4AirframeConfig.h" #include "ui_QGCPX4AirframeConfig.h" +#include "UASManager.h" +#include "UAS.h" + QGCPX4AirframeConfig::QGCPX4AirframeConfig(QWidget *parent) : QWidget(parent), + mav(NULL), ui(new Ui::QGCPX4AirframeConfig) { ui->setupUi(this); + + // Fill the lists here manually in accordance with the list from: + // https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/rcS + + ui->planeComboBox->addItem(tr("Multiplex Easystar 1/2"), 1); + ui->planeComboBox->addItem(tr("Hobbyking Bixler 1/2"), 10); + + connect(ui->planeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(planeSelected(int))); + + ui->flyingWingComboBox->addItem(tr("Bormatec Camflyer Q"), 1); + ui->flyingWingComboBox->addItem(tr("Phantom FPV"), 10); + + connect(ui->flyingWingComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(flyingWingSelected(int))); + + ui->quadXComboBox->addItem(tr("Standard 10\" Quad"), 1); + ui->quadXComboBox->addItem(tr("DJI F330 8\" Quad"), 10); + + connect(ui->quadXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(quadXSelected(int))); + + connect(ui->quadPlusComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(quadPlusSelected(int))); + + connect(ui->hexaXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hexaXSelected(int))); + + connect(ui->hexaPlusComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hexaPlusSelected(int))); + + connect(ui->octoXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(octoXSelected(int))); + + connect(ui->octoPlusComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(octoPlusSelected(int))); + + connect(ui->hComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hSelected(int))); + + connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(applyAndReboot())); + + connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS())); + + setActiveUAS(UASManager::instance()->getActiveUAS()); +} + +void QGCPX4AirframeConfig::setActiveUAS(UASInterface* uas) +{ +// if (mav) + + if (!uas) + return; + + mav = uas; + + //connect(uas->getParamManager(), SIGNAL()) +} + +void QGCPX4AirframeConfig::setAirframeID(int id) +{ + // If UAS is present, get param manager and set SYS_AUTOSTART ID + if (!mav) + return; + + mav->getParamManager()->setParameter(0, "SYS_AUTOSTART", (qint32)id); +} + +void QGCPX4AirframeConfig::applyAndReboot() +{ + UAS* uas = qobject_cast(mav); + + if (!uas) + return; + // Store parameters + uas->executeCommand(MAV_CMD_PREFLIGHT_STORAGE, 1, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); + // Reboot + uas->executeCommand(MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, 1, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); +} + +void QGCPX4AirframeConfig::setAutoConfig(bool enabled) +{ + if (!mav) + return; + mav->getParamManager()->setParameter(0, "SYS_AUTOCONFIG", (qint32) ((enabled) ? 1 : 0)); +} + +void QGCPX4AirframeConfig::flyingWingSelected() +{ + } +void QGCPX4AirframeConfig::flyingWingSelected(int index) +{ + int system_index = ui->flyingWingComboBox->itemData(index).toInt(); + setAirframeID(system_index); +} + +void QGCPX4AirframeConfig::planeSelected() +{ + +} + +void QGCPX4AirframeConfig::planeSelected(int index) +{ + int system_index = ui->planeComboBox->itemData(index).toInt(); + setAirframeID(system_index); +} + + +void QGCPX4AirframeConfig::quadXSelected() +{ + +} + +void QGCPX4AirframeConfig::quadXSelected(int index) +{ + int system_index = ui->quadXComboBox->itemData(index).toInt(); + setAirframeID(system_index); +} + +void QGCPX4AirframeConfig::quadPlusSelected() +{ + +} + +void QGCPX4AirframeConfig::quadPlusSelected(int index) +{ + int system_index = ui->quadPlusComboBox->itemData(index).toInt(); + setAirframeID(system_index); +} + +void QGCPX4AirframeConfig::hexaXSelected() +{ + +} + +void QGCPX4AirframeConfig::hexaXSelected(int index) +{ + int system_index = ui->hexaXComboBox->itemData(index).toInt(); + setAirframeID(system_index); +} + +void QGCPX4AirframeConfig::hexaPlusSelected() +{ + +} + +void QGCPX4AirframeConfig::hexaPlusSelected(int index) +{ + int system_index = ui->hexaPlusComboBox->itemData(index).toInt(); + setAirframeID(system_index); +} + +void QGCPX4AirframeConfig::octoXSelected() +{ + +} + +void QGCPX4AirframeConfig::octoXSelected(int index) +{ + int system_index = ui->octoXComboBox->itemData(index).toInt(); + setAirframeID(system_index); +} + +void QGCPX4AirframeConfig::octoPlusSelected() +{ + +} + +void QGCPX4AirframeConfig::octoPlusSelected(int index) +{ + int system_index = ui->octoPlusComboBox->itemData(index).toInt(); + setAirframeID(system_index); +} + +void QGCPX4AirframeConfig::hSelected() +{ + +} + +void QGCPX4AirframeConfig::hSelected(int index) +{ + int system_index = ui->hComboBox->itemData(index).toInt(); + setAirframeID(system_index); +} + + QGCPX4AirframeConfig::~QGCPX4AirframeConfig() { delete ui; diff --git a/src/ui/px4_configuration/QGCPX4AirframeConfig.h b/src/ui/px4_configuration/QGCPX4AirframeConfig.h index 5cad0cb..86ebce8 100644 --- a/src/ui/px4_configuration/QGCPX4AirframeConfig.h +++ b/src/ui/px4_configuration/QGCPX4AirframeConfig.h @@ -2,6 +2,7 @@ #define QGCPX4AIRFRAMECONFIG_H #include +#include namespace Ui { class QGCPX4AirframeConfig; @@ -14,8 +15,66 @@ class QGCPX4AirframeConfig : public QWidget public: explicit QGCPX4AirframeConfig(QWidget *parent = 0); ~QGCPX4AirframeConfig(); + +public slots: + + /** + * @brief Set the system currently operated on by this widget + * @param uas The currently active / configured system + */ + void setActiveUAS(UASInterface* uas); + + /** + * @brief Quadrotor in X configuration has been selected + */ + void quadXSelected(); + + /** + * @brief Quadrotor in X configuration has been selected with sub-type + * @param index The autostart index which maps to a particular sub-type + */ + void quadXSelected(int index); + + void flyingWingSelected(); + void flyingWingSelected(int index); + void planeSelected(); + void planeSelected(int index); + + void quadPlusSelected(); + void quadPlusSelected(int index); + void hexaXSelected(); + void hexaXSelected(int index); + void hexaPlusSelected(); + void hexaPlusSelected(int index); + void octoXSelected(); + void octoXSelected(int index); + void octoPlusSelected(); + void octoPlusSelected(int index); + void hSelected(); + void hSelected(int index); + + /** + * @brief Apply changes and reboot system + */ + void applyAndReboot(); + +protected: + + /** + * @brief Set the ID of the current airframe + * @param id the ID as defined by the PX4 SYS_AUTOSTART enum + */ + void setAirframeID(int id); + + /** + * @brief Enable automatic configuration + * @param enabled If true, the system sets the default gains for this platform on the next boot + */ + void setAutoConfig(bool enabled); + private: + UASInterface* mav; Ui::QGCPX4AirframeConfig *ui; }; diff --git a/src/ui/px4_configuration/QGCPX4AirframeConfig.ui b/src/ui/px4_configuration/QGCPX4AirframeConfig.ui index f5aa09a..f73e0e1 100644 --- a/src/ui/px4_configuration/QGCPX4AirframeConfig.ui +++ b/src/ui/px4_configuration/QGCPX4AirframeConfig.ui @@ -6,8 +6,8 @@ 0 0 - 602 - 345 + 803 + 416 @@ -24,8 +24,8 @@ 0 0 - 561 - 299 + 802 + 531 @@ -121,6 +121,16 @@ + + + :/files/images/px4/airframes/quad_x.png:/files/images/px4/airframes/quad_x.png + + + + 120 + 120 + + @@ -159,14 +169,24 @@ - + - PushButton + + + + + :/files/images/px4/airframes/quad_+.png:/files/images/px4/airframes/quad_+.png + + + + 120 + 120 + - + @@ -180,14 +200,24 @@ - + - PushButton + + + + + :/files/images/px4/airframes/hexa_x.png:/files/images/px4/airframes/hexa_x.png + + + + 120 + 120 + - + @@ -201,14 +231,24 @@ - + - PushButton + + + + + :/files/images/px4/airframes/hexa_+.png:/files/images/px4/airframes/hexa_+.png + + + + 120 + 120 + - + @@ -224,12 +264,22 @@ - PushButton + + + + + :/files/images/px4/airframes/octo_x.png:/files/images/px4/airframes/octo_x.png + + + + 120 + 120 + - + @@ -245,12 +295,22 @@ - PushButton + + + + + :/files/images/px4/airframes/octo_+.png:/files/images/px4/airframes/octo_+.png + + + + 120 + 120 + - + @@ -266,12 +326,12 @@ - PushButton + - + Steadydrone @@ -313,6 +373,8 @@ - + + + diff --git a/src/ui/uas/QGCMessageView.cc b/src/ui/uas/QGCMessageView.cc index 67a2821..7f4f891 100644 --- a/src/ui/uas/QGCMessageView.cc +++ b/src/ui/uas/QGCMessageView.cc @@ -22,6 +22,7 @@ QGCMessageView::QGCMessageView(QWidget *parent) : ui->horizontalLayout->addWidget(connectWidget); ui->plainTextEdit->hide(); + setActiveUAS(UASManager::instance()->getActiveUAS()); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); }