Commit a259736d authored by Gus Grubba's avatar Gus Grubba

Merge branch 'master' of https://github.com/mavlink/qgroundcontrol into cameraAndVideo

parents 5776de49 93d38743
...@@ -8262,6 +8262,21 @@ is less than 50% of this value</short_desc> ...@@ -8262,6 +8262,21 @@ is less than 50% of this value</short_desc>
<long_desc>This parameter defines a rotational offset in degrees around the Z (Yaw) axis. It allows the user to fine tune the board offset in the event of misalignment.</long_desc> <long_desc>This parameter defines a rotational offset in degrees around the Z (Yaw) axis. It allows the user to fine tune the board offset in the event of misalignment.</long_desc>
<unit>deg</unit> <unit>deg</unit>
</parameter> </parameter>
<parameter default="0" name="SENS_CM8JL65_CFG" type="INT32">
<short_desc>Serial Configuration for Lanbao PSK-CM8JL65-CC5</short_desc>
<long_desc>Configure on which serial port to run Lanbao PSK-CM8JL65-CC5.</long_desc>
<reboot_required>true</reboot_required>
<values>
<value code="0">Disabled</value>
<value code="6">UART 6</value>
<value code="101">TELEM 1</value>
<value code="102">TELEM 2</value>
<value code="103">TELEM 3</value>
<value code="104">TELEM/SERIAL 4</value>
<value code="201">GPS 1</value>
<value code="202">GPS 2</value>
</values>
</parameter>
<parameter default="0" name="SENS_EN_BATT" type="INT32"> <parameter default="0" name="SENS_EN_BATT" type="INT32">
<short_desc>SMBUS Smart battery driver (BQ40Z50)</short_desc> <short_desc>SMBUS Smart battery driver (BQ40Z50)</short_desc>
<boolean /> <boolean />
......
...@@ -74,6 +74,7 @@ public: ...@@ -74,6 +74,7 @@ public:
static const int boardIDTAPV1 = 64; ///< TAP V1 board, as from USB PID static const int boardIDTAPV1 = 64; ///< TAP V1 board, as from USB PID
static const int boardIDASCV1 = 65; ///< ASC V1 board, as from USB PID static const int boardIDASCV1 = 65; ///< ASC V1 board, as from USB PID
static const int boardIDCrazyflie2 = 12; ///< Crazyflie 2.0 board, as from USB PID static const int boardIDCrazyflie2 = 12; ///< Crazyflie 2.0 board, as from USB PID
static const int boardIDOmnibusF4SD = 42; ///< Omnibus F4 SD, as from USB PID
static const int boardIDNXPHliteV3 = 28; ///< NXPHliteV3 board, as from USB PID static const int boardIDNXPHliteV3 = 28; ///< NXPHliteV3 board, as from USB PID
/// Simulated board id for V3 which is a V2 board which supports larger flash space /// Simulated board id for V3 which is a V2 board which supports larger flash space
......
...@@ -262,6 +262,12 @@ void FirmwareUpgradeController::_initFirmwareHash() ...@@ -262,6 +262,12 @@ void FirmwareUpgradeController::_initFirmwareHash()
{ AutoPilotStackPX4, DeveloperFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/master/crazyflie_default.px4"}, { AutoPilotStackPX4, DeveloperFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/master/crazyflie_default.px4"},
}; };
FirmwareToUrlElement_t rgOmnibusF4SDFirmwareArray[] = {
{ AutoPilotStackPX4, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/stable/omnibus_f4sd_default.px4"},
{ AutoPilotStackPX4, BetaFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/beta/omnibus_f4sd_default.px4"},
{ AutoPilotStackPX4, DeveloperFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/master/omnibus_f4sd_default.px4"},
};
/////////////////////////////// px4flow firmwares /////////////////////////////////////// /////////////////////////////// px4flow firmwares ///////////////////////////////////////
FirmwareToUrlElement_t rgPX4FLowFirmwareArray[] = { FirmwareToUrlElement_t rgPX4FLowFirmwareArray[] = {
{ PX4FlowPX4, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Flow/master/px4flow.px4" }, { PX4FlowPX4, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Flow/master/px4flow.px4" },
...@@ -447,6 +453,12 @@ void FirmwareUpgradeController::_initFirmwareHash() ...@@ -447,6 +453,12 @@ void FirmwareUpgradeController::_initFirmwareHash()
_rgCrazyflie2Firmware.insert(FirmwareIdentifier(element.stackType, element.firmwareType, element.vehicleType), element.url); _rgCrazyflie2Firmware.insert(FirmwareIdentifier(element.stackType, element.firmwareType, element.vehicleType), element.url);
} }
size = sizeof(rgOmnibusF4SDFirmwareArray)/sizeof(rgOmnibusF4SDFirmwareArray[0]);
for (int i = 0; i < size; i++) {
const FirmwareToUrlElement_t& element = rgOmnibusF4SDFirmwareArray[i];
_rgOmnibusF4SDFirmware.insert(FirmwareIdentifier(element.stackType, element.firmwareType, element.vehicleType), element.url);
}
size = sizeof(rgPX4FLowFirmwareArray)/sizeof(rgPX4FLowFirmwareArray[0]); size = sizeof(rgPX4FLowFirmwareArray)/sizeof(rgPX4FLowFirmwareArray[0]);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
const FirmwareToUrlElement_t& element = rgPX4FLowFirmwareArray[i]; const FirmwareToUrlElement_t& element = rgPX4FLowFirmwareArray[i];
...@@ -514,6 +526,9 @@ QHash<FirmwareUpgradeController::FirmwareIdentifier, QString>* FirmwareUpgradeCo ...@@ -514,6 +526,9 @@ QHash<FirmwareUpgradeController::FirmwareIdentifier, QString>* FirmwareUpgradeCo
case Bootloader::boardIDCrazyflie2: case Bootloader::boardIDCrazyflie2:
rgFirmware = &_rgCrazyflie2Firmware; rgFirmware = &_rgCrazyflie2Firmware;
break; break;
case Bootloader::boardIDOmnibusF4SD:
rgFirmware = &_rgOmnibusF4SDFirmware;
break;
case Bootloader::boardIDNXPHliteV3: case Bootloader::boardIDNXPHliteV3:
rgFirmware = &_rgNXPHliteV3Firmware; rgFirmware = &_rgNXPHliteV3Firmware;
break; break;
......
...@@ -211,6 +211,7 @@ private: ...@@ -211,6 +211,7 @@ private:
QHash<FirmwareIdentifier, QString> _rgTAPV1Firmware; QHash<FirmwareIdentifier, QString> _rgTAPV1Firmware;
QHash<FirmwareIdentifier, QString> _rgASCV1Firmware; QHash<FirmwareIdentifier, QString> _rgASCV1Firmware;
QHash<FirmwareIdentifier, QString> _rgCrazyflie2Firmware; QHash<FirmwareIdentifier, QString> _rgCrazyflie2Firmware;
QHash<FirmwareIdentifier, QString> _rgOmnibusF4SDFirmware;
QHash<FirmwareIdentifier, QString> _rgNXPHliteV3Firmware; QHash<FirmwareIdentifier, QString> _rgNXPHliteV3Firmware;
QHash<FirmwareIdentifier, QString> _rgPX4FLowFirmware; QHash<FirmwareIdentifier, QString> _rgPX4FLowFirmware;
QHash<FirmwareIdentifier, QString> _rg3DRRadioFirmware; QHash<FirmwareIdentifier, QString> _rg3DRRadioFirmware;
......
...@@ -472,7 +472,7 @@ VideoReceiver::start() ...@@ -472,7 +472,7 @@ VideoReceiver::start()
void void
VideoReceiver::stop() VideoReceiver::stop()
{ {
if(qgcApp()->runningUnitTests()) { if(qgcApp() && qgcApp()->runningUnitTests()) {
return; return;
} }
#if defined(QGC_GST_STREAMING) #if defined(QGC_GST_STREAMING)
......
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
#include "VideoReceiver.h" #include "VideoReceiver.h"
#include "QGCLoggingCategory.h" #include "QGCLoggingCategory.h"
#if !defined(__mobile__)
#include "QGCQmlWidgetHolder.h"
#endif
#include <QtQml> #include <QtQml>
#include <QQmlEngine> #include <QQmlEngine>
...@@ -324,3 +328,17 @@ QString QGCCorePlugin::stableVersionCheckFileUrl(void) const ...@@ -324,3 +328,17 @@ QString QGCCorePlugin::stableVersionCheckFileUrl(void) const
return QString("https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGC.version.txt"); return QString("https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGC.version.txt");
#endif #endif
} }
#if !defined(__mobile__)
QGCQmlWidgetHolder* QGCCorePlugin::createMainQmlWidgetHolder(QLayout *mainLayout, QWidget* parent)
{
QGCQmlWidgetHolder* pMainQmlWidgetHolder = new QGCQmlWidgetHolder(QString(), nullptr, parent);
mainLayout->addWidget(pMainQmlWidgetHolder);
pMainQmlWidgetHolder->setVisible(true);
QQmlEngine::setObjectOwnership(parent, QQmlEngine::CppOwnership);
pMainQmlWidgetHolder->setContextPropertyObject("controller", parent);
pMainQmlWidgetHolder->setContextPropertyObject("debugMessageModel", AppMessages::getModel());
pMainQmlWidgetHolder->setSource(QUrl::fromUserInput("qrc:qml/MainWindowHybrid.qml"));
return pMainQmlWidgetHolder;
}
#endif
...@@ -34,6 +34,12 @@ class QmlObjectListModel; ...@@ -34,6 +34,12 @@ class QmlObjectListModel;
class VideoReceiver; class VideoReceiver;
class PlanMasterController; class PlanMasterController;
#if !defined(__mobile__)
class QLayout;
class QMainWindow;
class QGCQmlWidgetHolder;
#endif
class QGCCorePlugin : public QGCTool class QGCCorePlugin : public QGCTool
{ {
Q_OBJECT Q_OBJECT
...@@ -102,6 +108,11 @@ public: ...@@ -102,6 +108,11 @@ public:
/// Allows the plugin to override the creation of the root (native) window. /// Allows the plugin to override the creation of the root (native) window.
virtual QQmlApplicationEngine* createRootWindow(QObject* parent); virtual QQmlApplicationEngine* createRootWindow(QObject* parent);
/// Allows the plugin to have a chance to initialize the creation of the root (non native) window.
#if !defined(__mobile__)
virtual QGCQmlWidgetHolder* createMainQmlWidgetHolder(QLayout* mainLayout, QWidget *parent);
#endif
/// Allows the plugin to override the creation of VideoReceiver. /// Allows the plugin to override the creation of VideoReceiver.
virtual VideoReceiver* createVideoReceiver(QObject* parent); virtual VideoReceiver* createVideoReceiver(QObject* parent);
......
...@@ -84,7 +84,7 @@ static const char *rgDockWidgetNames[] = { ...@@ -84,7 +84,7 @@ static const char *rgDockWidgetNames[] = {
static const char* _visibleWidgetsKey = "VisibleWidgets"; static const char* _visibleWidgetsKey = "VisibleWidgets";
#endif #endif
static MainWindow* _instance = NULL; ///< @brief MainWindow singleton static MainWindow* _instance = nullptr; ///< @brief MainWindow singleton
MainWindow* MainWindow::_create() MainWindow* MainWindow::_create()
{ {
...@@ -106,10 +106,10 @@ void MainWindow::deleteInstance(void) ...@@ -106,10 +106,10 @@ void MainWindow::deleteInstance(void)
/// by MainWindow::_create method. Hence no other code should have access to /// by MainWindow::_create method. Hence no other code should have access to
/// constructor. /// constructor.
MainWindow::MainWindow() MainWindow::MainWindow()
: _mavlinkDecoder (NULL) : _mavlinkDecoder (nullptr)
, _lowPowerMode (false) , _lowPowerMode (false)
, _showStatusBar (false) , _showStatusBar (false)
, _mainQmlWidgetHolder (NULL) , _mainQmlWidgetHolder (nullptr)
, _forceClose (false) , _forceClose (false)
{ {
_instance = this; _instance = this;
...@@ -138,21 +138,15 @@ MainWindow::MainWindow() ...@@ -138,21 +138,15 @@ MainWindow::MainWindow()
_centralLayout->setContentsMargins(0, 0, 0, 0); _centralLayout->setContentsMargins(0, 0, 0, 0);
centralWidget()->setLayout(_centralLayout); centralWidget()->setLayout(_centralLayout);
_mainQmlWidgetHolder = new QGCQmlWidgetHolder(QString(), NULL, this); //-- Allow plugin to initialize main QML Widget
_centralLayout->addWidget(_mainQmlWidgetHolder); _mainQmlWidgetHolder = qgcApp()->toolbox()->corePlugin()->createMainQmlWidgetHolder(_centralLayout, this);
_mainQmlWidgetHolder->setVisible(true);
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
_mainQmlWidgetHolder->setContextPropertyObject("controller", this);
_mainQmlWidgetHolder->setContextPropertyObject("debugMessageModel", AppMessages::getModel());
_mainQmlWidgetHolder->setSource(QUrl::fromUserInput("qrc:qml/MainWindowHybrid.qml"));
// Image provider // Image provider
QQuickImageProvider* pImgProvider = dynamic_cast<QQuickImageProvider*>(qgcApp()->toolbox()->imageProvider()); QQuickImageProvider* pImgProvider = dynamic_cast<QQuickImageProvider*>(qgcApp()->toolbox()->imageProvider());
_mainQmlWidgetHolder->getEngine()->addImageProvider(QStringLiteral("QGCImages"), pImgProvider); _mainQmlWidgetHolder->getEngine()->addImageProvider(QStringLiteral("QGCImages"), pImgProvider);
// Set dock options // Set dock options
setDockOptions(0); setDockOptions(nullptr);
// Setup corners // Setup corners
setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea); setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea);
...@@ -162,7 +156,7 @@ MainWindow::MainWindow() ...@@ -162,7 +156,7 @@ MainWindow::MainWindow()
#endif #endif
#ifdef UNITTEST_BUILD #ifdef UNITTEST_BUILD
QAction* qmlTestAction = new QAction("Test QML palette and controls", NULL); QAction* qmlTestAction = new QAction("Test QML palette and controls", nullptr);
connect(qmlTestAction, &QAction::triggered, this, &MainWindow::_showQmlTestWidget); connect(qmlTestAction, &QAction::triggered, this, &MainWindow::_showQmlTestWidget);
_ui.menuWidgets->addAction(qmlTestAction); _ui.menuWidgets->addAction(qmlTestAction);
#endif #endif
...@@ -246,14 +240,14 @@ MainWindow::~MainWindow() ...@@ -246,14 +240,14 @@ MainWindow::~MainWindow()
_mavlinkDecoder->finish(); _mavlinkDecoder->finish();
_mavlinkDecoder->wait(1000); _mavlinkDecoder->wait(1000);
_mavlinkDecoder->deleteLater(); _mavlinkDecoder->deleteLater();
_mavlinkDecoder = NULL; _mavlinkDecoder = nullptr;
} }
// This needs to happen before we get into the QWidget dtor // This needs to happen before we get into the QWidget dtor
// otherwise the QML engine reads freed data and tries to // otherwise the QML engine reads freed data and tries to
// destroy MainWindow a second time. // destroy MainWindow a second time.
delete _mainQmlWidgetHolder; delete _mainQmlWidgetHolder;
_instance = NULL; _instance = nullptr;
} }
QString MainWindow::_getWindowGeometryKey() QString MainWindow::_getWindowGeometryKey()
...@@ -315,7 +309,7 @@ void MainWindow::_showDockWidget(const QString& name, bool show) ...@@ -315,7 +309,7 @@ void MainWindow::_showDockWidget(const QString& name, bool show)
/// Creates the specified inner dock widget and adds to the QDockWidget /// Creates the specified inner dock widget and adds to the QDockWidget
bool MainWindow::_createInnerDockWidget(const QString& widgetName) bool MainWindow::_createInnerDockWidget(const QString& widgetName)
{ {
QGCDockWidget* widget = NULL; QGCDockWidget* widget = nullptr;
QAction *action = _mapName2Action[widgetName]; QAction *action = _mapName2Action[widgetName];
if(action) { if(action) {
switch(action->data().toInt()) { switch(action->data().toInt()) {
...@@ -339,7 +333,7 @@ bool MainWindow::_createInnerDockWidget(const QString& widgetName) ...@@ -339,7 +333,7 @@ bool MainWindow::_createInnerDockWidget(const QString& widgetName)
_mapName2DockWidget[widgetName] = widget; _mapName2DockWidget[widgetName] = widget;
} }
} }
return widget != NULL; return widget != nullptr;
} }
void MainWindow::_hideAllDockWidgets(void) void MainWindow::_hideAllDockWidgets(void)
......
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