From 0e364ebccc495fe1707a229791f32dac469ea596 Mon Sep 17 00:00:00 2001 From: Stefan Dunca Date: Thu, 7 Mar 2019 14:15:13 +0100 Subject: [PATCH] WIP: Enable mavlink dev console in expert mode for mobile devices TODO: Improve the experience --- qgroundcontrol.pro | 4 ++-- src/AnalyzeView/MavlinkConsolePage.qml | 13 ++++++++++++- src/QGCApplication.cc | 4 ++-- src/ui/MainWindowInner.qml | 2 +- src/ui/toolbar/MainToolBar.qml | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index e90724642..c0248732b 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -626,6 +626,7 @@ HEADERS += \ src/uas/UASInterface.h \ src/uas/UASMessageHandler.h \ src/UTM.h \ + src/AnalyzeView/MavlinkConsoleController.h \ AndroidBuild { @@ -661,7 +662,6 @@ HEADERS += \ !MobileBuild { HEADERS += \ src/AnalyzeView/GeoTagController.h \ - src/AnalyzeView/MavlinkConsoleController.h \ src/GPS/Drivers/src/gps_helper.h \ src/GPS/Drivers/src/rtcm.h \ src/GPS/Drivers/src/ashtech.h \ @@ -828,6 +828,7 @@ SOURCES += \ src/uas/UAS.cc \ src/uas/UASMessageHandler.cc \ src/UTM.cpp \ + src/AnalyzeView/MavlinkConsoleController.cc \ DebugBuild { SOURCES += \ @@ -850,7 +851,6 @@ contains(DEFINES, QGC_ENABLE_BLUETOOTH) { !MobileBuild { SOURCES += \ src/AnalyzeView/GeoTagController.cc \ - src/AnalyzeView/MavlinkConsoleController.cc \ src/GPS/Drivers/src/gps_helper.cpp \ src/GPS/Drivers/src/rtcm.cpp \ src/GPS/Drivers/src/ashtech.cpp \ diff --git a/src/AnalyzeView/MavlinkConsolePage.qml b/src/AnalyzeView/MavlinkConsolePage.qml index 3f313ee1c..32d5c9537 100644 --- a/src/AnalyzeView/MavlinkConsolePage.qml +++ b/src/AnalyzeView/MavlinkConsolePage.qml @@ -90,10 +90,13 @@ AnalyzePage { id: command Layout.fillWidth: true placeholderText: "Enter Commands here..." - onAccepted: { + + function sendCommand() { conController.sendCommand(text) text = "" } + onAccepted: sendCommand() + Keys.onPressed: { if (event.key == Qt.Key_Up) { text = conController.historyUp(text); @@ -105,6 +108,14 @@ AnalyzePage { } } + QGCButton { + id: sendButton + text: qsTr("Send") + visible: ScreenTools.isMobile + + onClicked: command.sendCommand() + } + QGCButton { id: followTail text: qsTr("Show Latest") diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 109b5ab0a..a160e7d74 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -90,6 +90,7 @@ #include "ShapeFileHelper.h" #include "QGCFileDownload.h" #include "FirmwareImage.h" +#include "MavlinkConsoleController.h" #ifndef NO_SERIAL_LINK #include "SerialLink.h" @@ -101,7 +102,6 @@ #include "FirmwareUpgradeController.h" #include "MainWindow.h" #include "GeoTagController.h" -#include "MavlinkConsoleController.h" #include "GPS/GPSManager.h" #endif @@ -458,8 +458,8 @@ void QGCApplication::_initCommon(void) qmlRegisterType (kQGCControllers, 1, 0, "FirmwareUpgradeController"); #endif qmlRegisterType (kQGCControllers, 1, 0, "GeoTagController"); - qmlRegisterType (kQGCControllers, 1, 0, "MavlinkConsoleController"); #endif + qmlRegisterType (kQGCControllers, 1, 0, "MavlinkConsoleController"); // Register Qml Singletons qmlRegisterSingletonType ("QGroundControl", 1, 0, "QGroundControl", qgroundcontrolQmlGlobalSingletonFactory); diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml index 2c9e5819c..4dca8f4fe 100644 --- a/src/ui/MainWindowInner.qml +++ b/src/ui/MainWindowInner.qml @@ -38,7 +38,7 @@ Item { readonly property string _settingsViewSource: "AppSettings.qml" readonly property string _setupViewSource: "SetupView.qml" readonly property string _planViewSource: "PlanView.qml" - readonly property string _analyzeViewSource: "AnalyzeView.qml" + readonly property string _analyzeViewSource: !ScreenTools.isMobile ? "AnalyzeView.qml" : "MavlinkConsolePage.qml" onHeightChanged: { //-- We only deal with the available height if within the Fly or Plan view diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index 442456999..db72fd92a 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -136,7 +136,7 @@ Rectangle { anchors.bottom: parent.bottom exclusiveGroup: mainActionGroup source: "/qmlimages/Analyze.svg" - visible: !ScreenTools.isMobile && QGroundControl.corePlugin.showAdvancedUI + visible: QGroundControl.corePlugin.showAdvancedUI onClicked: toolBar.showAnalyzeView() } -- 2.22.0