Commit 1ce02853 authored by Lorenz Meier's avatar Lorenz Meier

Instantiate a PX4 config view in PX4 mode from start, since boards with just...

Instantiate a PX4 config view in PX4 mode from start, since boards with just the bootloader (or no working telemetry) cannot be flashed else.
parent 1487bf57
......@@ -163,6 +163,9 @@ exists(qupgrade) {
DEFINES += "QUPGRADE_SUPPORT"
}
# Include GLC library
#include(libs/GLC_lib/glc_lib.pri)
# Include QWT plotting library
include(libs/qwt/qwt.pri)
......@@ -285,7 +288,8 @@ FORMS += src/ui/MainWindow.ui \
src/ui/configuration/terminalconsole.ui \
src/ui/configuration/SerialSettingsDialog.ui \
src/ui/configuration/ApmFirmwareConfig.ui \
src/ui/px4_configuration/QGCPX4AirframeConfig.ui
src/ui/px4_configuration/QGCPX4AirframeConfig.ui \
src/ui/px4_configuration/QGCPX4MulticopterConfig.ui
INCLUDEPATH += src \
src/ui \
......@@ -489,7 +493,7 @@ HEADERS += src/MG.h \
src/ui/QGCPendingParamWidget.h \
src/ui/px4_configuration/QGCPX4AirframeConfig.h \
src/ui/QGCBaseParamWidget.h \
src/comm/px4_custom_mode.h
src/ui/px4_configuration/QGCPX4MulticopterConfig.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
......@@ -709,7 +713,8 @@ SOURCES += src/main.cc \
src/uas/UASParameterCommsMgr.cc \
src/ui/QGCPendingParamWidget.cc \
src/ui/px4_configuration/QGCPX4AirframeConfig.cc \
src/ui/QGCBaseParamWidget.cc
src/ui/QGCBaseParamWidget.cc \
src/ui/px4_configuration/QGCPX4MulticopterConfig.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
......@@ -166,6 +166,7 @@
<file>files/images/px4/airframes/flying_wing.png</file>
<file>files/images/px4/airframes/plane_ert.png</file>
<file>files/images/px4/airframes/plane_aert.png</file>
<file>files/images/px4/airframes/quad_h.png</file>
</qresource>
<qresource prefix="/general">
<file alias="vera.ttf">files/styles/Vera.ttf</file>
......
......@@ -4,18 +4,26 @@
#include "QGCPX4VehicleConfig.h"
#include "QGCVehicleConfig.h"
#include "QGCPX4VehicleConfig.h"
#include "MainWindow.h"
QGCConfigView::QGCConfigView(QWidget *parent) :
QWidget(parent),
ui(new Ui::QGCConfigView),
config(NULL),
mav(NULL)
{
ui->setupUi(this);
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(activeUASChanged(UASInterface*)));
//don't show a configuration widget if no vehicle is connected
//show a placeholder informational widget instead
// The config screens are required for firmware uploading
if (MainWindow::instance()->getCustomMode() == MainWindow::CUSTOM_MODE_PX4) {
config = new QGCPX4VehicleConfig();
ui->gridLayout->addWidget(config);
} else {
//don't show a configuration widget if no vehicle is connected
//show a placeholder informational widget instead
}
}
......@@ -49,10 +57,26 @@ void QGCConfigView::activeUASChanged(UASInterface* uas)
int autopilotType = mav->getAutopilotType();
switch (autopilotType) {
case MAV_AUTOPILOT_PX4:
ui->gridLayout->addWidget(new QGCPX4VehicleConfig());
{
QGCPX4VehicleConfig* px4config = qobject_cast<QGCPX4VehicleConfig*>(config);
if (!px4config) {
if (config)
delete config;
config = new QGCPX4VehicleConfig();
ui->gridLayout->addWidget(config);
}
}
break;
default:
ui->gridLayout->addWidget(new QGCVehicleConfig());
{
QGCVehicleConfig* generalconfig = qobject_cast<QGCVehicleConfig*>(config);
if (!generalconfig) {
if (config)
delete config;
config = new QGCVehicleConfig();
ui->gridLayout->addWidget(config);
}
}
break;
}
}
......
......@@ -21,6 +21,7 @@ public slots:
private:
Ui::QGCConfigView *ui;
QWidget *config;
UASInterface* mav;
};
......
......@@ -82,6 +82,11 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
setObjectName("QGC_VEHICLECONFIG");
ui->setupUi(this);
ui->advancedMenuButton->setEnabled(false);
ui->airframeMenuButton->setEnabled(false);
ui->sensorMenuButton->setEnabled(false);
ui->rcMenuButton->setEnabled(false);
px4AirframeConfig = new QGCPX4AirframeConfig(this);
ui->airframeLayout->addWidget(px4AirframeConfig);
......@@ -1118,7 +1123,11 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
updateStatus(QString("Reading from system %1").arg(mav->getUASName()));
// Since a system is now connected, enable the VehicleConfig UI.
//TODO anything?
// Enable buttons
ui->advancedMenuButton->setEnabled(true);
ui->airframeMenuButton->setEnabled(true);
ui->sensorMenuButton->setEnabled(true);
ui->rcMenuButton->setEnabled(true);
}
void QGCPX4VehicleConfig::resetCalibrationRC()
......
......@@ -33,9 +33,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-291</y>
<width>762</width>
<height>531</height>
<height>647</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
......@@ -318,6 +318,10 @@
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../qgroundcontrol.qrc">
<normaloff>:/files/images/px4/airframes/quad_h.png</normaloff>:/files/images/px4/airframes/quad_h.png</iconset>
</property>
<property name="iconSize">
<size>
<width>120</width>
......
#include "QGCPX4MulticopterConfig.h"
#include "ui_QGCPX4MulticopterConfig.h"
QGCPX4MulticopterConfig::QGCPX4MulticopterConfig(QWidget *parent) :
QWidget(parent),
ui(new Ui::QGCPX4MulticopterConfig)
{
ui->setupUi(this);
}
QGCPX4MulticopterConfig::~QGCPX4MulticopterConfig()
{
delete ui;
}
#ifndef QGCPX4MULTICOPTERCONFIG_H
#define QGCPX4MULTICOPTERCONFIG_H
#include <QWidget>
namespace Ui {
class QGCPX4MulticopterConfig;
}
class QGCPX4MulticopterConfig : public QWidget
{
Q_OBJECT
public:
explicit QGCPX4MulticopterConfig(QWidget *parent = 0);
~QGCPX4MulticopterConfig();
private:
Ui::QGCPX4MulticopterConfig *ui;
};
#endif // QGCPX4MULTICOPTERCONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCPX4MulticopterConfig</class>
<widget class="QWidget" name="QGCPX4MulticopterConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>605</width>
<height>449</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QSlider" name="horizontalSlider">
<property name="geometry">
<rect>
<x>130</x>
<y>150</y>
<width>341</width>
<height>22</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QSlider" name="horizontalSlider_2">
<property name="geometry">
<rect>
<x>130</x>
<y>400</y>
<width>351</width>
<height>22</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>160</y>
<width>62</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>510</x>
<y>160</y>
<width>62</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>40</x>
<y>400</y>
<width>62</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>520</x>
<y>400</y>
<width>62</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>30</x>
<y>10</y>
<width>62</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>30</x>
<y>200</y>
<width>62</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment