Commit 62ee83a4 authored by Bill Bonney's avatar Bill Bonney

Merge branch 'new_menus' of https://github.com/diydrones/apm_planner into new_menus

parents d4e21f98 771d74b7
...@@ -229,7 +229,28 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -229,7 +229,28 @@ FORMS += src/ui/MainWindow.ui \
src/ui/uas/UASActionsWidget.ui \ src/ui/uas/UASActionsWidget.ui \
src/ui/QGCTabbedInfoView.ui \ src/ui/QGCTabbedInfoView.ui \
src/ui/UASRawStatusView.ui \ src/ui/UASRawStatusView.ui \
src/ui/uas/QGCMessageView.ui src/ui/uas/QGCMessageView.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
INCLUDEPATH += src \ INCLUDEPATH += src \
src/ui \ src/ui \
src/ui/linechart \ src/ui/linechart \
...@@ -245,7 +266,8 @@ INCLUDEPATH += src \ ...@@ -245,7 +266,8 @@ INCLUDEPATH += src \
src/ui/watchdog \ src/ui/watchdog \
src/ui/map3D \ src/ui/map3D \
src/ui/mission \ src/ui/mission \
src/ui/designer src/ui/designer \
src/ui/configuration
HEADERS += src/MG.h \ HEADERS += src/MG.h \
src/QGCCore.h \ src/QGCCore.h \
src/uas/UASInterface.h \ src/uas/UASInterface.h \
...@@ -387,7 +409,29 @@ HEADERS += src/MG.h \ ...@@ -387,7 +409,29 @@ HEADERS += src/MG.h \
src/ui/QGCTabbedInfoView.h \ src/ui/QGCTabbedInfoView.h \
src/ui/UASRawStatusView.h \ src/ui/UASRawStatusView.h \
src/ui/PrimaryFlightDisplay.h \ src/ui/PrimaryFlightDisplay.h \
src/ui/uas/QGCMessageView.h src/ui/uas/QGCMessageView.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
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::HEADERS += src/ui/map3D/QGCGoogleEarthView.h macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
...@@ -564,7 +608,29 @@ SOURCES += src/main.cc \ ...@@ -564,7 +608,29 @@ SOURCES += src/main.cc \
src/ui/QGCTabbedInfoView.cpp \ src/ui/QGCTabbedInfoView.cpp \
src/ui/UASRawStatusView.cpp \ src/ui/UASRawStatusView.cpp \
src/ui/PrimaryFlightDisplay.cpp \ src/ui/PrimaryFlightDisplay.cpp \
src/ui/uas/QGCMessageView.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
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler # Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
...@@ -106,6 +106,19 @@ ...@@ -106,6 +106,19 @@
<file>files/images/apm_planner_logo_splash.png</file> <file>files/images/apm_planner_logo_splash.png</file>
<file>files/images/apm_planner_2_0-07.png</file> <file>files/images/apm_planner_2_0-07.png</file>
<file>files/images/apm_planner_2_0-08.png</file> <file>files/images/apm_planner_2_0-08.png</file>
<file>files/images/mavs/frames_plus.png</file>
<file>files/images/mavs/frames_x.png</file>
<file>files/images/mavs/frames-05.png</file>
<file>files/images/devices/BR-HMC5883-01-2.jpg</file>
<file>files/images/devices/BR-APMPWRDEAN-2.jpg</file>
<file>files/images/devices/AC-0004-11-2.jpg</file>
<file>files/images/devices/BR-0004-03-2.jpg</file>
<file>files/images/devices/BR-0016-01-3T.jpg</file>
<file>files/images/devices/MinimOSD.jpg</file>
<file>files/images/devices/cameraGimalPitch1.png</file>
<file>files/images/devices/cameraGimalRoll1.png</file>
<file>files/images/devices/cameraGimalYaw.png</file>
<file>files/images/devices/Shutter.png</file>
</qresource> </qresource>
<qresource prefix="/general"> <qresource prefix="/general">
<file alias="vera.ttf">files/styles/Vera.ttf</file> <file alias="vera.ttf">files/styles/Vera.ttf</file>
......
...@@ -174,7 +174,9 @@ MainWindow::MainWindow(QWidget *parent): ...@@ -174,7 +174,9 @@ MainWindow::MainWindow(QWidget *parent):
QList<QAction*> actions; QList<QAction*> actions;
actions << ui.actionFlightView; actions << ui.actionFlightView;
actions << ui.actionMissionView; actions << ui.actionMissionView;
actions << ui.actionConfiguration_2; //actions << ui.actionConfiguration_2;
actions << ui.actionHardwareConfig;
actions << ui.actionSoftwareConfig;
toolBar->setPerspectiveChangeActions(actions); toolBar->setPerspectiveChangeActions(actions);
// Add actions for advanced users (displayed in dropdown under "advanced") // Add actions for advanced users (displayed in dropdown under "advanced")
...@@ -472,12 +474,20 @@ void MainWindow::buildCommonWidgets() ...@@ -472,12 +474,20 @@ void MainWindow::buildCommonWidgets()
if (!configView) if (!configView)
{ {
configView = new SubMainWindow(this); configView = new SubMainWindow(this);
configView->setObjectName("VIEW_CONFIGURATION"); configView->setObjectName("VIEW_HARDWARE_CONFIG");
configView->setCentralWidget(new QGCVehicleConfig(this)); configView->setCentralWidget(new ApmHardwareConfig(this));
addCentralWidget(configView,"Config"); addCentralWidget(configView,"Hardware");
centralWidgetToDockWidgetsMap[VIEW_CONFIGURATION] = QMap<QString,QWidget*>(); centralWidgetToDockWidgetsMap[VIEW_HARDWARE_CONFIG] = QMap<QString,QWidget*>();
} }
if (!softwareConfigView)
{
softwareConfigView = new SubMainWindow(this);
softwareConfigView->setObjectName("VIEW_SOFTWARE_CONFIG");
softwareConfigView->setCentralWidget(new ApmSoftwareConfig(this));
addCentralWidget(softwareConfigView,"Software");
centralWidgetToDockWidgetsMap[VIEW_SOFTWARE_CONFIG] = QMap<QString,QWidget*>();
}
if (!engineeringView) if (!engineeringView)
{ {
engineeringView = new SubMainWindow(this); engineeringView = new SubMainWindow(this);
...@@ -1413,7 +1423,9 @@ void MainWindow::connectCommonActions() ...@@ -1413,7 +1423,9 @@ void MainWindow::connectCommonActions()
perspectives->addAction(ui.actionFlightView); perspectives->addAction(ui.actionFlightView);
perspectives->addAction(ui.actionSimulation_View); perspectives->addAction(ui.actionSimulation_View);
perspectives->addAction(ui.actionMissionView); perspectives->addAction(ui.actionMissionView);
perspectives->addAction(ui.actionConfiguration_2); //perspectives->addAction(ui.actionConfiguration_2);
perspectives->addAction(ui.actionHardwareConfig);
perspectives->addAction(ui.actionSoftwareConfig);
perspectives->addAction(ui.actionFirmwareUpdateView); perspectives->addAction(ui.actionFirmwareUpdateView);
perspectives->addAction(ui.actionUnconnectedView); perspectives->addAction(ui.actionUnconnectedView);
perspectives->setExclusive(true); perspectives->setExclusive(true);
...@@ -1444,10 +1456,15 @@ void MainWindow::connectCommonActions() ...@@ -1444,10 +1456,15 @@ void MainWindow::connectCommonActions()
ui.actionMissionView->setChecked(true); ui.actionMissionView->setChecked(true);
ui.actionMissionView->activate(QAction::Trigger); ui.actionMissionView->activate(QAction::Trigger);
} }
if (currentView == VIEW_CONFIGURATION) if (currentView == VIEW_HARDWARE_CONFIG)
{
ui.actionHardwareConfig->setChecked(true);
ui.actionHardwareConfig->activate(QAction::Trigger);
}
if (currentView == VIEW_SOFTWARE_CONFIG)
{ {
ui.actionConfiguration_2->setChecked(true); ui.actionSoftwareConfig->setChecked(true);
ui.actionConfiguration_2->activate(QAction::Trigger); ui.actionSoftwareConfig->activate(QAction::Trigger);
} }
if (currentView == VIEW_FIRMWAREUPDATE) if (currentView == VIEW_FIRMWAREUPDATE)
{ {
...@@ -1489,7 +1506,9 @@ void MainWindow::connectCommonActions() ...@@ -1489,7 +1506,9 @@ void MainWindow::connectCommonActions()
connect(ui.actionEngineersView, SIGNAL(triggered()), this, SLOT(loadEngineerView())); connect(ui.actionEngineersView, SIGNAL(triggered()), this, SLOT(loadEngineerView()));
connect(ui.actionMissionView, SIGNAL(triggered()), this, SLOT(loadOperatorView())); connect(ui.actionMissionView, SIGNAL(triggered()), this, SLOT(loadOperatorView()));
connect(ui.actionUnconnectedView, SIGNAL(triggered()), this, SLOT(loadUnconnectedView())); connect(ui.actionUnconnectedView, SIGNAL(triggered()), this, SLOT(loadUnconnectedView()));
connect(ui.actionConfiguration_2,SIGNAL(triggered()),this,SLOT(loadConfigurationView())); //connect(ui.actionConfiguration_2,SIGNAL(triggered()),this,SLOT(loadConfigurationView()));
connect(ui.actionHardwareConfig,SIGNAL(triggered()),this,SLOT(loadHardwareConfigView()));
connect(ui.actionSoftwareConfig,SIGNAL(triggered()),this,SLOT(loadSoftwareConfigView()));
connect(ui.actionFirmwareUpdateView, SIGNAL(triggered()), this, SLOT(loadFirmwareUpdateView())); connect(ui.actionFirmwareUpdateView, SIGNAL(triggered()), this, SLOT(loadFirmwareUpdateView()));
connect(ui.actionMavlinkView, SIGNAL(triggered()), this, SLOT(loadMAVLinkView())); connect(ui.actionMavlinkView, SIGNAL(triggered()), this, SLOT(loadMAVLinkView()));
...@@ -1955,9 +1974,12 @@ void MainWindow::loadViewState() ...@@ -1955,9 +1974,12 @@ void MainWindow::loadViewState()
// Load defaults // Load defaults
switch (currentView) switch (currentView)
{ {
case VIEW_CONFIGURATION: case VIEW_HARDWARE_CONFIG:
centerStack->setCurrentWidget(configView); centerStack->setCurrentWidget(configView);
break; break;
case VIEW_SOFTWARE_CONFIG:
centerStack->setCurrentWidget(softwareConfigView);
break;
case VIEW_ENGINEER: case VIEW_ENGINEER:
centerStack->setCurrentWidget(engineeringView); centerStack->setCurrentWidget(engineeringView);
break; break;
...@@ -2067,13 +2089,24 @@ void MainWindow::loadOperatorView() ...@@ -2067,13 +2089,24 @@ void MainWindow::loadOperatorView()
loadViewState(); loadViewState();
} }
} }
void MainWindow::loadConfigurationView() void MainWindow::loadHardwareConfigView()
{
if (currentView != VIEW_HARDWARE_CONFIG)
{
storeViewState();
currentView = VIEW_HARDWARE_CONFIG;
ui.actionHardwareConfig->setChecked(true);
loadViewState();
}
}
void MainWindow::loadSoftwareConfigView()
{ {
if (currentView != VIEW_CONFIGURATION) if (currentView != VIEW_SOFTWARE_CONFIG)
{ {
storeViewState(); storeViewState();
currentView = VIEW_CONFIGURATION; currentView = VIEW_SOFTWARE_CONFIG;
ui.actionConfiguration_2->setChecked(true); ui.actionSoftwareConfig->setChecked(true);
loadViewState(); loadViewState();
} }
} }
......
...@@ -82,6 +82,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -82,6 +82,8 @@ This file is part of the QGROUNDCONTROL project
#include "QGCMAVLinkLogPlayer.h" #include "QGCMAVLinkLogPlayer.h"
#include "QGCVehicleConfig.h" #include "QGCVehicleConfig.h"
#include "MAVLinkDecoder.h" #include "MAVLinkDecoder.h"
#include "ApmHardwareConfig.h"
#include "ApmSoftwareConfig.h"
class QGCMapTool; class QGCMapTool;
class QGCMAVLinkMessageSender; class QGCMAVLinkMessageSender;
...@@ -164,8 +166,9 @@ public slots: ...@@ -164,8 +166,9 @@ public slots:
/** @brief Sets advanced mode, allowing for editing of tool widget locations */ /** @brief Sets advanced mode, allowing for editing of tool widget locations */
void setAdvancedMode(); void setAdvancedMode();
/** @brief Load configuration view */ /** @brief Load configuration views */
void loadConfigurationView(); void loadHardwareConfigView();
void loadSoftwareConfigView();
/** @brief Load default view when no MAV is connected */ /** @brief Load default view when no MAV is connected */
void loadUnconnectedView(); void loadUnconnectedView();
/** @brief Load view for pilot */ /** @brief Load view for pilot */
...@@ -282,7 +285,8 @@ protected: ...@@ -282,7 +285,8 @@ protected:
VIEW_SIMULATION, VIEW_SIMULATION,
VIEW_MAVLINK, VIEW_MAVLINK,
VIEW_FIRMWAREUPDATE, VIEW_FIRMWAREUPDATE,
VIEW_CONFIGURATION, VIEW_HARDWARE_CONFIG,
VIEW_SOFTWARE_CONFIG,
VIEW_UNCONNECTED, ///< View in unconnected mode, when no UAS is available VIEW_UNCONNECTED, ///< View in unconnected mode, when no UAS is available
VIEW_FULL ///< All widgets shown at once VIEW_FULL ///< All widgets shown at once
} VIEW_SECTIONS; } VIEW_SECTIONS;
...@@ -349,6 +353,7 @@ protected: ...@@ -349,6 +353,7 @@ protected:
QPointer<SubMainWindow> plannerView; QPointer<SubMainWindow> plannerView;
QPointer<SubMainWindow> pilotView; QPointer<SubMainWindow> pilotView;
QPointer<SubMainWindow> configView; QPointer<SubMainWindow> configView;
QPointer<SubMainWindow> softwareConfigView;
QPointer<SubMainWindow> mavlinkView; QPointer<SubMainWindow> mavlinkView;
QPointer<SubMainWindow> engineeringView; QPointer<SubMainWindow> engineeringView;
QPointer<SubMainWindow> simView; QPointer<SubMainWindow> simView;
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>22</height> <height>21</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuMGround"> <widget class="QMenu" name="menuMGround">
...@@ -105,7 +105,8 @@ ...@@ -105,7 +105,8 @@
</property> </property>
<addaction name="actionMissionView"/> <addaction name="actionMissionView"/>
<addaction name="actionFlightView"/> <addaction name="actionFlightView"/>
<addaction name="actionConfiguration_2"/> <addaction name="actionHardwareConfig"/>
<addaction name="actionSoftwareConfig"/>
<addaction name="actionEngineersView"/> <addaction name="actionEngineersView"/>
<addaction name="actionSimulationView"/> <addaction name="actionSimulationView"/>
<addaction name="separator"/> <addaction name="separator"/>
...@@ -466,7 +467,7 @@ ...@@ -466,7 +467,7 @@
<string>Open the simulation view</string> <string>Open the simulation view</string>
</property> </property>
</action> </action>
<action name="actionConfiguration_2"> <action name="actionHardwareConfig">
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
...@@ -475,7 +476,7 @@ ...@@ -475,7 +476,7 @@
<normaloff>:/files/images/categories/preferences-system.svg</normaloff>:/files/images/categories/preferences-system.svg</iconset> <normaloff>:/files/images/categories/preferences-system.svg</normaloff>:/files/images/categories/preferences-system.svg</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Config</string> <string>Hardware</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Configuration options of the vehicle.</string> <string>Configuration options of the vehicle.</string>
...@@ -494,6 +495,11 @@ ...@@ -494,6 +495,11 @@
<string>Simulation</string> <string>Simulation</string>
</property> </property>
</action> </action>
<action name="actionSoftwareConfig">
<property name="text">
<string>Software</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>
......
...@@ -1017,6 +1017,11 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant ...@@ -1017,6 +1017,11 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant
statusLabel->setText(tr("REJ. %1 > max").arg(value.toDouble())); statusLabel->setText(tr("REJ. %1 > max").arg(value.toDouble()));
return; return;
} }
if (parameters.value(component)->value(parameterName) == value)
{
statusLabel->setText(tr("REJ. %1 > max").arg(value.toDouble()));
return;
}
switch (parameters.value(component)->value(parameterName).type()) switch (parameters.value(component)->value(parameterName).type())
{ {
......
#include "AP2ConfigWidget.h"
AP2ConfigWidget::AP2ConfigWidget(QWidget *parent) : QWidget(parent)
{
m_uas = 0;
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
activeUASSet(UASManager::instance()->getActiveUAS());
}
void AP2ConfigWidget::activeUASSet(UASInterface *uas)
{
if (!uas) return;
if (m_uas)
{
disconnect(m_uas,SIGNAL(parameterChanged(int,int,QString,QVariant)),this,SLOT(parameterChanged(int,int,QString,QVariant)));
}
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)
{
}
#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;
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) : QWidget(parent)
{
m_uas=0;
ui.setupUi(this);
connect(ui.calibrateAccelButton,SIGNAL(clicked()),this,SLOT(calibrateButtonClicked()));
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
activeUASSet(UASManager::instance()->getActiveUAS());
accelAckCount=0;
}
AccelCalibrationConfig::~AccelCalibrationConfig()
{
}
void AccelCalibrationConfig::activeUASSet(UASInterface *uas)
{
if (!uas)
{
return;
}
if (m_uas)
{
}
m_uas = uas;
connect(m_uas,SIGNAL(textMessageReceived(int,int,int,QString)),this,SLOT(uasTextMessageReceived(int,int,int,QString)));
}
void AccelCalibrationConfig::calibrateButtonClicked()
{
if (accelAckCount == 0)
{
MAV_CMD command = MAV_CMD_PREFLIGHT_CALIBRATION;
int confirm = 0;
float param1 = 0;
float param2 = 0;
float param3 = 0;
float param4 = 0;
float param5 = 1;
float param6 = 0;
float param7 = 0;
int component = 1;
m_uas->executeCommand(command, confirm, param1, param2, param3, param4, param5, param6, param7, component);
}
else if (accelAckCount <= 5)
{
m_uas->executeCommandAck(accelAckCount++,true);
}
else
{
m_uas->executeCommandAck(accelAckCount++,true);
ui.calibrateAccelButton->setText("Calibrate\nAccelerometer");
//accelAckCount = 0;
}
}
void AccelCalibrationConfig::uasTextMessageReceived(int uasid, int componentid, int severity, QString text)
{
//command received: " Severity 1
//Place APM Level and press any key" severity 5
if (severity == 5)
{
//This is a calibration instruction
if (accelAckCount == 0)
{
//Calibration Sucessful\r"
ui.calibrateAccelButton->setText("Any\nKey");
accelAckCount++;
}
if (accelAckCount == 7)
{
//All finished
//ui.outputLabel->setText(ui.outputLabel->text() + "\n" + text);
ui.outputLabel->setText(text);
accelAckCount++;
}
if (accelAckCount == 8)
{
if (text.contains("Calibration") && text.contains("successful"))
{
accelAckCount = 0;
}
ui.outputLabel->setText(ui.outputLabel->text() + "\n" + text);
}
else
{
ui.outputLabel->setText(text);
}
}
}
#ifndef ACCELCALIBRATIONCONFIG_H
#define ACCELCALIBRATIONCONFIG_H
#include <QWidget>
#include "ui_AccelCalibrationConfig.h"
#include "UASManager.h"
#include "UASInterface.h"
class AccelCalibrationConfig : public QWidget
{
Q_OBJECT
public:
explicit AccelCalibrationConfig(QWidget *parent = 0);
~AccelCalibrationConfig();
private slots:
void activeUASSet(UASInterface *uas);
void calibrateButtonClicked();
void uasTextMessageReceived(int uasid, int componentid, int severity, QString text);
private:
int accelAckCount;
Ui::AccelCalibrationConfig ui;
UASInterface *m_uas;
};
#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>81</width>
<height>31</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>211</width>
<height>91</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
#include "AdvancedParamConfig.h"
AdvancedParamConfig::AdvancedParamConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
}
AdvancedParamConfig::~AdvancedParamConfig()
{
}
#ifndef ADVANCEDPARAMCONFIG_H
#define ADVANCEDPARAMCONFIG_H
#include <QWidget>
#include "ui_AdvancedParamConfig.h"
class AdvancedParamConfig : public QWidget
{
Q_OBJECT
public:
explicit AdvancedParamConfig(QWidget *parent = 0);
~AdvancedParamConfig();
private:
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>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>181</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Advanced Params&lt;/h2&gt;</string>
</property>
</widget>
</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)));
}
AirspeedConfig::~AirspeedConfig()
{
}
void AirspeedConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
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)
{
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
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)
{
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
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>
/*=====================================================================
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.firmwareButton->setVisible(valse);
ui.manditoryHardware->setVisible(false);
ui.frameTypeButton->setVisible(false);
ui.compassButton->setVisible(false);
ui.accelCalibrateButton->setVisible(false);
ui.radioCalibrateButton->setVisible(false);
ui.optionalHardwareButton->setVisible(false);
//ui.radio3DRButton->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);
//ui.antennaTrackerButton->setVisible(false);
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.frameTypeButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.compassButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.accelCalibrateButton,SLOT(setShown(bool)));
connect(ui.manditoryHardware,SIGNAL(toggled(bool)),ui.radioCalibrateButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.radio3DRButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.batteryMonitorButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.sonarButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.airspeedButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.opticalFlowButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.osdButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.cameraGimbalButton,SLOT(setShown(bool)));
connect(ui.optionalHardwareButton,SIGNAL(toggled(bool)),ui.antennaTrackerButton,SLOT(setShown(bool)));
connect(ui.frameTypeButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
QWidget *widget = new QWidget(this);
ui.stackedWidget->addWidget(widget); //Firmware placeholder.
buttonToConfigWidgetMap[ui.firmwareButton] = widget;
connect(ui.firmwareButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
frameConfig = new FrameTypeConfig(this);
ui.stackedWidget->addWidget(frameConfig);
buttonToConfigWidgetMap[ui.frameTypeButton] = frameConfig;
connect(ui.frameTypeButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
compassConfig = new CompassConfig(this);
ui.stackedWidget->addWidget(compassConfig);
buttonToConfigWidgetMap[ui.compassButton] = compassConfig;
connect(ui.compassButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
accelConfig = new AccelCalibrationConfig(this);
ui.stackedWidget->addWidget(accelConfig);
buttonToConfigWidgetMap[ui.accelCalibrateButton] = accelConfig;
connect(ui.accelCalibrateButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
radioConfig = new RadioCalibrationConfig(this);
ui.stackedWidget->addWidget(radioConfig);
buttonToConfigWidgetMap[ui.radioCalibrateButton] = radioConfig;
connect(ui.radioCalibrateButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
radio3drConfig = new Radio3DRConfig(this);
ui.stackedWidget->addWidget(radio3drConfig);
buttonToConfigWidgetMap[ui.radio3DRButton] = radio3drConfig;
connect(ui.radio3DRButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
batteryConfig = new BatteryMonitorConfig(this);
ui.stackedWidget->addWidget(batteryConfig);
buttonToConfigWidgetMap[ui.batteryMonitorButton] = batteryConfig;
connect(ui.batteryMonitorButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
sonarConfig = new SonarConfig(this);
ui.stackedWidget->addWidget(sonarConfig);
buttonToConfigWidgetMap[ui.sonarButton] = sonarConfig;
connect(ui.sonarButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
airspeedConfig = new AirspeedConfig(this);
ui.stackedWidget->addWidget(airspeedConfig);
buttonToConfigWidgetMap[ui.airspeedButton] = airspeedConfig;
connect(ui.airspeedButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
opticalFlowConfig = new OpticalFlowConfig(this);
ui.stackedWidget->addWidget(opticalFlowConfig);
buttonToConfigWidgetMap[ui.opticalFlowButton] = opticalFlowConfig;
connect(ui.opticalFlowButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
osdConfig = new OsdConfig(this);
ui.stackedWidget->addWidget(osdConfig);
buttonToConfigWidgetMap[ui.osdButton] = osdConfig;
connect(ui.osdButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
cameraGimbalConfig = new CameraGimbalConfig(this);
ui.stackedWidget->addWidget(cameraGimbalConfig);
buttonToConfigWidgetMap[ui.cameraGimbalButton] = cameraGimbalConfig;
connect(ui.cameraGimbalButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
antennaTrackerConfig = new AntennaTrackerConfig(this);
ui.stackedWidget->addWidget(antennaTrackerConfig);
buttonToConfigWidgetMap[ui.antennaTrackerButton] = 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 (buttonToConfigWidgetMap.contains(sender()))
{
ui.stackedWidget->setCurrentWidget(buttonToConfigWidgetMap[sender()]);
}
}
ApmHardwareConfig::~ApmHardwareConfig()
{
}
void ApmHardwareConfig::activeUASSet(UASInterface *uas)
{
if (!uas)
{
return;
}
ui.firmwareButton->setVisible(true);
ui.manditoryHardware->setVisible(true);
ui.manditoryHardware->setChecked(false);
ui.optionalHardwareButton->setVisible(true);
ui.optionalHardwareButton->setChecked(false);
ui.radio3DRButton->setVisible(false);
ui.antennaTrackerButton->setVisible(false);
}
/*=====================================================================
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"
class ApmHardwareConfig : public QWidget
{
Q_OBJECT
public:
explicit ApmHardwareConfig(QWidget *parent = 0);
~ApmHardwareConfig();
private:
FrameTypeConfig *frameConfig;
CompassConfig *compassConfig;
AccelCalibrationConfig *accelConfig;
RadioCalibrationConfig *radioConfig;
Radio3DRConfig *radio3drConfig;
BatteryMonitorConfig *batteryConfig;
SonarConfig *sonarConfig;
AirspeedConfig *airspeedConfig;
OpticalFlowConfig *opticalFlowConfig;
OsdConfig *osdConfig;
CameraGimbalConfig *cameraGimbalConfig;
AntennaTrackerConfig *antennaTrackerConfig;
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*> 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>635</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="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 "ApmSoftwareConfig.h"
ApmSoftwareConfig::ApmSoftwareConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
ui.basicPidsButton->setVisible(false);
ui.flightModesButton->setVisible(false);
ui.standardParamButton->setVisible(false);
ui.geoFenceButton->setVisible(false);
ui.failSafeButton->setVisible(false);
ui.advancedParamButton->setVisible(false);
ui.advParamListButton->setVisible(false);
ui.arduCoperPidButton->setVisible(false);
basicPidConfig = new BasicPidConfig(this);
ui.stackedWidget->addWidget(basicPidConfig);
buttonToConfigWidgetMap[ui.basicPidsButton] = basicPidConfig;
connect(ui.basicPidsButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
flightConfig = new FlightModeConfig(this);
ui.stackedWidget->addWidget(flightConfig);
buttonToConfigWidgetMap[ui.flightModesButton] = flightConfig;
connect(ui.flightModesButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
standardParamConfig = new StandardParamConfig(this);
ui.stackedWidget->addWidget(standardParamConfig);
buttonToConfigWidgetMap[ui.standardParamButton] = standardParamConfig;
connect(ui.standardParamButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
geoFenceConfig = new GeoFenceConfig(this);
ui.stackedWidget->addWidget(geoFenceConfig);
buttonToConfigWidgetMap[ui.geoFenceButton] = geoFenceConfig;
connect(ui.geoFenceButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
failSafeConfig = new FailSafeConfig(this);
ui.stackedWidget->addWidget(failSafeConfig);
buttonToConfigWidgetMap[ui.failSafeButton] = failSafeConfig;
connect(ui.failSafeButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
advancedParamConfig = new AdvancedParamConfig(this);
ui.stackedWidget->addWidget(advancedParamConfig);
buttonToConfigWidgetMap[ui.advancedParamButton] = advancedParamConfig;
connect(ui.advancedParamButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
arduCoperPidConfig = new ArduCopterPidConfig(this);
ui.stackedWidget->addWidget(arduCoperPidConfig);
buttonToConfigWidgetMap[ui.arduCoperPidButton] = arduCoperPidConfig;
connect(ui.arduCoperPidButton,SIGNAL(clicked()),this,SLOT(activateStackedWidget()));
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
if (UASManager::instance()->getActiveUAS())
{
activeUASSet(UASManager::instance()->getActiveUAS());
}
}
ApmSoftwareConfig::~ApmSoftwareConfig()
{
}
void ApmSoftwareConfig::activateStackedWidget()
{
if (buttonToConfigWidgetMap.contains(sender()))
{
ui.stackedWidget->setCurrentWidget(buttonToConfigWidgetMap[sender()]);
}
}
void ApmSoftwareConfig::activeUASSet(UASInterface *uas)
{
if (!uas)
{
return;
}
ui.basicPidsButton->setVisible(true);
ui.flightModesButton->setVisible(true);
ui.standardParamButton->setVisible(true);
ui.geoFenceButton->setVisible(true);
ui.failSafeButton->setVisible(true);
ui.advancedParamButton->setVisible(true);
ui.advParamListButton->setVisible(true);
ui.arduCoperPidButton->setVisible(true);
}
#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 "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;
BasicPidConfig *basicPidConfig;
FlightModeConfig *flightConfig;
StandardParamConfig *standardParamConfig;
GeoFenceConfig *geoFenceConfig;
FailSafeConfig *failSafeConfig;
AdvancedParamConfig *advancedParamConfig;
ArduCopterPidConfig *arduCoperPidConfig;
QMap<QObject*,QWidget*> buttonToConfigWidgetMap;
};
#endif // APMSOFTWARECONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ApmSoftwareConfig</class>
<widget class="QWidget" name="ApmSoftwareConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>718</width>
<height>531</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QScrollArea" name="scrollArea_6">
<property name="geometry">
<rect>
<x>20</x>
<y>10</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>173</width>
<height>529</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="plannerConfigButton">
<property name="minimumSize">
<size>
<width>100</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>APM Planner 2.0 Config</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="basicPidsButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Basic Pids</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="flightModesButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Flight Modes</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="standardParamButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Standard Params</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="geoFenceButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>GeoFence</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="failSafeButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>FailSafe</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="advancedParamButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Advanced Params</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="advParamListButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Adv Parameter List</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="arduCoperPidButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>ArduCoper Pids</string>
</property>
<property name="checkable">
<bool>false</bool>
</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>220</x>
<y>20</y>
<width>471</width>
<height>491</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
#include "ArduCopterPidConfig.h"
#include "ui_ArduCopterPidConfig.h"
ArduCopterPidConfig::ArduCopterPidConfig(QWidget *parent) :
QWidget(parent),
ui(new Ui::ArduCopterPidConfig)
{
ui->setupUi(this);
}
ArduCopterPidConfig::~ArduCopterPidConfig()
{
delete ui;
}
#ifndef ARDUCOPTERPIDCONFIG_H
#define ARDUCOPTERPIDCONFIG_H
#include <QWidget>
namespace Ui {
class ArduCopterPidConfig;
}
class ArduCopterPidConfig : public QWidget
{
Q_OBJECT
public:
explicit ArduCopterPidConfig(QWidget *parent = 0);
~ArduCopterPidConfig();
private:
Ui::ArduCopterPidConfig *ui;
};
#endif // ARDUCOPTERPIDCONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ArduCopterPidConfig</class>
<widget class="QWidget" name="ArduCopterPidConfig">
<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>10</y>
<width>181</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;ArduCopter Pids&lt;/h2&gt;</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
#include "BasicPidConfig.h"
BasicPidConfig::BasicPidConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
}
BasicPidConfig::~BasicPidConfig()
{
}
#ifndef BASICPIDCONFIG_H
#define BASICPIDCONFIG_H
#include <QWidget>
#include "ui_BasicPidConfig.h"
class BasicPidConfig : public QWidget
{
Q_OBJECT
public:
explicit BasicPidConfig(QWidget *parent = 0);
~BasicPidConfig();
private:
Ui::BasicPidConfig ui;
};
#endif // BASICPIDCONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BasicPidConfig</class>
<widget class="QWidget" name="BasicPidConfig">
<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>30</x>
<y>20</y>
<width>141</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt; Basic Pids&lt;/h2&gt;</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
#include "BatteryMonitorConfig.h"
#include <QMessageBox>
BatteryMonitorConfig::BatteryMonitorConfig(QWidget *parent) : AP2ConfigWidget(parent)
{
ui.setupUi(this);
ui.monitorComboBox->addItem("0: Disabled");
ui.monitorComboBox->addItem("3: Battery Volts");
ui.monitorComboBox->addItem("4: Voltage and Current");
ui.sensorComboBox->addItem("0: Other");
ui.sensorComboBox->addItem("1: AttoPilot 45A");
ui.sensorComboBox->addItem("2: AttoPilot 90A");
ui.sensorComboBox->addItem("3: AttoPilot 180A");
ui.sensorComboBox->addItem("4: 3DR Power Module");
ui.apmVerComboBox->addItem("0: APM1");
ui.apmVerComboBox->addItem("1: APM2 - 2.5 non 3DR");
ui.apmVerComboBox->addItem("2: APM2.5 - 3DR Power Module");
ui.apmVerComboBox->addItem("3: PX4");
ui.alertOnLowCheckBox->setVisible(false);
connect(ui.monitorComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(monitorCurrentIndexChanged(int)));
connect(ui.sensorComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(sensorCurrentIndexChanged(int)));
connect(ui.apmVerComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(apmVerCurrentIndexChanged(int)));
connect(ui.calcDividerLineEdit,SIGNAL(editingFinished()),this,SLOT(calcDividerSet()));
connect(ui.ampsPerVoltsLineEdit,SIGNAL(editingFinished()),this,SLOT(ampsPerVoltSet()));
connect(ui.battCapacityLineEdit,SIGNAL(editingFinished()),this,SLOT(batteryCapacitySet()));
}
void BatteryMonitorConfig::calcDividerSet()
{
if (!m_uas)
{
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
return;
}
bool ok = false;
float newval = ui.calcDividerLineEdit->text().toFloat(&ok);
if (!ok)
{
//Error parsing;
QMessageBox::information(0,"Error","Invalid number entered for voltage divider. Please try again");
return;
}
m_uas->getParamManager()->setParameter(1,"VOLT_DIVIDER",newval);
}
void BatteryMonitorConfig::ampsPerVoltSet()
{
if (!m_uas)
{
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
return;
}
bool ok = false;
float newval = ui.ampsPerVoltsLineEdit->text().toFloat(&ok);
if (!ok)
{
//Error parsing;
QMessageBox::information(0,"Error","Invalid number entered for amps per volts. Please try again");
return;
}
m_uas->getParamManager()->setParameter(1,"AMPS_PER_VOLT",newval);
}
void BatteryMonitorConfig::batteryCapacitySet()
{
if (!m_uas)
{
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
return;
}
bool ok = false;
float newval = ui.battCapacityLineEdit->text().toFloat(&ok);
if (!ok)
{
//Error parsing;
QMessageBox::information(0,"Error","Invalid number entered for amps per volts. Please try again");
return;
}
m_uas->getParamManager()->setParameter(1,"BATT_CAPACITY",newval);
}
void BatteryMonitorConfig::monitorCurrentIndexChanged(int index)
{
if (!m_uas)
{
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
return;
}
if (index == 0)
{
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",-1);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",-1);
m_uas->getParamManager()->setParameter(1,"BATT_MONITOR",0);
ui.sensorComboBox->setEnabled(false);
ui.apmVerComboBox->setEnabled(false);
ui.measuredVoltsLineEdit->setEnabled(false);
ui.measuredVoltsLineEdit->setEnabled(false);
ui.calcDividerLineEdit->setEnabled(false);
ui.calcVoltsLineEdit->setEnabled(false);
ui.ampsPerVoltsLineEdit->setEnabled(false);
}
else if (index == 1)
{
m_uas->getParamManager()->setParameter(1,"BATT_MONITOR",3);
ui.sensorComboBox->setEnabled(false);
ui.apmVerComboBox->setEnabled(true);
ui.measuredVoltsLineEdit->setEnabled(true);
ui.calcDividerLineEdit->setEnabled(true);
ui.calcVoltsLineEdit->setEnabled(false);
ui.ampsPerVoltsLineEdit->setEnabled(false);
}
else if (index == 2)
{
m_uas->getParamManager()->setParameter(1,"BATT_MONITOR",4);
ui.sensorComboBox->setEnabled(true);
ui.apmVerComboBox->setEnabled(true);
ui.measuredVoltsLineEdit->setEnabled(true);
ui.calcDividerLineEdit->setEnabled(true);
ui.calcVoltsLineEdit->setEnabled(false);
ui.ampsPerVoltsLineEdit->setEnabled(true);
}
}
void BatteryMonitorConfig::sensorCurrentIndexChanged(int index)
{
float maxvolt = 0;
float maxamps = 0;
float mvpervolt = 0;
float mvperamp = 0;
float topvolt = 0;
float topamps = 0;
if (index == 1)
{
//atto 45
maxvolt = 13.6;
maxamps = 44.7;
mvpervolt = 242.3;
mvperamp = 73.20;
}
else if (index == 2)
{
//atto 90
maxvolt = 50;
maxamps = 89.4;
mvpervolt = 63.69;
mvperamp = 36.60;
}
else if (index == 3)
{
//atto 180
maxvolt = 50;
maxamps = 178.8;
mvpervolt = 63.69;
mvperamp = 18.30;
}
else if (index == 4)
{
//3dr
maxvolt = 50;
maxamps = 90;
mvpervolt = 100;
mvperamp = 55.55;
}
if (index == 0)
{
//Other
ui.ampsPerVoltsLineEdit->setEnabled(true);
ui.calcDividerLineEdit->setEnabled(true);
ui.measuredVoltsLineEdit->setEnabled(true);
}
else
{
topvolt = (maxvolt * mvpervolt) / 1000.0;
topamps = (maxamps * mvperamp) / 1000.0;
ui.calcDividerLineEdit->setText(QString::number(maxvolt/topvolt));
ui.ampsPerVoltsLineEdit->setText(QString::number(maxamps / topamps));
ui.ampsPerVoltsLineEdit->setEnabled(false);
ui.calcDividerLineEdit->setEnabled(false);
ui.measuredVoltsLineEdit->setEnabled(false);
}
}
void BatteryMonitorConfig::apmVerCurrentIndexChanged(int index)
{
if (!m_uas)
{
QMessageBox::information(0,tr("Error"),tr("Please connect to a MAV before attempting to set configuration"));
return;
}
if (index == 0) //APM1
{
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",0);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",1);
}
else if (index == 1) //APM2
{
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",1);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",2);
}
else if (index == 2) //APM2.5
{
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",13);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",12);
}
else if (index == 3) //PX4
{
m_uas->getParamManager()->setParameter(1,"BATT_VOLT_PIN",100);
m_uas->getParamManager()->setParameter(1,"BATT_CURR_PIN",101);
m_uas->getParamManager()->setParameter(1,"VOLT_DIVIDER",1);
ui.calcDividerLineEdit->setText("1");
}
}
BatteryMonitorConfig::~BatteryMonitorConfig()
{
}
void BatteryMonitorConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (parameterName == "VOLT_DIVIDER")
{
ui.calcDividerLineEdit->setText(QString::number(value.toFloat(),'f',4));
}
else if (parameterName == "AMP_PER_VOLT")
{
ui.ampsPerVoltsLineEdit->setText(QString::number(value.toFloat(),'g',2));
}
else if (parameterName == "BATT_MONITOR")
{
if (value.toInt() == 0) //0: Disable
{
ui.monitorComboBox->setCurrentIndex(0);
}
else if (value.toInt() == 3) //3: Battery volts
{
ui.monitorComboBox->setCurrentIndex(1);
}
else if (value.toInt() == 4) //4: Voltage and Current
{
ui.monitorComboBox->setCurrentIndex(2);
}
}
else if (parameterName == "BATT_CAPACITY")
{
ui.battCapacityLineEdit->setText(QString::number(value.toFloat()));
}
else if (parameterName == "BATT_VOLT_PIN")
{
int ivalue = value.toInt();
if (ivalue == 0) //APM1
{
ui.apmVerComboBox->setCurrentIndex(0);
}
else if (ivalue == 1) //APM2
{
ui.apmVerComboBox->setCurrentIndex(1);
}
else if (ivalue == 13) //APM2.5
{
ui.apmVerComboBox->setCurrentIndex(2);
}
else if (ivalue == 100) //PX4
{
ui.apmVerComboBox->setCurrentIndex(3);
}
}
else if (parameterName == "BATT_CURR_PIN")
{
//Unused at the moment, everything is off BATT_VOLT_PIN
}
}
#ifndef BATTERYMONITORCONFIG_H
#define BATTERYMONITORCONFIG_H
#include <QWidget>
#include "AP2ConfigWidget.h"
#include "ui_BatteryMonitorConfig.h"
class BatteryMonitorConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit BatteryMonitorConfig(QWidget *parent = 0);
~BatteryMonitorConfig();
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void monitorCurrentIndexChanged(int index);
void sensorCurrentIndexChanged(int index);
void apmVerCurrentIndexChanged(int index);
void calcDividerSet();
void ampsPerVoltSet();
void batteryCapacitySet();
private:
Ui::BatteryMonitorConfig ui;
};
#endif // BATTERYMONITORCONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BatteryMonitorConfig</class>
<widget class="QWidget" name="BatteryMonitorConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>745</width>
<height>494</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>141</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Battery Monitor&lt;/h2&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../qgroundcontrol.qrc">:/files/images/devices/BR-APMPWRDEAN-2.jpg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="alertOnLowCheckBox">
<property name="geometry">
<rect>
<x>480</x>
<y>120</y>
<width>70</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>160</x>
<y>170</y>
<width>241</width>
<height>141</height>
</rect>
</property>
<property name="title">
<string>Calibration</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>1. Measured battery voltage:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>2. Battery voltage (Calc'ed):</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>3. Voltage divider (Calc'ed):</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>4. Amperes per volt:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="measuredVoltsLineEdit">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="calcVoltsLineEdit">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="calcDividerLineEdit">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="ampsPerVoltsLineEdit">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_2">
<property name="geometry">
<rect>
<x>160</x>
<y>70</y>
<width>281</width>
<height>80</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Monitor</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Sensor</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>APM Version</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QComboBox" name="monitorComboBox"/>
</item>
<item>
<widget class="QComboBox" name="sensorComboBox"/>
</item>
<item>
<widget class="QComboBox" name="apmVerComboBox"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_3">
<property name="geometry">
<rect>
<x>470</x>
<y>70</y>
<width>195</width>
<height>41</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>Battery Capacity:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="battCapacityLineEdit"/>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>mAh</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="../../../qgroundcontrol.qrc"/>
</resources>
<connections/>
</ui>
This diff is collapsed.
#ifndef CAMERAGIMBALCONFIG_H
#define CAMERAGIMBALCONFIG_H
#include <QWidget>
#include "AP2ConfigWidget.h"
#include "ui_CameraGimbalConfig.h"
class CameraGimbalConfig : public AP2ConfigWidget
{
Q_OBJECT
public:
explicit CameraGimbalConfig(QWidget *parent = 0);
~CameraGimbalConfig();
private slots:
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void updateTilt();
void updateRoll();
void updatePan();
void updateShutter();
private:
Ui::CameraGimbalConfig ui;
QString shutterPrefix;
QString rollPrefix;
QString tiltPrefix;
QString panPrefix;
};
#endif // CAMERAGIMBALCONFIG_H
This diff is collapsed.
#include "CompassConfig.h"
CompassConfig::CompassConfig(QWidget *parent) : QWidget(parent)
{
m_uas=0;
ui.setupUi(this);
ui.autoDecCheckBox->setEnabled(false);
ui.enableCheckBox->setEnabled(false);
ui.orientationComboBox->setEnabled(false);
ui.declinationLineEdit->setEnabled(false);
connect(ui.enableCheckBox,SIGNAL(clicked(bool)),this,SLOT(enableClicked(bool)));
connect(ui.autoDecCheckBox,SIGNAL(clicked(bool)),this,SLOT(autoDecClicked(bool)));
connect(ui.orientationComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(orientationComboChanged(int)));
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
activeUASSet(UASManager::instance()->getActiveUAS());
}
CompassConfig::~CompassConfig()
{
}
void CompassConfig::activeUASSet(UASInterface *uas)
{
if (!uas) return;
if (!m_uas)
{
disconnect(m_uas,SIGNAL(parameterChanged(int,int,QString,QVariant)),this,SLOT(parameterChanged(int,int,QString,QVariant)));
}
m_uas = uas;
connect(m_uas,SIGNAL(parameterChanged(int,int,QString,QVariant)),this,SLOT(parameterChanged(int,int,QString,QVariant)));
}
void CompassConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (parameterName == "MAG_ENABLE")
{
if (value.toInt() == 0)
{
ui.enableCheckBox->setChecked(false);
ui.autoDecCheckBox->setEnabled(false);
ui.declinationLineEdit->setEnabled(false);
}
else
{
ui.enableCheckBox->setChecked(true);
ui.autoDecCheckBox->setEnabled(true);
ui.declinationLineEdit->setEnabled(true);
}
ui.enableCheckBox->setEnabled(true);
}
else if (parameterName == "COMPASS_AUTODEC")
{
if (value.toInt() == 0)
{
ui.autoDecCheckBox->setChecked(false);
}
else
{
ui.autoDecCheckBox->setChecked(true);
}
}
else if (parameterName == "COMPASS_DEC")
{
ui.declinationLineEdit->setText(QString::number(value.toDouble()));
}
}
void CompassConfig::enableClicked(bool enabled)
{
if (m_uas)
{
if (enabled)
{
m_uas->getParamManager()->setParameter(1,"MAG_ENABLE",QVariant(1));
ui.autoDecCheckBox->setEnabled(true);
if (!ui.autoDecCheckBox->isChecked())
{
ui.declinationLineEdit->setEnabled(true);
}
}
else
{
m_uas->getParamManager()->setParameter(1,"MAG_ENABLE",QVariant(0));
ui.autoDecCheckBox->setEnabled(false);
ui.declinationLineEdit->setEnabled(false);
}
}
}
void CompassConfig::autoDecClicked(bool enabled)
{
if (m_uas)
{
if (enabled)
{
m_uas->getParamManager()->setParameter(1,"COMPASS_AUTODEC",QVariant(1));
}
else
{
m_uas->getParamManager()->setParameter(1,"COMPASS_AUTODEC",QVariant(0));
}
}
}
void CompassConfig::orientationComboChanged(int index)
{
}
#ifndef COMPASSCONFIG_H
#define COMPASSCONFIG_H
#include <QWidget>
#include "ui_CompassConfig.h"
#include "UASManager.h"
#include "UASInterface.h"
class CompassConfig : public QWidget
{
Q_OBJECT
public:
explicit CompassConfig(QWidget *parent = 0);
~CompassConfig();
private slots:
void activeUASSet(UASInterface *uas);
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
void enableClicked(bool enabled);
void autoDecClicked(bool enabled);
void orientationComboChanged(int index);
private:
Ui::CompassConfig ui;
UASInterface *m_uas;
};
#endif // COMPASSCONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CompassConfig</class>
<widget class="QWidget" name="CompassConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>565</width>
<height>241</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>521</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Compass&lt;/h2&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>230</x>
<y>100</y>
<width>101</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>&lt;a href=&quot;http://magnetic-declination.com/&quot;&gt;Declination Website&lt;/a&gt;</string>
</property>
</widget>
<widget class="QComboBox" name="orientationComboBox">
<property name="geometry">
<rect>
<x>280</x>
<y>120</y>
<width>201</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>300</x>
<y>180</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Live Calibration</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>390</x>
<y>180</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Log Calibration</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>340</x>
<y>160</y>
<width>91</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Advanced Config </string>
</property>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_2">
<property name="geometry">
<rect>
<x>220</x>
<y>70</y>
<width>321</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="declinationLineEdit"/>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>in Degrees eg 2* 3' W is -2.3</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>201</width>
<height>111</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="maximumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../qgroundcontrol.qrc">:/files/images/devices/BR-HMC5883-01-2.jpg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="enableCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoDecCheckBox">
<property name="text">
<string>Auto Declination</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 class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>220</x>
<y>120</y>
<width>54</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Orientation</string>
</property>
</widget>
</widget>
<resources>
<include location="../../../qgroundcontrol.qrc"/>
</resources>
<connections/>
</ui>
#include "FailSafeConfig.h"
FailSafeConfig::FailSafeConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
}
FailSafeConfig::~FailSafeConfig()
{
}
#ifndef FAILSAFECONFIG_H
#define FAILSAFECONFIG_H
#include <QWidget>
#include "ui_FailSafeConfig.h"
class FailSafeConfig : public QWidget
{
Q_OBJECT
public:
explicit FailSafeConfig(QWidget *parent = 0);
~FailSafeConfig();
private:
Ui::FailSafeConfig ui;
};
#endif // FAILSAFECONFIG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FailSafeConfig</class>
<widget class="QWidget" name="FailSafeConfig">
<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>141</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;h2&gt;Fail Safe&lt;/h2&gt;</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
This diff is collapsed.
#ifndef FLIGHTMODECONFIG_H
#define FLIGHTMODECONFIG_H
#include <QWidget>
#include "ui_FlightModeConfig.h"
#include "UASInterface.h"
#include "UASManager.h"
class FlightModeConfig : public QWidget
{
Q_OBJECT
public:
explicit FlightModeConfig(QWidget *parent = 0);
~FlightModeConfig();
private slots:
void setActiveUAS(UASInterface *uas);
void saveButtonClicked();
void modeChanged(int sysId, QString status, QString description);
void remoteControlChannelRawChanged(int chan,float val);
void parameterChanged(int uas, int component, QString parameterName, QVariant value);
private:
QMap<int,int> roverModeIndexToUiIndex;
QMap<int,int> planeModeIndexToUiIndex;
QMap<int,int> roverModeUiIndexToIndex;
QMap<int,int> planeModeUiIndexToIndex;
Ui::FlightModeConfig ui;
UASInterface *m_uas;
};
#endif // FLIGHTMODECONFIG_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 Airframe type configuration widget source.
*
* @author Michael Carpenter <malcom2073@gmail.com>
*
*/
#include "FrameTypeConfig.h"
FrameTypeConfig::FrameTypeConfig(QWidget *parent) : QWidget(parent)
{
m_uas=0;
ui.setupUi(this);
//Disable until we get a FRAME parameter.
ui.xRadioButton->setEnabled(false);
ui.vRadioButton->setEnabled(false);
ui.plusRadioButton->setEnabled(false);
connect(ui.plusRadioButton,SIGNAL(clicked()),this,SLOT(plusFrameSelected()));
connect(ui.xRadioButton,SIGNAL(clicked()),this,SLOT(xFrameSelected()));
connect(ui.vRadioButton,SIGNAL(clicked()),this,SLOT(vFrameSelected()));
connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*)));
activeUASSet(UASManager::instance()->getActiveUAS());
}
FrameTypeConfig::~FrameTypeConfig()
{
}
void FrameTypeConfig::activeUASSet(UASInterface *uas)
{
if (!uas) return;
if (!m_uas)
{
disconnect(m_uas,SIGNAL(parameterChanged(int,int,QString,QVariant)),this,SLOT(parameterChanged(int,int,QString,QVariant)));
}
m_uas = uas;
connect(m_uas,SIGNAL(parameterChanged(int,int,QString,QVariant)),this,SLOT(parameterChanged(int,int,QString,QVariant)));
}
void FrameTypeConfig::parameterChanged(int uas, int component, QString parameterName, QVariant value)
{
if (parameterName == "FRAME")
{
ui.xRadioButton->setEnabled(true);
ui.vRadioButton->setEnabled(true);
ui.plusRadioButton->setEnabled(true);
if (value.toInt() == 0)
{
ui.plusRadioButton->setChecked(true);
}
else if (value.toInt() == 1)
{
ui.xRadioButton->setChecked(true);
}
else if (value.toInt() == 2)
{
ui.vRadioButton->setChecked(true);
}
}
}
void FrameTypeConfig::xFrameSelected()
{
if (m_uas)
{
m_uas->getParamManager()->setParameter(1,"FRAME",QVariant(1));
}
}
void FrameTypeConfig::plusFrameSelected()
{
if (m_uas)
{
m_uas->getParamManager()->setParameter(1,"FRAME",QVariant(0));
}
}
void FrameTypeConfig::vFrameSelected()
{
if (m_uas)
{
m_uas->getParamManager()->setParameter(1,"FRAME",QVariant(2));
}
}
This diff is collapsed.
This diff is collapsed.
#include "GeoFenceConfig.h"
GeoFenceConfig::GeoFenceConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
}
GeoFenceConfig::~GeoFenceConfig()
{
}
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.
#include "Radio3DRConfig.h"
Radio3DRConfig::Radio3DRConfig(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
}
Radio3DRConfig::~Radio3DRConfig()
{
}
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