Commit 252b70de authored by Lorenz Meier's avatar Lorenz Meier

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

parents 9364558e 2eccba9f
......@@ -5,57 +5,6 @@ WindowsBuild {
INCLUDEPATH += libs/lib/msinttypes
}
#
# [OPTIONAL] QUpgrade support.
#
# Allow the user to override QUpgrade compilation through a DISABLE_QUPGRADE
# define like: `qmake DEFINES=DISABLE_QUPGRADE`
contains(DEFINES, DISABLE_QUPGRADE) {
message("Skipping support for QUpgrade (manual override from command line)")
DEFINES -= DISABLE_QUPGRADE
}
# Otherwise the user can still disable this feature in the user_config.pri file.
else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_QUPGRADE) {
message("Skipping support for QUpgrade (manual override from user_config.pri)")
}
# If the QUpgrade submodule has been initialized, build in support by default.
# We look for the existence of qupgrade.pro for the check. We can't look for a .git file
# because that breaks the TeamCity build process which does not use repositories.
else:exists(qupgrade/qupgrade.pro) {
message("Including support for QUpgrade")
DEFINES += QGC_QUPGRADE_ENABLED
INCLUDEPATH += qupgrade/src/apps/qupgrade
FORMS += \
qupgrade/src/apps/qupgrade/dialog_bare.ui \
qupgrade/src/apps/qupgrade/boardwidget.ui
HEADERS += \
qupgrade/src/apps/qupgrade/qgcfirmwareupgradeworker.h \
qupgrade/src/apps/qupgrade/uploader.h \
qupgrade/src/apps/qupgrade/dialog_bare.h \
qupgrade/src/apps/qupgrade/boardwidget.h
SOURCES += \
qupgrade/src/apps/qupgrade/qgcfirmwareupgradeworker.cpp \
qupgrade/src/apps/qupgrade/uploader.cpp \
qupgrade/src/apps/qupgrade/dialog_bare.cpp \
qupgrade/src/apps/qupgrade/boardwidget.cpp
RESOURCES += \
qupgrade/qupgrade.qrc
LinuxBuild:CONFIG += qesp_linux_udev
include(qupgrade/libs/qextserialport/src/qextserialport.pri)
}
# Otherwise notify the user and don't compile it.
else {
warning("Skipping support for QUpgrade (missing submodule, see README)")
}
#
# [REQUIRED] Add support for the MAVLink communications protocol.
# Some logic is involved here in selecting the proper dialect for
......
......@@ -39,12 +39,10 @@ WindowsBuild {
DESTDIR_COPY_RESOURCE_LIST = $$replace(DESTDIR,"/","\\")
BASEDIR_COPY_RESOURCE_LIST = $$replace(BASEDIR,"/","\\")
QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR \"$$BASEDIR_COPY_RESOURCE_LIST\\files\" \"$$DESTDIR_COPY_RESOURCE_LIST\\files\"
QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR \"$$BASEDIR_COPY_RESOURCE_LIST\\qml\" \"$$DESTDIR_COPY_RESOURCE_LIST\\qml\"
QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR \"$$BASEDIR_COPY_RESOURCE_LIST\\data\" \"$$DESTDIR_COPY_RESOURCE_LIST\\data\"
} else {
# Make sure to keep both side of this if using the same set of directories
QMAKE_POST_LINK += && $$QMAKE_COPY_DIR $$BASEDIR/files $$DESTDIR_COPY_RESOURCE_LIST
QMAKE_POST_LINK += && $$QMAKE_COPY_DIR $$BASEDIR/qml $$DESTDIR_COPY_RESOURCE_LIST
QMAKE_POST_LINK += && $$QMAKE_COPY_DIR $$BASEDIR/data $$DESTDIR_COPY_RESOURCE_LIST
}
......
......@@ -210,7 +210,8 @@ namespace core {
QString sec2 = ""; // after &zoom=...
GetSecGoogleWords(pos, sec1, sec2);
TryCorrectGoogleVersions();
return QString("https://%1%2.google.com/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleSatellite).arg(language).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2);
//this does not yield good results in practice return QString("https://%1%2.google.com/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleSatellite).arg(language).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2);
return QString("http://mt1.google.com/vt/lyrs=y&x=%1%2&y=%3&z=%4").arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom);
}
break;
case MapType::GoogleLabels:
......
......@@ -100,7 +100,7 @@ void TileMatrix::Clear()
void TileMatrix::ClearPointsNotIn(QList<Point>list)
{
removals.clear();
mutex.lock();
QMutexLocker lock(&mutex);
foreach(Point p, matrix.keys())
{
if(!list.contains(p))
......@@ -108,17 +108,14 @@ void TileMatrix::ClearPointsNotIn(QList<Point>list)
removals.append(p);
}
}
mutex.unlock();
foreach(Point p,removals)
{
Tile* t=TileAt(p);
Tile* t=matrix.value(p, 0);
if(t!=0)
{
mutex.lock();
delete t;
t=0;
matrix.remove(p);
mutex.unlock();
}
}
......
......@@ -45,6 +45,7 @@ linux {
macx-clang | macx-llvm {
message("Mac build")
CONFIG += MacBuild
QMAKE_MAC_SDK = macosx10.9
} else {
error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
}
......@@ -136,6 +137,7 @@ MacBuild {
LinuxBuild {
DEFINES += __STDC_LIMIT_MACROS
CONFIG += qesp_linux_udev
}
WindowsBuild {
......@@ -244,6 +246,7 @@ INCLUDEPATH += \
src/ui/mission \
src/ui/designer \
src/ui/configuration \
src/ui/px4_configuration \
src/ui/main
FORMS += \
......@@ -321,42 +324,16 @@ FORMS += \
src/ui/uas/QGCMessageView.ui \
src/ui/JoystickButton.ui \
src/ui/JoystickAxis.ui \
src/ui/configuration/ApmHardwareConfig.ui \
src/ui/configuration/ApmSoftwareConfig.ui \
src/ui/configuration/FrameTypeConfig.ui \
src/ui/configuration/CompassConfig.ui \
src/ui/configuration/AccelCalibrationConfig.ui \
src/ui/configuration/RadioCalibrationConfig.ui \
src/ui/configuration/FlightModeConfig.ui \
src/ui/configuration/Radio3DRConfig.ui \
src/ui/configuration/BatteryMonitorConfig.ui \
src/ui/configuration/SonarConfig.ui \
src/ui/configuration/AirspeedConfig.ui \
src/ui/configuration/OpticalFlowConfig.ui \
src/ui/configuration/OsdConfig.ui \
src/ui/configuration/AntennaTrackerConfig.ui \
src/ui/configuration/CameraGimbalConfig.ui \
src/ui/configuration/BasicPidConfig.ui \
src/ui/configuration/StandardParamConfig.ui \
src/ui/configuration/GeoFenceConfig.ui \
src/ui/configuration/FailSafeConfig.ui \
src/ui/configuration/AdvancedParamConfig.ui \
src/ui/configuration/ArduCopterPidConfig.ui \
src/ui/configuration/ApmPlaneLevel.ui \
src/ui/configuration/ParamWidget.ui \
src/ui/configuration/ArduPlanePidConfig.ui \
src/ui/configuration/AdvParameterList.ui \
src/ui/configuration/ArduRoverPidConfig.ui \
src/ui/QGCConfigView.ui \
src/ui/main/QGCViewModeSelection.ui \
src/ui/main/QGCWelcomeMainWindow.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/QGCPX4MulticopterConfig.ui \
src/ui/px4_configuration/QGCPX4SensorCalibration.ui \
src/ui/px4_configuration/PX4RCCalibration.ui \
src/ui/px4_configuration/PX4FirmwareUpgrade.ui \
src/ui/QGCUASFileView.ui
HEADERS += \
......@@ -407,7 +384,6 @@ HEADERS += \
src/ui/QGCSensorSettingsWidget.h \
src/ui/linechart/Linecharts.h \
src/uas/PxQuadMAV.h \
src/uas/ArduPilotMegaMAV.h \
src/uas/senseSoarMAV.h \
src/ui/watchdog/WatchdogControl.h \
src/ui/watchdog/WatchdogProcessView.h \
......@@ -499,34 +475,6 @@ HEADERS += \
src/ui/uas/QGCMessageView.h \
src/ui/JoystickButton.h \
src/ui/JoystickAxis.h \
src/ui/configuration/ApmHardwareConfig.h \
src/ui/configuration/ApmSoftwareConfig.h \
src/ui/configuration/FrameTypeConfig.h \
src/ui/configuration/CompassConfig.h \
src/ui/configuration/AccelCalibrationConfig.h \
src/ui/configuration/RadioCalibrationConfig.h \
src/ui/configuration/FlightModeConfig.h \
src/ui/configuration/Radio3DRConfig.h \
src/ui/configuration/BatteryMonitorConfig.h \
src/ui/configuration/SonarConfig.h \
src/ui/configuration/AirspeedConfig.h \
src/ui/configuration/OpticalFlowConfig.h \
src/ui/configuration/OsdConfig.h \
src/ui/configuration/AntennaTrackerConfig.h \
src/ui/configuration/CameraGimbalConfig.h \
src/ui/configuration/AP2ConfigWidget.h \
src/ui/configuration/BasicPidConfig.h \
src/ui/configuration/StandardParamConfig.h \
src/ui/configuration/GeoFenceConfig.h \
src/ui/configuration/FailSafeConfig.h \
src/ui/configuration/AdvancedParamConfig.h \
src/ui/configuration/ArduCopterPidConfig.h \
src/ui/apmtoolbar.h \
src/ui/configuration/ApmPlaneLevel.h \
src/ui/configuration/ParamWidget.h \
src/ui/configuration/ArduPlanePidConfig.h \
src/ui/configuration/AdvParameterList.h \
src/ui/configuration/ArduRoverPidConfig.h \
src/ui/QGCConfigView.h \
src/ui/main/QGCViewModeSelection.h \
src/ui/main/QGCWelcomeMainWindow.h \
......@@ -534,7 +482,6 @@ HEADERS += \
src/ui/configuration/SerialSettingsDialog.h \
src/ui/configuration/terminalconsole.h \
src/ui/configuration/ApmHighlighter.h \
src/ui/configuration/ApmFirmwareConfig.h \
src/uas/UASParameterDataModel.h \
src/uas/UASParameterCommsMgr.h \
src/ui/QGCPendingParamWidget.h \
......@@ -543,6 +490,9 @@ HEADERS += \
src/ui/px4_configuration/QGCPX4MulticopterConfig.h \
src/ui/px4_configuration/QGCPX4SensorCalibration.h \
src/ui/px4_configuration/PX4RCCalibration.h \
src/ui/px4_configuration/PX4Bootloader.h \
src/ui/px4_configuration/PX4FirmwareUpgradeThread.h \
src/ui/px4_configuration/PX4FirmwareUpgrade.h \
src/ui/menuactionhelper.h \
src/uas/UASManagerInterface.h \
src/uas/QGCUASParamManagerInterface.h \
......@@ -595,7 +545,6 @@ SOURCES += \
src/ui/QGCSensorSettingsWidget.cc \
src/ui/linechart/Linecharts.cc \
src/uas/PxQuadMAV.cc \
src/uas/ArduPilotMegaMAV.cc \
src/uas/senseSoarMAV.cpp \
src/ui/watchdog/WatchdogControl.cc \
src/ui/watchdog/WatchdogProcessView.cc \
......@@ -684,34 +633,6 @@ SOURCES += \
src/ui/JoystickButton.cc \
src/ui/JoystickAxis.cc \
src/ui/uas/QGCMessageView.cc \
src/ui/configuration/ApmHardwareConfig.cc \
src/ui/configuration/ApmSoftwareConfig.cc \
src/ui/configuration/FrameTypeConfig.cc \
src/ui/configuration/CompassConfig.cc \
src/ui/configuration/AccelCalibrationConfig.cc \
src/ui/configuration/RadioCalibrationConfig.cc \
src/ui/configuration/FlightModeConfig.cc \
src/ui/configuration/Radio3DRConfig.cc \
src/ui/configuration/BatteryMonitorConfig.cc \
src/ui/configuration/SonarConfig.cc \
src/ui/configuration/AirspeedConfig.cc \
src/ui/configuration/OpticalFlowConfig.cc \
src/ui/configuration/OsdConfig.cc \
src/ui/configuration/AntennaTrackerConfig.cc \
src/ui/configuration/CameraGimbalConfig.cc \
src/ui/configuration/AP2ConfigWidget.cc \
src/ui/configuration/BasicPidConfig.cc \
src/ui/configuration/StandardParamConfig.cc \
src/ui/configuration/GeoFenceConfig.cc \
src/ui/configuration/FailSafeConfig.cc \
src/ui/configuration/AdvancedParamConfig.cc \
src/ui/configuration/ArduCopterPidConfig.cc \
src/ui/apmtoolbar.cpp \
src/ui/configuration/ApmPlaneLevel.cc \
src/ui/configuration/ParamWidget.cc \
src/ui/configuration/ArduPlanePidConfig.cc \
src/ui/configuration/AdvParameterList.cc \
src/ui/configuration/ArduRoverPidConfig.cc \
src/ui/QGCConfigView.cc \
src/ui/main/QGCViewModeSelection.cc \
src/ui/main/QGCWelcomeMainWindow.cc \
......@@ -719,7 +640,6 @@ SOURCES += \
src/ui/configuration/console.cpp \
src/ui/configuration/SerialSettingsDialog.cc \
src/ui/configuration/ApmHighlighter.cc \
src/ui/configuration/ApmFirmwareConfig.cc \
src/uas/UASParameterDataModel.cc \
src/uas/UASParameterCommsMgr.cc \
src/ui/QGCPendingParamWidget.cc \
......@@ -728,6 +648,9 @@ SOURCES += \
src/ui/px4_configuration/QGCPX4MulticopterConfig.cc \
src/ui/px4_configuration/QGCPX4SensorCalibration.cc \
src/ui/px4_configuration/PX4RCCalibration.cc \
src/ui/px4_configuration/PX4Bootloader.cc \
src/ui/px4_configuration/PX4FirmwareUpgradeThread.cc \
src/ui/px4_configuration/PX4FirmwareUpgrade.cc \
src/ui/menuactionhelper.cpp \
src/uas/QGCUASFileManager.cc \
src/ui/QGCUASFileView.cc \
......@@ -758,7 +681,6 @@ HEADERS += \
src/qgcunittest/MockMavlinkInterface.h \
src/qgcunittest/MockMavlinkFileServer.h \
src/qgcunittest/MultiSignalSpy.h \
src/qgcunittest/FlightModeConfigTest.h \
src/qgcunittest/FlightGearTest.h \
src/qgcunittest/TCPLinkTest.h \
src/qgcunittest/TCPLoopBackServer.h \
......@@ -772,7 +694,6 @@ SOURCES += \
src/qgcunittest/MockQGCUASParamManager.cc \
src/qgcunittest/MockMavlinkFileServer.cc \
src/qgcunittest/MultiSignalSpy.cc \
src/qgcunittest/FlightModeConfigTest.cc \
src/qgcunittest/FlightGearTest.cc \
src/qgcunittest/TCPLinkTest.cc \
src/qgcunittest/TCPLoopBackServer.cc \
......
......@@ -199,6 +199,9 @@
<file>files/images/px4/calibration/3dr_gps/gps_24.png</file>
<file>files/images/px4/calibration/3dr_gps/gps_00.png</file>
<file>files/images/px4/menu/toggle_switch.png</file>
<file>files/images/px4/boards/px4flow_1.x.png</file>
<file>files/images/px4/boards/px4fmu_1.x.png</file>
<file>files/images/px4/boards/px4fmu_2.x.png</file>
</qresource>
<qresource prefix="/general">
<file alias="vera.ttf">files/styles/Vera.ttf</file>
......
import QtQuick 2.1
import "./components"
Rectangle {
id: toolbar
property alias backgroundColor : toolbar.color
property alias linkNameLabel: linkDevice.label
property alias baudrateLabel: baudrate.label
property bool connected: false
property bool armed: false
property string armedstr: "DISARMED"
width: toolbar.width
height: 72
color: "black"
border.color: "black"
onArmedChanged: {
if (armed) {
statusDisplay.statusText = "ARMED"
statusDisplay.statusTextColor = "red"
statusDisplay.statusBackgroundColor = "#FF880000"
}
else {
statusDisplay.statusText = "DISARMED"
statusDisplay.statusTextColor = "yellow"
statusDisplay.statusBackgroundColor = "black"
}
}
onConnectedChanged: {
if (connected){
console.log("APM Tool BAR QML: connected")
connectButton.image = "./resources/qgroundcontrol/toolbar/disconnect.png"
connectButton.label = "DISCONNECT"
} else {
console.log("APM Tool BAR QML: disconnected")
connectButton.image = "./resources/qgroundcontrol/toolbar/connect.png"
connectButton.label = "CONNECT"
}
}
// [BB] The code below should work, not sure why. replaced with code above
// Connections {
// target: globalObj
// onMAVConnected: {
// console.log("QML Change Connection " + connected)
// if (connected){
// console.log("connected")
// connectButton.image = "./resources/qgroundcontrol/toolbar/disconnect.png"
// } else {
// console.log("disconnected")
// connectButton.image = "./resources/qgroundcontrol/toolbar/connect.png"
// }
// }
// }
Row {
anchors.left: parent.left
spacing: 10
Rectangle { // Spacer
width: 5
height: parent.height
color: "black"
}
Button {
id: flightDataView
label: "FLIGHT DATA"
image: "./resources/qgroundcontrol/toolbar/flightdata.png"
onClicked: {
globalObj.triggerFlightView()
}
}
Button {
id: flightPlanView
label: "FLIGHT PLAN"
image: "./resources/qgroundcontrol/toolbar/flightplanner.png"
onClicked: globalObj.triggerFlightPlanView()
}
Button {
id: hardwareConfigView
label: "HARDWARE"
image: "./resources/qgroundcontrol/toolbar/hardwareconfig.png"
margins: 8
onClicked: globalObj.triggerHardwareView()
}
Button {
id: softwareConfigView
label: "SOFTWARE"
image: "./resources/qgroundcontrol/toolbar/softwareconfig.png"
margins: 8
onClicked: globalObj.triggerSoftwareView()
}
Button {
id: simulationView
label: "SIMULATION"
image: "./resources/qgroundcontrol/toolbar/simulation.png"
onClicked: globalObj.triggerSimulationView()
}
Button {
id: terminalView
label: "TERMINAL"
image: "./resources/qgroundcontrol/toolbar/terminal.png"
onClicked: globalObj.triggerTerminalView()
}
Rectangle { // Spacer
width: 5
height: parent.height
color: "black"
}
StatusDisplay {
id: statusDisplay
width: 110
statusText: "DISARMED"
statusTextColor: "yellow"
statusBackgroundColor: "black"
}
Rectangle { // Spacer
width: 5
height: parent.height
color: "black"
}
// [BB] Commented out ToolBar Status info work.
// WIP: To be fixed later
// DigitalDisplay { // Information Pane
// title:"Mode"
// textValue: "Stabilize"
// color: "black"
// }
// DigitalDisplay { // Information Pane
// title: "Speed"
// textValue: "11.0m/s"
// color: "black"
// }
// DigitalDisplay { // Information Pane
// title: "Alt"
// textValue: "20.0m"
// color: "black"
// }
// DigitalDisplay { // Information Pane
// title: "Volts"
// textValue: "14.8V"
// color: "black"
// }
// DigitalDisplay { // Information Pane
// title: "Current"
// textValue: "12.0A"
// color: "black"
// }
// DigitalDisplay { // Information Pane
// title: "Level"
// textValue: "77%"
// color: "black"
// }
}
Row {
anchors.right: parent.right
spacing: 2
TextButton {
id: linkDevice
label: "none"
minWidth: 100
onClicked: globalObj.showConnectionDialog()
}
TextButton {
id: baudrate
label: "none"
minWidth: 100
onClicked: globalObj.showConnectionDialog()
}
Rectangle {
width: 5
height: parent.height
color: "black"
}
Button {
id: connectButton
label: "CONNECT"
image: "./resources/qgroundcontrol/toolbar/connect.png"
onClicked: globalObj.connectMAV()
}
Rectangle { // Spacer
width: 5
height: parent.height
color: "black"
}
}
}
import QtQuick 2.1
Rectangle {
signal clicked
property string label: "button label"
property alias image: buttonImage.source
property int margins: 2
id: button
width: 72
height: 72
radius: 3
smooth: true
border.width: 2
Text {
id: buttonLabel
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: 5
text: label
color: "white"
font.pointSize: 10
}
Image {
id: buttonImage
anchors.horizontalCenter: button.horizontalCenter
anchors.top: buttonLabel.bottom
anchors.margins: margins
source: image
fillMode: Image.PreserveAspectFit
width: image.width
height: image.height
}
signal buttonClick()
onButtonClick: {
console.log(buttonLabel.text + " clicked calling signal")
clicked()
}
// Highlighting and ativation section
property color buttonColor: "black"
property color onHoverbuttonColor: "lightblue"
property color onHoverColor: "darkblue"
property color borderColor: "black"
MouseArea {
id: buttonMouseArea
anchors.fill: parent
onClicked: buttonClick()
hoverEnabled: true
onEntered: {
parent.border.color = onHoverColor
parent.color = onHoverbuttonColor
}
onExited: {
parent.border.color = borderColor
parent.color = buttonColor
}
onPressed: parent.color = Qt.darker(onHoverbuttonColor, 1.5)
onReleased: parent.color = buttonColor
}
color: buttonColor
border.color: borderColor
}
import QtQuick 2.1
Rectangle {
property alias title: displayTitle.text
property string textValue: "none"
width: 110
height: parent.height/3
anchors.verticalCenter: parent.verticalCenter
border.color: "white"
Text {
id:displayTitle
anchors.left: parent.left
anchors.leftMargin: 3
anchors.verticalCenter: parent.verticalCenter
text: "blank"
color: "white"
}
Text {
id:displayValue
anchors.right: parent.right
anchors.rightMargin: 3
anchors.verticalCenter: parent.verticalCenter
text: textValue
color: "white"
}
}
import QtQuick 2.1
Rectangle {
id: statusDisplay
property alias statusText: armedText.text
property alias statusTextColor: armedText.color
property alias statusBackgroundColor: statusDisplay.color
width: 100
height: parent.height/3
anchors.verticalCenter: parent.verticalCenter
radius: 3
border.color: "white"
border.width: 1
Text {
id: armedText
anchors.centerIn: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 20
}
}
import QtQuick 2.1
Rectangle {
signal clicked
property string label: "Text Button label"
property int minWidth: 75
property int minHeight: 0
property int margin: 5
width: textBox.width
height: 72
anchors.verticalCenter: parent.verticalCenter
color: "black"
signal buttonClick()
onButtonClick: {
console.log(label + " clicked calling signal")
clicked()
}
// Highlighting and ativation section
property color buttonColor: "black"
property color onHoverbuttonColor: "lightblue"
property color onHoverColor: "darkblue"
property color borderColor: "white"
Rectangle {
width: textButtonLabel.paintedwidth
anchors.centerIn: parent
Rectangle{
id: textBox
anchors.centerIn: parent
width: minWidth > textButtonLabel.paintedWidth + margin ? minWidth : textButtonLabel.paintedWidth + margin
height: minHeight > textButtonLabel.paintedHeight + margin ? minHeight : textButtonLabel.paintedHeight + margin
Text {
id: textButtonLabel
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: 2
text: label
color: "white"
font.pointSize: 11
}
MouseArea {
id: textButtonMouseArea
anchors.fill: parent
onClicked: buttonClick()
hoverEnabled: true
onEntered: {
parent.border.color = onHoverColor
parent.color = onHoverbuttonColor
}
onExited: {
parent.border.color = borderColor
parent.color = buttonColor
}
onPressed: parent.color = Qt.darker(onHoverbuttonColor, 1.5)
onReleased: parent.color = buttonColor
}
color: buttonColor
border.color: borderColor
border.width: 1
}
}
}
......@@ -25,7 +25,6 @@
#include "UASInterface.h"
#include "UAS.h"
#include "PxQuadMAV.h"
#include "ArduPilotMegaMAV.h"
#include "configuration.h"
#include "LinkManager.h"
#include "QGCMAVLink.h"
......
......@@ -585,28 +585,6 @@ void MAVLinkSimulationLink::mainloop()
memcpy(stream+streampointer, buffer, bufferlength);
streampointer += bufferlength;
// // HEARTBEAT VEHICLE 2
// // Pack message and get size of encoded byte string
// mavlink_msg_heartbeat_pack(54, componentId, &msg, MAV_HELICOPTER, MAV_AUTOPILOT_ARDUPILOTMEGA);
// // Allocate buffer with packet data
// bufferlength = mavlink_msg_to_send_buffer(buffer, &msg);
// //add data into datastream
// memcpy(stream+streampointer,buffer, bufferlength);
// streampointer += bufferlength;
// // HEARTBEAT VEHICLE 3
// // Pack message and get size of encoded byte string
// mavlink_msg_heartbeat_pack(60, componentId, &msg, MAV_FIXED_WING, MAV_AUTOPILOT_PIXHAWK);
// // Allocate buffer with packet data
// bufferlength = mavlink_msg_to_send_buffer(buffer, &msg);
// //add data into datastream
// memcpy(stream+streampointer,buffer, bufferlength);
// streampointer += bufferlength;
// Pack message and get size of encoded byte string
mavlink_msg_sys_status_encode(54, componentId, &msg, &status);
// Allocate buffer with packet data
......
......@@ -72,7 +72,7 @@ void MAVLinkSimulationMAV::mainloop()
// 1 Hz execution
if (timer1Hz <= 0) {
mavlink_message_t msg;
mavlink_msg_heartbeat_pack(systemid, MAV_COMP_ID_IMU, &msg, MAV_TYPE_FIXED_WING, MAV_AUTOPILOT_ARDUPILOTMEGA, MAV_MODE_GUIDED_ARMED, 0, MAV_STATE_ACTIVE);
mavlink_msg_heartbeat_pack(systemid, MAV_COMP_ID_IMU, &msg, MAV_TYPE_FIXED_WING, MAV_AUTOPILOT_PIXHAWK, MAV_MODE_GUIDED_ARMED, 0, MAV_STATE_ACTIVE);
link->sendMAVLinkMessage(&msg);
planner.handleMessage(msg);
......
......@@ -117,14 +117,16 @@ bool SerialLink::isBootloader()
foreach (const QSerialPortInfo &info, portList)
{
// XXX debug statements will be removed once we have 100% stable link reports
// qDebug() << "PortName : " << info.portName()
// << "Description : " << info.description();
// qDebug() << "Manufacturer: " << info.manufacturer();
if (info.portName().trimmed() == this->m_portName.trimmed() &&
(info.description().toLower().contains("bootloader") ||
info.description().toLower().contains("px4 bl"))) {
qDebug() << "BOOTLOADER FOUND";
info.description().toLower().contains("px4 bl") ||
info.description().toLower().contains("px4 fmu v1.6"))) {
// qDebug() << "BOOTLOADER FOUND";
return true;
}
}
......@@ -232,10 +234,10 @@ void SerialLink::run()
}
// If there are too many errors on this link, disconnect.
if (isConnected() && (linkErrorCount > 100)) {
if (isConnected() && (linkErrorCount > 150)) {
qDebug() << "linkErrorCount too high: re-connecting!";
linkErrorCount = 0;
emit communicationUpdate(getName(), tr("Reconnecting on too many link errors"));
emit communicationUpdate(getName(), tr("Link timeout, not receiving any data, attempting reconnect"));
if (m_port) {
m_port->close();
......@@ -266,10 +268,11 @@ void SerialLink::run()
if (m_transmitBuffer.count() > 0) {
m_writeMutex.lock();
int numWritten = m_port->write(m_transmitBuffer);
bool txSuccess = m_port->waitForBytesWritten(5);
bool txSuccess = m_port->flush();
txSuccess |= m_port->waitForBytesWritten(10);
if (!txSuccess || (numWritten != m_transmitBuffer.count())) {
linkErrorCount++;
qDebug() << "TX Error! wrote" << numWritten << ", asked for " << m_transmitBuffer.count() << "bytes";
qDebug() << "TX Error! written:" << txSuccess << "wrote" << numWritten << ", asked for " << m_transmitBuffer.count() << "bytes";
}
else {
......@@ -290,7 +293,7 @@ void SerialLink::run()
//wait n msecs for data to be ready
//[TODO][BB] lower to SerialLink::poll_interval?
m_dataMutex.lock();
bool success = m_port->waitForReadyRead(10);
bool success = m_port->waitForReadyRead(20);
if (success) {
QByteArray readData = m_port->readAll();
......@@ -416,6 +419,8 @@ bool SerialLink::disconnect()
}
wait(); // This will terminate the thread and close the serial port
emit connected(false);
emit disconnected();
return true;
}
......
This diff is collapsed.
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef FLIGHTMODECONFIGTEST_H
#define FLIGHTMODECONFIGTEST_H
#include "AutoTest.h"
#include "MockUASManager.h"
#include "MockUAS.h"
#include <QLabel>
#include <QComboBox>
#include <QCheckBox>
#include <QLabel>
#include <QPushButton>
class FlightModeConfig;
/// @file
/// @brief FlightModeConfig unit test
///
/// @author Don Gagne <don@thegagnes.com>
class FlightModeConfigUnitTest : public QObject
{
Q_OBJECT
public:
FlightModeConfigUnitTest(void);
private slots:
void init(void);
void cleanup(void);
void _nullUAS_test(void);
void _validUAS_test(void);
void _nullToValidUAS_test(void);
void _simpleModeFixedWing_test(void);
void _simpleModeRover_test(void);
void _simpleModeRotor_test(void);
void _modeSwitchParam_test(void);
void _pwmFixedWing_test(void);
void _pwmRotor_test(void);
void _pwmRover_test(void);
void _pwmInvalidChannel_test(void);
void _unknownSystemType_test(void);
void _unknownMode_test(void);
private:
void _findControls(QObject* fmc);
void _pwmTestWorker(int systemType, int modeSwitchChannel, const char* modeSwitchParam);
private:
MockUASManager* _mockUASManager;
MockUAS* _mockUAS;
// FlightModeConfig ui elements
static const size_t _cCombo = 6;
QLabel* _rgLabel[_cCombo];
QComboBox* _rgCombo[_cCombo];
QCheckBox* _rgSimpleModeCheckBox[_cCombo];
QLabel* _rgPWMLabel[_cCombo];
QPushButton* _saveButton;
};
DECLARE_TEST(FlightModeConfigUnitTest)
#endif
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of class MainWindow
* @author Your Name here
*/
#include "ArduPilotMegaMAV.h"
#ifdef QGC_USE_ARDUPILOTMEGA_MESSAGES
#ifndef MAVLINK_MSG_ID_MOUNT_CONFIGURE
#include "ardupilotmega/mavlink_msg_mount_configure.h"
#endif
#ifndef MAVLINK_MSG_ID_MOUNT_CONTROL
#include "ardupilotmega/mavlink_msg_mount_control.h"
#endif
#endif
ArduPilotMegaMAV::ArduPilotMegaMAV(MAVLinkProtocol* mavlink, QThread* thread, int id) :
UAS(mavlink, thread, id)//,
// place other initializers here
{
//This does not seem to work. Manually request each stream type at a specified rate.
// Ask for all streams at 4 Hz
//enableAllDataTransmission(4);
txReqTimer = new QTimer(this);
connect(txReqTimer,SIGNAL(timeout()),this,SLOT(sendTxRequests()));
QTimer::singleShot(5000,this,SLOT(sendTxRequests())); //Send an initial TX request in 5 seconds.
txReqTimer->start(300000); //Resend the TX requests every 5 minutes.
}
void ArduPilotMegaMAV::sendTxRequests()
{
enableExtendedSystemStatusTransmission(2);
QGC::SLEEP::msleep(250);
enablePositionTransmission(3);
QGC::SLEEP::msleep(250);
enableExtra1Transmission(10);
QGC::SLEEP::msleep(250);
enableExtra2Transmission(10);
QGC::SLEEP::msleep(250);
enableExtra3Transmission(2);
QGC::SLEEP::msleep(250);
enableRawSensorDataTransmission(2);
QGC::SLEEP::msleep(250);
enableRCChannelDataTransmission(2);
}
/**
* This function is called by MAVLink once a complete, uncorrupted (CRC check valid)
* mavlink packet is received.
*
* @param link Hardware link the message came from (e.g. /dev/ttyUSB0 or UDP port).
* messages can be sent back to the system via this link
* @param message MAVLink message, as received from the MAVLink protocol stack
*/
void ArduPilotMegaMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
// Let UAS handle the default message set
UAS::receiveMessage(link, message);
if (message.sysid == uasId) {
// Handle your special messages
switch (message.msgid) {
case MAVLINK_MSG_ID_HEARTBEAT:
{
//qDebug() << "ARDUPILOT RECEIVED HEARTBEAT";
break;
}
default:
//qDebug() << "\nARDUPILOT RECEIVED MESSAGE WITH ID" << message.msgid;
break;
}
}
}
void ArduPilotMegaMAV::setMountConfigure(unsigned char mode, bool stabilize_roll,bool stabilize_pitch,bool stabilize_yaw)
{
#ifdef QGC_USE_ARDUPILOTMEGA_MESSAGES
//Only supported by APM
mavlink_message_t msg;
mavlink_msg_mount_configure_pack(255,1,&msg,this->uasId,1,mode,stabilize_roll,stabilize_pitch,stabilize_yaw);
sendMessage(msg);
#else
Q_UNUSED(mode);
Q_UNUSED(stabilize_roll);
Q_UNUSED(stabilize_pitch);
Q_UNUSED(stabilize_yaw);
#endif
}
void ArduPilotMegaMAV::setMountControl(double pa,double pb,double pc,bool islatlong)
{
#ifdef QGC_USE_ARDUPILOTMEGA_MESSAGES
mavlink_message_t msg;
if (islatlong)
{
mavlink_msg_mount_control_pack(255,1,&msg,this->uasId,1,pa*10000000.0,pb*10000000.0,pc*10000000.0,0);
}
else
{
mavlink_msg_mount_control_pack(255,1,&msg,this->uasId,1,pa,pb,pc,0);
}
sendMessage(msg);
#else
Q_UNUSED(pa);
Q_UNUSED(pb);
Q_UNUSED(pc);
Q_UNUSED(islatlong);
#endif
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef ARDUPILOTMEGAMAV_H
#define ARDUPILOTMEGAMAV_H
#include "UAS.h"
class ArduPilotMegaMAV : public UAS
{
Q_OBJECT
public:
ArduPilotMegaMAV(MAVLinkProtocol* mavlink, QThread* thread, int id = 0);
/** @brief Set camera mount stabilization modes */
void setMountConfigure(unsigned char mode, bool stabilize_roll,bool stabilize_pitch,bool stabilize_yaw);
/** @brief Set camera mount control */
void setMountControl(double pa,double pb,double pc,bool islatlong);
public slots:
/** @brief Receive a MAVLink message from this MAV */
void receiveMessage(LinkInterface* link, mavlink_message_t message);
void sendTxRequests();
private:
QTimer *txReqTimer;
};
#endif // ARDUPILOTMAV_H
......@@ -67,21 +67,6 @@ UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInte
uas = px4;
}
break;
// XXX the APM support needs polishing before it can be shown to users
// case MAV_AUTOPILOT_ARDUPILOTMEGA:
// {
// ArduPilotMegaMAV* mav = new ArduPilotMegaMAV(mavlink, worker, sysid);
// // Set the system type
// mav->setSystemType((int)heartbeat->type);
// // Connect this robot to the UAS object
// // it is IMPORTANT here to use the right object type,
// // else the slot of the parent object is called (and thus the special
// // packets never reach their goal)
// connect(mavlink, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), mav, SLOT(receiveMessage(LinkInterface*, mavlink_message_t)));
// uas = mav;
// }
// break;
#ifdef QGC_USE_SENSESOAR_MESSAGES
case MAV_AUTOPILOT_SENSESOAR:
{
......
......@@ -12,7 +12,6 @@
#include "UAS.h"
#include "PxQuadMAV.h"
#include "senseSoarMAV.h"
#include "ArduPilotMegaMAV.h"
class QGCMAVLinkUASFactory : public QObject
{
......
......@@ -497,27 +497,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
// Set new type if it has changed
if (this->type != state.type)
{
this->type = state.type;
if (airframe == 0)
{
switch (type)
{
case MAV_TYPE_FIXED_WING:
setAirframe(UASInterface::QGC_AIRFRAME_EASYSTAR);
break;
case MAV_TYPE_QUADROTOR:
setAirframe(UASInterface::QGC_AIRFRAME_CHEETAH);
break;
case MAV_TYPE_HEXAROTOR:
setAirframe(UASInterface::QGC_AIRFRAME_HEXCOPTER);
break;
default:
// Do nothing
break;
}
}
this->autopilot = state.autopilot;
emit systemTypeSet(this, type);
setSystemType(state.type);
}
bool currentlyArmed = state.base_mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY;
......@@ -1316,7 +1297,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (text.startsWith("#") || severity <= MAV_SEVERITY_WARNING)
{
text.remove("#audio:");
emit textMessageReceived(uasId, message.compid, severity, QString("Audio message: ") + text);
emit textMessageReceived(uasId, message.compid, severity, text);
GAudioOutput::instance()->say(text.toLower(), severity);
}
else
......@@ -2593,17 +2574,25 @@ void UAS::setSystemType(int systemType)
// If the airframe is still generic, change it to a close default type
if (airframe == 0)
{
switch (systemType)
switch (type)
{
case MAV_TYPE_FIXED_WING:
airframe = QGC_AIRFRAME_EASYSTAR;
setAirframe(UASInterface::QGC_AIRFRAME_EASYSTAR);
break;
case MAV_TYPE_QUADROTOR:
airframe = QGC_AIRFRAME_MIKROKOPTER;
setAirframe(UASInterface::QGC_AIRFRAME_CHEETAH);
break;
case MAV_TYPE_HEXAROTOR:
setAirframe(UASInterface::QGC_AIRFRAME_HEXCOPTER);
break;
default:
// Do nothing
break;
}
}
emit systemSpecsChanged(uasId);
emit systemTypeSet(this, type);
qDebug() << "TYPE CHANGED TO:" << type;
}
}
......
......@@ -43,6 +43,7 @@ MAVLinkDecoder::MAVLinkDecoder(MAVLinkProtocol* protocol, QObject *parent) :
messageFilter.insert(MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, false);
#endif
messageFilter.insert(MAVLINK_MSG_ID_EXTENDED_MESSAGE, false);
messageFilter.insert(MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, false);
textMessageFilter.insert(MAVLINK_MSG_ID_DEBUG, false);
textMessageFilter.insert(MAVLINK_MSG_ID_DEBUG_VECT, false);
......
......@@ -64,9 +64,6 @@ This file is part of the QGROUNDCONTROL project
#include "QGCTabbedInfoView.h"
#include "UASRawStatusView.h"
#include "PrimaryFlightDisplay.h"
#include <apmtoolbar.h>
#include <ApmHardwareConfig.h>
#include <ApmSoftwareConfig.h>
#include <QGCConfigView.h>
#include "SerialSettingsDialog.h"
#include "terminalconsole.h"
......@@ -205,31 +202,27 @@ void MainWindow::init()
// Load Toolbar
if (!(getCustomMode() == CUSTOM_MODE_APM)) {
toolBar = new QGCToolBar(this);
this->addToolBar(toolBar);
// Add actions for average users (displayed next to each other)
QList<QAction*> actions;
actions << ui.actionMissionView;
actions << ui.actionFlightView;
actions << ui.actionHardwareConfig;
toolBar->setPerspectiveChangeActions(actions);
// Add actions for advanced users (displayed in dropdown under "advanced")
QList<QAction*> advancedActions;
advancedActions << ui.actionEngineersView;
advancedActions << ui.actionGoogleEarthView;
advancedActions << ui.actionLocal3DView;
advancedActions << ui.actionSoftwareConfig;
advancedActions << ui.actionTerminalView;
advancedActions << ui.actionSimulationView;
toolBar->setPerspectiveChangeAdvancedActions(advancedActions);
} else {
ui.actionHardwareConfig->setText(tr("Hardware"));
}
toolBar = new QGCToolBar(this);
this->addToolBar(toolBar);
// Add actions for average users (displayed next to each other)
QList<QAction*> actions;
actions << ui.actionMissionView;
actions << ui.actionFlightView;
actions << ui.actionHardwareConfig;
toolBar->setPerspectiveChangeActions(actions);
// Add actions for advanced users (displayed in dropdown under "advanced")
QList<QAction*> advancedActions;
advancedActions << ui.actionEngineersView;
advancedActions << ui.actionGoogleEarthView;
advancedActions << ui.actionLocal3DView;
advancedActions << ui.actionSoftwareConfig;
advancedActions << ui.actionTerminalView;
advancedActions << ui.actionSimulationView;
toolBar->setPerspectiveChangeAdvancedActions(advancedActions);
customStatusBar = new QGCStatusBar(this);
setStatusBar(customStatusBar);
......@@ -255,28 +248,6 @@ void MainWindow::init()
connect(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)), this, SLOT(addLink(LinkInterface*)));
if (getCustomMode() == CUSTOM_MODE_APM) {
// Add the APM 'toolbar'
APMToolBar *apmToolBar = new APMToolBar();
apmToolBar->setFlightViewAction(ui.actionFlightView);
apmToolBar->setFlightPlanViewAction(ui.actionMissionView);
apmToolBar->setHardwareViewAction(ui.actionHardwareConfig);
apmToolBar->setSoftwareViewAction(ui.actionSoftwareConfig);
apmToolBar->setSimulationViewAction(ui.actionSimulationView);
apmToolBar->setTerminalViewAction(ui.actionTerminalView);
QDockWidget *widget = new QDockWidget(tr("APM Tool Bar"),this);
QWidget *toolbarWidget = QWidget::createWindowContainer(apmToolBar, this);
widget->setWidget(toolbarWidget);
widget->setMinimumHeight(72);
widget->setMaximumHeight(72);
widget->setMinimumWidth(1024);
widget->setFeatures(QDockWidget::NoDockWidgetFeatures);
widget->setTitleBarWidget(new QWidget(this)); // Disables the title bar
this->addDockWidget(Qt::TopDockWidgetArea, widget);
}
// Connect user interface devices
emit initStatusChanged(tr("Initializing joystick interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
joystick = new JoystickInput();
......@@ -559,31 +530,12 @@ void MainWindow::buildCommonWidgets()
addToCentralStackedWidget(terminalView, VIEW_TERMINAL, tr("Terminal View"));
}
if (getCustomMode() == CUSTOM_MODE_APM) {
if (!configView)
{
configView = new SubMainWindow(this);
configView->setObjectName("VIEW_HARDWARE_CONFIG");
configView->setCentralWidget(new ApmHardwareConfig(this));
addToCentralStackedWidget(configView, VIEW_HARDWARE_CONFIG, "Hardware");
}
if (!softwareConfigView)
{
softwareConfigView = new SubMainWindow(this);
softwareConfigView->setObjectName("VIEW_SOFTWARE_CONFIG");
softwareConfigView->setCentralWidget(new ApmSoftwareConfig(this));
addToCentralStackedWidget(softwareConfigView, VIEW_SOFTWARE_CONFIG, "Software");
}
} else {
if (!configView)
{
configView = new SubMainWindow(this);
configView->setObjectName("VIEW_HARDWARE_CONFIG");
configView->setCentralWidget(new QGCConfigView(this));
addToCentralStackedWidget(configView, VIEW_HARDWARE_CONFIG, "Config");
}
if (!configView)
{
configView = new SubMainWindow(this);
configView->setObjectName("VIEW_HARDWARE_CONFIG");
configView->setCentralWidget(new QGCConfigView(this));
addToCentralStackedWidget(configView, VIEW_HARDWARE_CONFIG, "Config");
}
if (!engineeringView)
......@@ -1209,14 +1161,12 @@ void MainWindow::connectCommonActions()
perspectives->addAction(ui.actionSimulationView);
perspectives->addAction(ui.actionMissionView);
perspectives->addAction(ui.actionHardwareConfig);
perspectives->addAction(ui.actionSoftwareConfig);
perspectives->addAction(ui.actionTerminalView);
perspectives->addAction(ui.actionGoogleEarthView);
perspectives->addAction(ui.actionLocal3DView);
perspectives->setExclusive(true);
/* Hide the actions that are not relevant */
ui.actionSoftwareConfig->setVisible(getCustomMode() == CUSTOM_MODE_APM);
#ifndef QGC_GOOGLE_EARTH_ENABLED
ui.actionGoogleEarthView->setVisible(false);
#endif
......@@ -1617,7 +1567,7 @@ void MainWindow::UASCreated(UASInterface* uas)
watchdogControlDockWidget->setObjectName("WATCHDOG_CONTROL_DOCKWIDGET");
}
}
// Reload view state in case new widgets were added
loadViewState();
}
......
......@@ -98,7 +98,6 @@ public:
CUSTOM_MODE_UNCHANGED = 0,
CUSTOM_MODE_NONE,
CUSTOM_MODE_PX4,
CUSTOM_MODE_APM,
CUSTOM_MODE_WIFI
};
......
......@@ -51,7 +51,7 @@
<x>0</x>
<y>0</y>
<width>1024</width>
<height>21</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuMGround">
......@@ -100,7 +100,6 @@
<addaction name="actionEngineersView"/>
<addaction name="actionGoogleEarthView"/>
<addaction name="actionLocal3DView"/>
<addaction name="actionSoftwareConfig"/>
<addaction name="actionTerminalView"/>
<addaction name="actionSimulationView"/>
<addaction name="actionFirmwareUpdateView"/>
......
......@@ -453,7 +453,7 @@ void PrimaryFlightDisplay::drawTextCenterBottom (
font.setPixelSize(pixelSize);
painter.setFont(font);
QFontMetrics metrics = QFontMetrics(font);
QFontMetrics metrics(font);
QRect bounds = metrics.boundingRect(text);
int flags = Qt::AlignCenter;
painter.drawText(x - bounds.width()/2, y, bounds.width(), bounds.height(), flags, text);
......
......@@ -25,9 +25,7 @@
#include "px4_configuration/QGCPX4SensorCalibration.h"
#include "px4_configuration/PX4RCCalibration.h"
#ifdef QGC_QUPGRADE_ENABLED
#include <dialog_bare.h>
#endif
#include "PX4FirmwareUpgrade.h"
#define WIDGET_INDEX_FIRMWARE 0
#define WIDGET_INDEX_RC 1
......@@ -67,18 +65,8 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
px4RCCalibration = new PX4RCCalibration(this);
ui->rcLayout->addWidget(px4RCCalibration);
#ifdef QGC_QUPGRADE_ENABLED
DialogBare *firmwareDialog = new DialogBare(this);
ui->firmwareLayout->addWidget(firmwareDialog);
connect(firmwareDialog, SIGNAL(connectLinks()), LinkManager::instance(), SLOT(connectAll()));
connect(firmwareDialog, SIGNAL(disconnectLinks()), LinkManager::instance(), SLOT(disconnectAll()));
#else
QLabel* label = new QLabel(this);
label->setText("THIS VERSION OF QGROUNDCONTROL WAS BUILT WITHOUT QUPGRADE. To enable firmware upload support, checkout QUpgrade WITHIN the QGroundControl folder");
ui->firmwareLayout->addWidget(label);
#endif
PX4FirmwareUpgrade* firmwareUpgrade = new PX4FirmwareUpgrade(this);
ui->firmwareLayout->addWidget(firmwareUpgrade);
connect(ui->rcMenuButton,SIGNAL(clicked()),
this,SLOT(rcMenuButtonClicked()));
......@@ -278,10 +266,6 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
qDebug() << "CALIBRATION!! System Type Name:" << mav->getSystemTypeName();
//Load configuration after 1ms. This allows it to go into the event loop, and prevents application hangups due to the
//amount of time it actually takes to load the configuration windows.
QTimer::singleShot(1,this,SLOT(loadConfig()));
updateStatus(QString("Reading from system %1").arg(mav->getUASName()));
// Since a system is now connected, enable the VehicleConfig UI.
......
......@@ -781,11 +781,17 @@ void QGCToolBar::connectLink(bool connect)
link->setPortName(portComboBox->itemData(portComboBox->currentIndex()).toString().trimmed());
int baud = baudcomboBox->currentText().toInt();
link->setBaudRate(baud);
QObject::connect(link, SIGNAL(connected(bool)), this, SLOT(updateLinkState(bool)));
link->connect();
}
} else if (!connect && currentLink) {
currentLink->disconnect();
QObject::disconnect(currentLink, SIGNAL(connected(bool)), this, SLOT(updateLinkState(bool)));
}
if (currentLink) {
updateLinkState(currentLink->isConnected());
}
}
......
#include <QDebug>
#include <QQmlContext>
#include <QGraphicsObject>
#include <QQuickItem>
#include "LinkManager.h"
#include "MainWindow.h"
#include "apmtoolbar.h"
APMToolBar::APMToolBar():
QQuickView(), m_uas(0)
{
// Configure our QML object
// Hack to fix QTBUG 34300 on OSX where QDir::currentPath has changed behavior. This causes
// relative paths to inside the .app package to fail.
#ifdef Q_OS_MAC
QString qmlFile = QApplication::applicationDirPath();
qmlFile.append("/qml/ApmToolBar.qml");
setSource(QUrl::fromLocalFile(qmlFile));
#else
setSource(QUrl::fromLocalFile("qml/ApmToolBar.qml"));
#endif
setResizeMode(QQuickView::SizeRootObjectToView);
rootContext()->setContextProperty("globalObj", this);
connect(LinkManager::instance(),SIGNAL(newLink(LinkInterface*)),
this, SLOT(updateLinkDisplay(LinkInterface*)));
if (LinkManager::instance()->getLinks().count()>=3) {
updateLinkDisplay(LinkManager::instance()->getLinks().last());
}
setConnection(false);
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUasSet(UASInterface*)));
activeUasSet(UASManager::instance()->getActiveUAS());
}
void APMToolBar::activeUasSet(UASInterface *uas)
{
if (!uas)
{
return;
}
if (m_uas)
{
disconnect(m_uas,SIGNAL(armingChanged(bool)),
this,SLOT(armingChanged(bool)));
disconnect(uas,SIGNAL(armingChanged(int, QString)),
this,SLOT(armingChanged(int, QString)));
}
connect(uas,SIGNAL(armingChanged(bool)),
this,SLOT(armingChanged(bool)));
connect(uas,SIGNAL(armingChanged(int, QString)),
this,SLOT(armingChanged(int, QString)));
}
void APMToolBar::armingChanged(bool armed)
{
rootObject()->setProperty("armed", armed);
}
void APMToolBar::armingChanged(int sysId, QString armingState)
{
qDebug() << "APMToolBar: sysid " << sysId << " armState" << armingState;
}
void APMToolBar::setFlightViewAction(QAction *action)
{
connect(this, SIGNAL(triggerFlightView()), action, SIGNAL(triggered()));
}
void APMToolBar::setFlightPlanViewAction(QAction *action)
{
connect(this, SIGNAL(triggerFlightPlanView()), action, SIGNAL(triggered()));
}
void APMToolBar::setHardwareViewAction(QAction *action)
{
connect(this, SIGNAL(triggerHardwareView()), action, SIGNAL(triggered()));
}
void APMToolBar::setSoftwareViewAction(QAction *action)
{
connect(this, SIGNAL(triggerSoftwareView()), action, SIGNAL(triggered()));
}
void APMToolBar::setSimulationViewAction(QAction *action)
{
connect(this, SIGNAL(triggerSimulationView()), action, SIGNAL(triggered()));
}
void APMToolBar::setTerminalViewAction(QAction *action)
{
connect(this, SIGNAL(triggerTerminalView()), action, SIGNAL(triggered()));
}
void APMToolBar::setConnectMAVAction(QAction *action)
{
connect(this, SIGNAL(connectMAV()), action, SIGNAL(triggered()));
}
void APMToolBar::selectFlightView()
{
qDebug() << "APMToolBar: SelectFlightView";
emit triggerFlightView();
}
void APMToolBar::selectFlightPlanView()
{
qDebug() << "APMToolBar: SelectFlightPlanView";
emit triggerFlightPlanView();
}
void APMToolBar::selectHardwareView()
{
qDebug() << "APMToolBar: selectHardwareView";
emit triggerHardwareView();
}
void APMToolBar::selectSoftwareView()
{
qDebug() << "APMToolBar: selectSoftwareView";
emit triggerSoftwareView();
}
void APMToolBar::selectSimulationView()
{
qDebug() << "APMToolBar: selectSimulationView";
}
void APMToolBar::selectTerminalView()
{
qDebug() << "APMToolBar: selectTerminalView";
}
void APMToolBar::connectMAV()
{
qDebug() << "APMToolBar: connectMAV ";
if (LinkManager::instance()->getSerialLinks().count() > 0) {
bool result;
bool connected = LinkManager::instance()->getSerialLinks().last()->isConnected();
if (connected) {
// result need to be the opposite of success.
result = !LinkManager::instance()->getSerialLinks().last()->disconnect();
} else {
// Need to Connect Link
result = LinkManager::instance()->getSerialLinks().last()->connect();
}
qDebug() << "result = " << result;
// Change the image to represent the state
setConnection(result);
emit MAVConnected(result);
} else {
// No Link so prompt to connect one
MainWindow::instance()->addLink();
}
}
void APMToolBar::setConnection(bool connection)
{
// Change the image to represent the state
rootObject()->setProperty("connected", connection);
}
APMToolBar::~APMToolBar()
{
qDebug() << "Destory APM Toolbar";
}
void APMToolBar::showConnectionDialog()
{
// Displays a UI where the user can select a MAV Link.
qDebug() << "APMToolBar: showConnectionDialog link count ="
<< LinkManager::instance()->getLinks().count();
bool result;
if (LinkManager::instance()->getSerialLinks().count() > 0)
{
SerialLink *link = LinkManager::instance()->getSerialLinks().last();
// Serial Link so prompt to config it
connect(link, SIGNAL(updateLink(LinkInterface*)),
this, SLOT(updateLinkDisplay(LinkInterface*)));
result = MainWindow::instance()->configLink(link);
if (!result)
qDebug() << "Link Config Failed!";
} else {
// No Link so prompt to create one
MainWindow::instance()->addLink();
}
}
void APMToolBar::updateLinkDisplay(LinkInterface* newLink)
{
qDebug() << "APMToolBar: updateLinkDisplay";
QObject *object = rootObject();
if (newLink && rootObject()){
qint64 baudrate = newLink->getConnectionSpeed();
object->setProperty("baudrateLabel", QString::number(baudrate));
QString linkName = newLink->getName();
object->setProperty("linkNameLabel", linkName);
connect(newLink, SIGNAL(connected(bool)),
this, SLOT(setConnection(bool)));
setConnection(newLink->isConnected());
}
}
#ifndef APMTOOLBAR_H
#define APMTOOLBAR_H
#include <QAction>
#include <QQuickView>
#include "UASInterface.h"
class LinkInterface;
class APMToolBar : public QQuickView
{
Q_OBJECT
public:
explicit APMToolBar();
~APMToolBar();
void setFlightViewAction(QAction *action);
void setFlightPlanViewAction(QAction *action);
void setHardwareViewAction(QAction *action);
void setSoftwareViewAction(QAction *action);
void setSimulationViewAction(QAction *action);
void setTerminalViewAction(QAction *action);
void setConnectMAVAction(QAction *action);
signals:
void triggerFlightView();
void triggerFlightPlanView();
void triggerHardwareView();
void triggerSoftwareView();
void triggerSimulationView();
void triggerTerminalView();
void MAVConnected(bool connected);
public slots:
void selectFlightView();
void selectFlightPlanView();
void selectHardwareView();
void selectSoftwareView();
void selectSimulationView();
void selectTerminalView();
void connectMAV();
void showConnectionDialog();
void setConnection(bool connection);
void activeUasSet(UASInterface *uas);
void armingChanged(int sysId, QString armingState);
void armingChanged(bool armed);
void updateLinkDisplay(LinkInterface *newLink);
private:
UASInterface *m_uas;
};
#endif // APMTOOLBAR_H
#include <QMessageBox>
#include "AP2ConfigWidget.h"
AP2ConfigWidget::AP2ConfigWidget(QWidget *parent) : QWidget(parent)
{
m_uas = 0;
}
void AP2ConfigWidget::initConnections()
{
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
activeUASSet(UASManager::instance()->getActiveUAS());
}
void AP2ConfigWidget::activeUASSet(UASInterface *uas)
{
if (m_uas)
{
disconnect(m_uas,SIGNAL(parameterChanged(int,int,QString,QVariant)),this,SLOT(parameterChanged(int,int,QString,QVariant)));
m_uas = 0;
}
if (!uas) return;
m_uas = uas;
connect(m_uas,SIGNAL(parameterChanged(int,int,QString,QVariant)),this,SLOT(parameterChanged(int,int,QString,QVariant)));
}
void AP2ConfigWidget::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
Q_UNUSED(uas);
Q_UNUSED(component);
Q_UNUSED(parameterName);
Q_UNUSED(value);
}
void AP2ConfigWidget::showNullMAVErrorMessageBox()
{
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
}
#ifndef AP2CONFIGWIDGET_H
#define AP2CONFIGWIDGET_H
#include <QWidget>
#include "UASManager.h"
#include "UASInterface.h"
class AP2ConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit AP2ConfigWidget(QWidget *parent = 0);
protected:
UASInterface *m_uas;
void showNullMAVErrorMessageBox();
void initConnections();
signals:
public slots:
virtual void activeUASSet(UASInterface *uas);
virtual void parameterChanged(int uas, int component, QString parameterName, QVariant value);
};
#endif // AP2CONFIGWIDGET_H
#include "AccelCalibrationConfig.h"
AccelCalibrationConfig::AccelCalibrationConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
connect(ui.calibrateAccelButton,SIGNAL(clicked()),this,SLOT(calibrateButtonClicked()));
m_accelAckCount=0;
initConnections();
}
AccelCalibrationConfig::~AccelCalibrationConfig()
{
}
void AccelCalibrationConfig::activeUASSet(UASInterface *uas)
{
if (m_uas)
{
disconnect(m_uas,SIGNAL(textMessageReceived(int,int,int,QString)),this,SLOT(uasTextMessageReceived(int,int,int,QString)));
}
AP2ConfigWidget::activeUASSet(uas);
if (!uas)
{
return;
}
connect(m_uas,SIGNAL(textMessageReceived(int,int,int,QString)),this,SLOT(uasTextMessageReceived(int,int,int,QString)));
}
void AccelCalibrationConfig::calibrateButtonClicked()
{
if (!m_uas)
{
showNullMAVErrorMessageBox();
return;
}
if (m_accelAckCount == 0)
{
MAV_CMD command = MAV_CMD_PREFLIGHT_CALIBRATION;
int confirm = 0;
float param1 = 0.0;
float param2 = 0.0;
float param3 = 0.0;
float param4 = 0.0;
float param5 = 1.0;
float param6 = 0.0;
float param7 = 0.0;
int component = 1;
m_uas->executeCommand(command, confirm, param1, param2, param3, param4, param5, param6, param7, component);
}
else if (m_accelAckCount <= 5)
{
m_uas->executeCommandAck(m_accelAckCount++,true);
}
else
{
m_uas->executeCommandAck(m_accelAckCount++,true);
ui.calibrateAccelButton->setText("Calibrate\nAccelerometer");
if (m_accelAckCount > 8)
{
//We've clicked too many times! Reset.
for (int i=0;i<8;i++)
{
m_uas->executeCommandAck(i,true);
}
m_accelAckCount = 0;
}
}
}
void AccelCalibrationConfig::hideEvent(QHideEvent *evt)
{
Q_UNUSED(evt);
if (!m_uas || !m_accelAckCount)
{
return;
}
for (int i=m_accelAckCount;i<8;i++)
{
m_uas->executeCommandAck(i,true); //Clear out extra commands.
}
}
void AccelCalibrationConfig::uasTextMessageReceived(int uasid, int componentid, int severity, QString text)
{
Q_UNUSED(uasid);
Q_UNUSED(componentid);
//command received: " Severity 1
//Place APM Level and press any key" severity 5
if (severity == 5)
{
//This is a calibration instruction
if (m_accelAckCount == 0)
{
//Calibration Sucessful\r"
ui.calibrateAccelButton->setText("Continue");
m_accelAckCount++;
}
if (m_accelAckCount == 7)
{
//All finished
//ui.outputLabel->setText(ui.outputLabel->text() + "\n" + text);
ui.outputLabel->setText(text);
m_accelAckCount++;
}
if (m_accelAckCount == 8)
{
if (text.contains("Calibration") && text.contains("successful"))
{
m_accelAckCount = 0;
}
else if (text.contains("Calibration") && text.contains("FAILED")) //Failure
{
m_accelAckCount = 0;
}
ui.outputLabel->setText(ui.outputLabel->text() + "\n" + text);
}
else
{
ui.outputLabel->setText(text.replace("press any key","click Continue below"));
if (!this->isVisible())
{
//Clear out!
m_uas->executeCommandAck(m_accelAckCount++,true);
ui.calibrateAccelButton->setText("Calibrate\nAccelerometer");
}
}
}
}
#ifndef ACCELCALIBRATIONCONFIG_H
#define ACCELCALIBRATIONCONFIG_H
#include <QWidget>
#include "ui_AccelCalibrationConfig.h"
#include "UASManager.h"
#include "UASInterface.h"
#include "AP2ConfigWidget.h"
class AccelCalibrationConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit AccelCalibrationConfig(QWidget *parent = 0);
~AccelCalibrationConfig();
protected:
void hideEvent(QHideEvent *evt);
private slots:
void activeUASSet(UASInterface *uas);
void calibrateButtonClicked();
void uasTextMessageReceived(int uasid, int componentid, int severity, QString text);
private:
int m_accelAckCount;
Ui::AccelCalibrationConfig ui;
};
#endif // ACCELCALIBRATIONCONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AccelCalibrationConfig</class>
<widget class="QWidget" name="AccelCalibrationConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>576</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>231</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Accelerometer Calibration&lt;/h2&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="calibrateAccelButton">
<property name="geometry">
<rect>
<x>70</x>
<y>160</y>
<width>111</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>Calibrate
Accelerometer</string>
</property>
</widget>
<widget class="QLabel" name="outputLabel">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>311</width>
<height>101</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
#include "AdvParameterList.h"
AdvParameterList::AdvParameterList(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
ui.tableWidget->setColumnCount(4);
ui.tableWidget->horizontalHeader()->hide();
ui.tableWidget->verticalHeader()->hide();
ui.tableWidget->setColumnWidth(0,200);
ui.tableWidget->setColumnWidth(1,100);
ui.tableWidget->setColumnWidth(2,200);
ui.tableWidget->setColumnWidth(3,800);
initConnections();
}
AdvParameterList::~AdvParameterList()
{
}
void AdvParameterList::setParameterMetaData(QString name,QString humanname,QString description)
{
m_paramToNameMap[name] = humanname;
m_paramToDescriptionMap[name] = description;
}
void AdvParameterList::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
Q_UNUSED(uas);
Q_UNUSED(component);
if (!m_paramValueMap.contains(parameterName))
{
ui.tableWidget->setRowCount(ui.tableWidget->rowCount()+1);
if (m_paramToNameMap.contains(parameterName))
{
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,0,new QTableWidgetItem(m_paramToNameMap[parameterName]));
}
else
{
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,0,new QTableWidgetItem("Unknown"));
}
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,1,new QTableWidgetItem(QString::number(value.toFloat(),'f',2)));
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,2,new QTableWidgetItem(parameterName));
if (m_paramToDescriptionMap.contains(parameterName))
{
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,3,new QTableWidgetItem(m_paramToDescriptionMap[parameterName]));
}
else
{
ui.tableWidget->setItem(ui.tableWidget->rowCount()-1,3,new QTableWidgetItem("Unknown"));
}
m_paramValueMap[parameterName] = ui.tableWidget->item(ui.tableWidget->rowCount()-1,1);
}
m_paramValueMap[parameterName]->setText(QString::number(value.toFloat(),'f',2));
}
#ifndef ADVPARAMETERLIST_H
#define ADVPARAMETERLIST_H
#include <QWidget>
#include "ui_AdvParameterList.h"
#include "AP2ConfigWidget.h"
class AdvParameterList : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit AdvParameterList(QWidget *parent = 0);
void setParameterMetaData(QString name,QString humanname,QString description);
~AdvParameterList();
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
private:
QMap<QString,QTableWidgetItem*> m_paramValueMap;
QMap<QString,QString> m_paramToNameMap;
QMap<QString,QString> m_paramToDescriptionMap;
Ui::AdvParameterList ui;
};
#endif // ADVPARAMETERLIST_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AdvParameterList</class>
<widget class="QWidget" name="AdvParameterList">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>666</width>
<height>497</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;h2&gt;Full Parameter List&lt;/h2&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableWidget"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
#include "AdvancedParamConfig.h"
AdvancedParamConfig::AdvancedParamConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
initConnections();
}
AdvancedParamConfig::~AdvancedParamConfig()
{
}
void AdvancedParamConfig::addRange(QString title,QString description,QString param,double min,double max)
{
ParamWidget *widget = new ParamWidget(param,ui.scrollAreaWidgetContents);
connect(widget,SIGNAL(doubleValueChanged(QString,double)),this,SLOT(doubleValueChanged(QString,double)));
connect(widget,SIGNAL(intValueChanged(QString,int)),this,SLOT(intValueChanged(QString,int)));
m_paramToWidgetMap[param] = widget;
widget->setupDouble(title + "(" + param + ")",description,0,min,max);
ui.verticalLayout->addWidget(widget);
widget->show();
}
void AdvancedParamConfig::addCombo(QString title,QString description,QString param,QList<QPair<int,QString> > valuelist)
{
ParamWidget *widget = new ParamWidget(param,ui.scrollAreaWidgetContents);
connect(widget,SIGNAL(doubleValueChanged(QString,double)),this,SLOT(doubleValueChanged(QString,double)));
connect(widget,SIGNAL(intValueChanged(QString,int)),this,SLOT(intValueChanged(QString,int)));
m_paramToWidgetMap[param] = widget;
widget->setupCombo(title + "(" + param + ")",description,valuelist);
ui.verticalLayout->addWidget(widget);
widget->show();
}
void AdvancedParamConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
Q_UNUSED(uas);
Q_UNUSED(component);
if (m_paramToWidgetMap.contains(parameterName))
{
if (value.type() == QVariant::Double)
{
m_paramToWidgetMap[parameterName]->setValue(value.toDouble());
}
else
{
m_paramToWidgetMap[parameterName]->setValue(value.toInt());
}
}
}
void AdvancedParamConfig::doubleValueChanged(QString param,double value)
{
if (!m_uas)
{
this->showNullMAVErrorMessageBox();
}
m_uas->getParamManager()->setParameter(1,param,value);
}
void AdvancedParamConfig::intValueChanged(QString param,int value)
{
if (!m_uas)
{
this->showNullMAVErrorMessageBox();
}
m_uas->getParamManager()->setParameter(1,param,value);
}
#ifndef ADVANCEDPARAMCONFIG_H
#define ADVANCEDPARAMCONFIG_H
#include <QWidget>
#include "ui_AdvancedParamConfig.h"
#include "AP2ConfigWidget.h"
#include "ParamWidget.h"
class AdvancedParamConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit AdvancedParamConfig(QWidget *parent = 0);
~AdvancedParamConfig();
void addRange(QString title,QString description,QString param,double min,double max);
void addCombo(QString title,QString description,QString param,QList<QPair<int,QString> > valuelist);
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void doubleValueChanged(QString param,double value);
void intValueChanged(QString param,int value);
private:
QMap<QString,ParamWidget*> m_paramToWidgetMap;
Ui::AdvancedParamConfig ui;
};
#endif // ADVANCEDPARAMCONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AdvancedParamConfig</class>
<widget class="QWidget" name="AdvancedParamConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>725</width>
<height>632</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;h2&gt;Advanced Params&lt;/h2&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>705</width>
<height>585</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
#include "AirspeedConfig.h"
#include <QMessageBox>
AirspeedConfig::AirspeedConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(enableCheckBoxClicked(bool)));
connect(ui.useAirspeedCheckBox,SIGNAL(toggled(bool)),this,SLOT(useCheckBoxClicked(bool)));
initConnections();
}
AirspeedConfig::~AirspeedConfig()
{
}
void AirspeedConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
Q_UNUSED(uas);
Q_UNUSED(component);
if (parameterName == "ARSPD_ENABLE")
{
if (value.toInt() == 0)
{
disconnect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(enableCheckBoxClicked(bool)));
ui.enableCheckBox->setChecked(false);
connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(enableCheckBoxClicked(bool)));
ui.useAirspeedCheckBox->setEnabled(false);
}
else
{
disconnect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(enableCheckBoxClicked(bool)));
ui.enableCheckBox->setChecked(true);
connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(enableCheckBoxClicked(bool)));
ui.useAirspeedCheckBox->setEnabled(true);
}
}
else if (parameterName == "ARSPD_USE")
{
if (value.toInt() == 0)
{
disconnect(ui.useAirspeedCheckBox,SIGNAL(toggled(bool)),this,SLOT(useCheckBoxClicked(bool)));
ui.useAirspeedCheckBox->setChecked(false);
connect(ui.useAirspeedCheckBox,SIGNAL(toggled(bool)),this,SLOT(useCheckBoxClicked(bool)));
}
else
{
disconnect(ui.useAirspeedCheckBox,SIGNAL(toggled(bool)),this,SLOT(useCheckBoxClicked(bool)));
ui.useAirspeedCheckBox->setChecked(true);
connect(ui.useAirspeedCheckBox,SIGNAL(toggled(bool)),this,SLOT(useCheckBoxClicked(bool)));
}
}
}
void AirspeedConfig::useCheckBoxClicked(bool checked)
{
if (!m_uas)
{
showNullMAVErrorMessageBox();
return;
}
if (checked)
{
m_uas->getParamManager()->setParameter(1,"ARSPD_USE",1);
}
else
{
m_uas->getParamManager()->setParameter(1,"ARSPD_USE",0);
}
}
void AirspeedConfig::enableCheckBoxClicked(bool checked)
{
if (!m_uas)
{
showNullMAVErrorMessageBox();
return;
}
if (checked)
{
m_uas->getParamManager()->setParameter(1,"ARSPD_ENABLE",1);
}
else
{
m_uas->getParamManager()->setParameter(1,"ARSPD_ENABLE",0);
}
}
#ifndef AIRSPEEDCONFIG_H
#define AIRSPEEDCONFIG_H
#include <QWidget>
#include "AP2ConfigWidget.h"
#include "ui_AirspeedConfig.h"
class AirspeedConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit AirspeedConfig(QWidget *parent = 0);
~AirspeedConfig();
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void useCheckBoxClicked(bool checked);
void enableCheckBoxClicked(bool checked);
private:
Ui::AirspeedConfig ui;
};
#endif // AIRSPEEDCONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AirspeedConfig</class>
<widget class="QWidget" name="AirspeedConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>131</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Airspeed&lt;/h2&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>71</width>
<height>71</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../qgroundcontrol.qrc">:/files/images/devices/BR-0004-03-2.jpg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="enableCheckBox">
<property name="geometry">
<rect>
<x>110</x>
<y>70</y>
<width>70</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Enable</string>
</property>
</widget>
<widget class="QCheckBox" name="useAirspeedCheckBox">
<property name="geometry">
<rect>
<x>110</x>
<y>100</y>
<width>91</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Use Airspeed</string>
</property>
</widget>
</widget>
<resources>
<include location="../../../qgroundcontrol.qrc"/>
</resources>
<connections/>
</ui>
#include "AntennaTrackerConfig.h"
AntennaTrackerConfig::AntennaTrackerConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
}
AntennaTrackerConfig::~AntennaTrackerConfig()
{
}
#ifndef ANTENNATRACKERCONFIG_H
#define ANTENNATRACKERCONFIG_H
#include <QWidget>
#include "ui_AntennaTrackerConfig.h"
class AntennaTrackerConfig : public QWidget
{
Q_OBJECT
public:
explicit AntennaTrackerConfig(QWidget *parent = 0);
~AntennaTrackerConfig();
private:
Ui::AntennaTrackerConfig ui;
};
#endif // ANTENNATRACKERCONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AntennaTrackerConfig</class>
<widget class="QWidget" name="AntennaTrackerConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1171</width>
<height>560</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>151</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Antenna Tracker&lt;/h2&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Interface</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>80</x>
<y>50</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="comboBox_2">
<property name="geometry">
<rect>
<x>160</x>
<y>50</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="comboBox_3">
<property name="geometry">
<rect>
<x>240</x>
<y>50</y>
<width>69</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="connectPushButton">
<property name="geometry">
<rect>
<x>320</x>
<y>50</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Connect</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>581</width>
<height>131</height>
</rect>
</property>
<property name="title">
<string>Pan</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,2,5,0">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Angle</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>PWM</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Center PWM</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLineEdit" name="panAngleLineEdit"/>
</item>
<item>
<widget class="QLineEdit" name="panPwmLineEdit"/>
</item>
<item>
<widget class="QLineEdit" name="pwnCenterLineEdit"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Trim</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider">
<property name="minimum">
<number>-180</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="panTrimLabel">
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="panRevCheckBox">
<property name="text">
<string>Rev</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>20</x>
<y>220</y>
<width>581</width>
<height>131</height>
</rect>
</property>
<property name="title">
<string>Tilt</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,2,5,0">
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Angle</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>PWM</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>Center PWM</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLineEdit" name="tiltAngleLineEdit"/>
</item>
<item>
<widget class="QLineEdit" name="tiltPwmLineEdit"/>
</item>
<item>
<widget class="QLineEdit" name="tiltCenterLineEdit"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>Trim</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider_2">
<property name="minimum">
<number>-180</number>
</property>
<property name="maximum">
<number>180</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="tiltTrimLabel">
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="tiltRevCheckBox">
<property name="text">
<string>Rev</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
This diff is collapsed.
#ifndef APMFIRMWARECONFIG_H
#define APMFIRMWARECONFIG_H
#include <QWidget>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QDebug>
#include <QTemporaryFile>
#include <QProcess>
#include <QXmlStreamReader>
#include <QMessageBox>
#include <QProcess>
#include <QScrollBar>
#include <QSerialPort>
#include "ui_ApmFirmwareConfig.h"
class ApmFirmwareConfig : public QWidget
{
Q_OBJECT
public:
explicit ApmFirmwareConfig(QWidget *parent = 0);
~ApmFirmwareConfig();
private slots:
void firmwareListFinished();
void firmwareListError(QNetworkReply::NetworkError error);
void flashButtonClicked();
void betaFirmwareButtonClicked(bool betafirmwareenabled);
void downloadFinished();
void firmwareProcessFinished(int status);
void firmwareProcessReadyRead();
void firmwareProcessError(QProcess::ProcessError error);
void firmwareDownloadProgress(qint64 received,qint64 total);
void requestFirmwares();
void requestBetaFirmwares();
private:
void addBetaLabel(QWidget *parent);
void hideBetaLabels();
void showBetaLabels();
//ApmFirmwareStatus *firmwareStatus;
QString m_detectedComPort;
QTemporaryFile *m_tempFirmwareFile;
QNetworkAccessManager *m_networkManager;
QList<QLabel*> m_betaButtonLabelList;
bool stripVersionFromGitReply(QString url,QString reply,QString type,QString stable,QString *out);
bool m_betaFirmwareChecked;
QMap<QPushButton*,QString> m_buttonToUrlMap;
Ui::ApmFirmwareConfig ui;
class FirmwareDef
{
public:
QString url;
QString url2560;
QString url25602;
QString urlpx4;
QString type;
QString name;
QString desc;
int version;
};
QList<FirmwareDef> m_firmwareList;
};
#endif // APMFIRMWARECONFIG_H
This diff is collapsed.
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2013 Michael Carpenter (malcom2073@gmail.com)
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief APM Hardware Configuration widget source.
*
* @author Michael Carpenter <malcom2073@gmail.com>
*
*/
#include "ApmHardwareConfig.h"
ApmHardwareConfig::ApmHardwareConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
ui.manditoryHardware->setVisible(false);
ui.frameTypeButton->setVisible(false);
ui.compassButton->setVisible(false);
ui.accelCalibrateButton->setVisible(false);
ui.arduPlaneLevelButton->setVisible(false);
ui.radioCalibrateButton->setVisible(false);
ui.optionalHardwareButton->setVisible(false);
ui.batteryMonitorButton->setVisible(false);
ui.sonarButton->setVisible(false);
ui.airspeedButton->setVisible(false);
ui.opticalFlowButton->setVisible(false);
ui.osdButton->setVisible(false);
ui.cameraGimbalButton->setVisible(false);
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.radio3DRButton,SLOT(setVisible(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.batteryMonitorButton,SLOT(setVisible(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.sonarButton,SLOT(setVisible(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.opticalFlowButton,SLOT(setVisible(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.osdButton,SLOT(setVisible(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.cameraGimbalButton,SLOT(setVisible(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.antennaTrackerButton,SLOT(setVisible(bool)));
connect(ui.frameTypeButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_apmFirmwareConfig = new ApmFirmwareConfig(this);
ui.stackedWidget->addWidget(m_apmFirmwareConfig); //Firmware placeholder.
m_buttonToConfigWidgetMap[ui.firmwareButton] = m_apmFirmwareConfig;
connect(ui.firmwareButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_frameConfig = new FrameTypeConfig(this);
ui.stackedWidget->addWidget(m_frameConfig);
m_buttonToConfigWidgetMap[ui.frameTypeButton] = m_frameConfig;
connect(ui.frameTypeButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_compassConfig = new CompassConfig(this);
ui.stackedWidget->addWidget(m_compassConfig);
m_buttonToConfigWidgetMap[ui.compassButton] = m_compassConfig;
connect(ui.compassButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_accelConfig = new AccelCalibrationConfig(this);
ui.stackedWidget->addWidget(m_accelConfig);
m_buttonToConfigWidgetMap[ui.accelCalibrateButton] = m_accelConfig;
connect(ui.accelCalibrateButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_planeLevel = new ApmPlaneLevel(this);
ui.stackedWidget->addWidget(m_planeLevel);
m_buttonToConfigWidgetMap[ui.arduPlaneLevelButton] = m_planeLevel;
connect(ui.arduPlaneLevelButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_radioConfig = new RadioCalibrationConfig(this);
ui.stackedWidget->addWidget(m_radioConfig);
m_buttonToConfigWidgetMap[ui.radioCalibrateButton] = m_radioConfig;
connect(ui.radioCalibrateButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_radio3drConfig = new Radio3DRConfig(this);
ui.stackedWidget->addWidget(m_radio3drConfig);
m_buttonToConfigWidgetMap[ui.radio3DRButton] = m_radio3drConfig;
connect(ui.radio3DRButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_batteryConfig = new BatteryMonitorConfig(this);
ui.stackedWidget->addWidget(m_batteryConfig);
m_buttonToConfigWidgetMap[ui.batteryMonitorButton] = m_batteryConfig;
connect(ui.batteryMonitorButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_sonarConfig = new SonarConfig(this);
ui.stackedWidget->addWidget(m_sonarConfig);
m_buttonToConfigWidgetMap[ui.sonarButton] = m_sonarConfig;
connect(ui.sonarButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_airspeedConfig = new AirspeedConfig(this);
ui.stackedWidget->addWidget(m_airspeedConfig);
m_buttonToConfigWidgetMap[ui.airspeedButton] = m_airspeedConfig;
connect(ui.airspeedButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_opticalFlowConfig = new OpticalFlowConfig(this);
ui.stackedWidget->addWidget(m_opticalFlowConfig);
m_buttonToConfigWidgetMap[ui.opticalFlowButton] = m_opticalFlowConfig;
connect(ui.opticalFlowButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_osdConfig = new OsdConfig(this);
ui.stackedWidget->addWidget(m_osdConfig);
m_buttonToConfigWidgetMap[ui.osdButton] = m_osdConfig;
connect(ui.osdButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_cameraGimbalConfig = new CameraGimbalConfig(this);
ui.stackedWidget->addWidget(m_cameraGimbalConfig);
m_buttonToConfigWidgetMap[ui.cameraGimbalButton] = m_cameraGimbalConfig;
connect(ui.cameraGimbalButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
m_antennaTrackerConfig = new AntennaTrackerConfig(this);
ui.stackedWidget->addWidget(m_antennaTrackerConfig);
m_buttonToConfigWidgetMap[ui.antennaTrackerButton] = m_antennaTrackerConfig;
connect(ui.antennaTrackerButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
if (UASManager::instance()->getActiveUAS())
{
activeUASSet(UASManager::instance()->getActiveUAS());
}
}
void ApmHardwareConfig::activateStackedWidget()
{
if (m_buttonToConfigWidgetMap.contains(sender()))
{
ui.stackedWidget->setCurrentWidget(m_buttonToConfigWidgetMap[sender()]);
}
}
ApmHardwareConfig::~ApmHardwareConfig()
{
}
void ApmHardwareConfig::activeUASSet(UASInterface *uas)
{
if (!uas)
{
return;
}
if (uas->getSystemType() == MAV_TYPE_FIXED_WING)
{
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setVisible(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.arduPlaneLevelButton,SLOT(setVisible(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setVisible(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.airspeedButton,SLOT(setVisible(bool)));
}
else if (uas->getSystemType() == MAV_TYPE_QUADROTOR)
{
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.frameTypeButton,SLOT(setVisible(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setVisible(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.accelCalibrateButton,SLOT(setVisible(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setVisible(bool)));
}
else if (uas->getSystemType() == MAV_TYPE_GROUND_ROVER)
{
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setVisible(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setVisible(bool)));
}
else
{
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setVisible(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setVisible(bool)));
}
ui.firmwareButton->setVisible(true);
ui.manditoryHardware->setVisible(true);
ui.manditoryHardware->setChecked(true);
ui.optionalHardwareButton->setVisible(true);
ui.optionalHardwareButton->setChecked(true);
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2013 Michael Carpenter (malcom2073@gmail.com)
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief APM Hardware Configuration widget header.
*
* @author Michael Carpenter <malcom2073@gmail.com>
*
*/
#ifndef APMHARDWARECONFIG_H
#define APMHARDWARECONFIG_H
#include <QWidget>
#include "ui_ApmHardwareConfig.h"
#include <UASInterface.h>
#include <UASManager.h>
#include "FrameTypeConfig.h"
#include "CompassConfig.h"
#include "AccelCalibrationConfig.h"
#include "RadioCalibrationConfig.h"
#include "Radio3DRConfig.h"
#include "BatteryMonitorConfig.h"
#include "SonarConfig.h"
#include "AirspeedConfig.h"
#include "OpticalFlowConfig.h"
#include "OsdConfig.h"
#include "CameraGimbalConfig.h"
#include "AntennaTrackerConfig.h"
#include "ApmPlaneLevel.h"
#include "ApmFirmwareConfig.h"
class ApmHardwareConfig : public QWidget
{
Q_OBJECT
public:
explicit ApmHardwareConfig(QWidget *parent = 0);
~ApmHardwareConfig();
private:
QPointer<FrameTypeConfig> m_frameConfig;
QPointer<CompassConfig> m_compassConfig;
QPointer<AccelCalibrationConfig> m_accelConfig;
QPointer<RadioCalibrationConfig> m_radioConfig;
QPointer<ApmFirmwareConfig> m_apmFirmwareConfig;
QPointer<Radio3DRConfig> m_radio3drConfig;
QPointer<BatteryMonitorConfig> m_batteryConfig;
QPointer<SonarConfig> m_sonarConfig;
QPointer<AirspeedConfig> m_airspeedConfig;
QPointer<OpticalFlowConfig> m_opticalFlowConfig;
QPointer<OsdConfig> m_osdConfig;
QPointer<CameraGimbalConfig> m_cameraGimbalConfig;
QPointer<AntennaTrackerConfig> m_antennaTrackerConfig;
QPointer<ApmPlaneLevel> m_planeLevel;
private slots:
void activeUASSet(UASInterface *uas);
void activateStackedWidget();
private:
Ui::ApmHardwareConfig ui;
//This is a map between the buttons, and the widgets they should be displying
QMap<QObject*,QWidget*> m_buttonToConfigWidgetMap;
};
#endif // APMHARDWARECONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ApmHardwareConfig</class>
<widget class="QWidget" name="ApmHardwareConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1225</width>
<height>827</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QScrollArea" name="scrollArea_6">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>175</width>
<height>531</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>175</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>175</width>
<height>16777215</height>
</size>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>156</width>
<height>676</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
<layout class="QVBoxLayout" name="navBarLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
</property>
<item>
<widget class="QPushButton" name="firmwareButton">
<property name="minimumSize">
<size>
<width>100</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Install Firmware</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="manditoryHardware">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> &gt;&gt;&gt; Manditory Hardware</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="frameTypeButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string> Frame Type</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="compassButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> Compass</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="accelCalibrateButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string> Accel Calibration</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="arduPlaneLevelButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string> ArduPlane Level</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="radioCalibrateButton">
<property name="minimumSize">
<size>
<width>100</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string> Radio Calibration</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="optionalHardwareButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>&gt;&gt;&gt; Optional Hardware</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="radio3DRButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> 3DR Radio</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="batteryMonitorButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> Battery Monitor</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sonarButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> Sonar</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="airspeedButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> Airspeed</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="opticalFlowButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> Optical Flow</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="osdButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>OSD</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cameraGimbalButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> Camera Gimbal</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="antennaTrackerButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> Antenna Tracker</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<widget class="QStackedWidget" name="stackedWidget">
<property name="geometry">
<rect>
<x>200</x>
<y>30</y>
<width>921</width>
<height>761</height>
</rect>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
#include "ApmPlaneLevel.h"
#include <QMessageBox>
ApmPlaneLevel::ApmPlaneLevel(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
connect(ui.levelPushButton,SIGNAL(clicked()),this,SLOT(levelClicked()));
connect(ui.manualLevelCheckBox,SIGNAL(toggled(bool)),this,SLOT(manualCheckBoxToggled(bool)));
initConnections();
}
ApmPlaneLevel::~ApmPlaneLevel()
{
}
void ApmPlaneLevel::levelClicked()
{
if (!m_uas)
{
showNullMAVErrorMessageBox();
return;
}
QMessageBox::information(0,"Warning","Be sure the plane is completly level, then click ok");
MAV_CMD command = MAV_CMD_PREFLIGHT_CALIBRATION;
int confirm = 0;
float param1 = 1.0;
float param2 = 0.0;
float param3 = 1.0;
float param4 = 0.0;
float param5 = 0.0;
float param6 = 0.0;
float param7 = 0.0;
int component = 1;
m_uas->executeCommand(command, confirm, param1, param2, param3, param4, param5, param6, param7, component);
QMessageBox::information(0,"Warning","Leveling completed");
}
void ApmPlaneLevel::manualCheckBoxToggled(bool checked)
{
if (!m_uas)
{
showNullMAVErrorMessageBox();
return;
}
if (checked)
{
m_uas->getParamManager()->setParameter(1,"MANUAL_LEVEL",1);
}
else
{
m_uas->getParamManager()->setParameter(1,"MANUAL_LEVEL",0);
}
}
void ApmPlaneLevel::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
Q_UNUSED(uas);
Q_UNUSED(component);
if (parameterName == "MANUAL_LEVEL")
{
if (value.toInt() == 1)
{
ui.manualLevelCheckBox->setChecked(true);
}
else
{
ui.manualLevelCheckBox->setChecked(false);
}
}
}
#ifndef APMPLANELEVEL_H
#define APMPLANELEVEL_H
#include <QWidget>
#include "ui_ApmPlaneLevel.h"
#include "AP2ConfigWidget.h"
class ApmPlaneLevel : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit ApmPlaneLevel(QWidget *parent = 0);
~ApmPlaneLevel();
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void levelClicked();
void manualCheckBoxToggled(bool checked);
private:
Ui::ApmPlaneLevel ui;
};
#endif // APMPLANELEVEL_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ApmPlaneLevel</class>
<widget class="QWidget" name="ApmPlaneLevel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>141</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;ArduPlane Level&lt;/h2&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>50</x>
<y>70</y>
<width>271</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>By Default your plane will autolevel on every boot.
To disable this action you need to turn on manual
level and perform a level to calibrate the accel offsets.</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>50</x>
<y>150</y>
<width>291</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Level your plane and click Level to set default accel offsets</string>
</property>
</widget>
<widget class="QPushButton" name="levelPushButton">
<property name="geometry">
<rect>
<x>160</x>
<y>180</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Level</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>120</x>
<y>230</y>
<width>151</width>
<height>51</height>
</rect>
</property>
<property name="title">
<string>For advanced users ONLY</string>
</property>
<widget class="QCheckBox" name="manualLevelCheckBox">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>91</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Manual Level</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>
This diff is collapsed.
#ifndef APMSOFTWARECONFIG_H
#define APMSOFTWARECONFIG_H
#include <QWidget>
#include "ui_ApmSoftwareConfig.h"
#include "FlightModeConfig.h"
#include "BasicPidConfig.h"
#include "StandardParamConfig.h"
#include "GeoFenceConfig.h"
#include "FailSafeConfig.h"
#include "AdvancedParamConfig.h"
#include "ArduCopterPidConfig.h"
#include "ArduPlanePidConfig.h"
#include "ArduRoverPidConfig.h"
#include "AdvParameterList.h"
#include "UASInterface.h"
#include "UASManager.h"
class ApmSoftwareConfig : public QWidget
{
Q_OBJECT
public:
explicit ApmSoftwareConfig(QWidget *parent = 0);
~ApmSoftwareConfig();
private slots:
void activateStackedWidget();
void activeUASSet(UASInterface *uas);
private:
Ui::ApmSoftwareConfig ui;
QPointer<BasicPidConfig> m_basicPidConfig;
QPointer<FlightModeConfig> m_flightConfig;
QPointer<StandardParamConfig> m_standardParamConfig;
QPointer<GeoFenceConfig> m_geoFenceConfig;
QPointer<FailSafeConfig> m_failSafeConfig;
QPointer<AdvancedParamConfig> m_advancedParamConfig;
QPointer<ArduCopterPidConfig> m_arduCopterPidConfig;
QPointer<ArduPlanePidConfig> m_arduPlanePidConfig;
QPointer<ArduRoverPidConfig> m_arduRoverPidConfig;
QPointer<AdvParameterList> m_advParameterList;
QMap<QObject*,QWidget*> m_buttonToConfigWidgetMap;
};
#endif // APMSOFTWARECONFIG_H
This diff is collapsed.
This diff is collapsed.
#ifndef ARDUCOPTERPIDCONFIG_H
#define ARDUCOPTERPIDCONFIG_H
#include <QWidget>
#include "ui_ArduCopterPidConfig.h"
#include "AP2ConfigWidget.h"
class ArduCopterPidConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit ArduCopterPidConfig(QWidget *parent = 0);
~ArduCopterPidConfig();
private slots:
void writeButtonClicked();
void refreshButtonClicked();
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void lockCheckBoxClicked(bool checked);
void stabilLockedChanged(double value);
private:
bool m_pitchRollLocked;
QList<QPair<int,QString> > m_ch6ValueToTextList;
QList<QPair<int,QString> > m_ch78ValueToTextList;
QMap<QString,QDoubleSpinBox*> m_nameToBoxMap;
Ui::ArduCopterPidConfig ui;
};
#endif // ARDUCOPTERPIDCONFIG_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "BasicPidConfig.h"
BasicPidConfig::BasicPidConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
}
BasicPidConfig::~BasicPidConfig()
{
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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