Commit 1665245a authored by Lorenz Meier's avatar Lorenz Meier

Merge branch 'config' of github.com:mavlink/qgroundcontrol into config

parents e6350560 94fcdaa3
......@@ -52,5 +52,7 @@ user_config.pri
thirdParty/qserialport-build-desktop/
thirdParty/qserialport/bin/
thirdParty/qserialport/lib/
apmplanner2.xcodeproj/
GeneratedFiles/
/qupgrade/
*.autosave
......@@ -58,4 +58,16 @@ QGC_TOOL_WIDGET_ITEMS\5\QGC_COMMAND_BUTTON_PARAM4=1
QGC_TOOL_WIDGET_ITEMS\5\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\5\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\5\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\size=5
QGC_TOOL_WIDGET_ITEMS\6\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_DESCRIPTION=Reboot to Bootloader
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_BUTTONTEXT=BOOTLOADER
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_COMMANDID=246
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM1=3
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\6\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\size=7
......@@ -248,6 +248,31 @@ QLabel#noUas {
font-size: 30pt;
}
QMessageBox QLabel {
font-size: 14pt;
}
QMessageBox {
min-width: 400px;
min-height: 300px;
}
QLabel#calibrationExplanationLabel {
font-size: 20pt;
}
QLabel#tabTitleLabel {
font-size: 28pt;
font-weight: lighter;
margin-top: 16px;
margin-bottom: 8px;
}
QLabel#instructionLabel {
color: #FEC654;
font-size: 26pt;
}
QLineEdit {
border: 1px solid #777;
border-radius: 2px;
......@@ -345,6 +370,34 @@ QPushButton, QToolButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777, stop: 1 #333);
}
QPushButton#advancedMenuButton, QPushButton#airframeMenuButton, QPushButton#firmwareMenuButton,
QPushButton#generalMenuButton, QPushButton#rcMenuButton, QPushButton#sensorMenuButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #333, stop: 1 #111);
border-radius: 5px;
min-height: 64px;
max-height: 64px;
min-width: 80px;
border: 1px solid #000000;
}
QPushButton#planePushButton, QPushButton#flyingWingPushButton, QPushButton#quadXPushButton,
QPushButton#quadPlusPushButton, QPushButton#hexaXPushButton, QPushButton#hexaPlusPushButton,
QPushButton#octoXPushButton, QPushButton#octoPlusPushButton, QPushButton#hPushButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777, stop: 1 #333);
border-radius: 5px;
min-height: 140px;
max-height: 240px;
min-width: 140px;
border: 1px solid #465158;
}
QPushButton:checked#planePushButton, QPushButton:checked#flyingWingPushButton, QPushButton:checked#quadXPushButton,
QPushButton:checked#quadPlusPushButton, QPushButton:checked#hexaXPushButton, QPushButton:checked#hexaPlusPushButton,
QPushButton:checked#octoXPushButton, QPushButton:checked#octoPlusPushButton, QPushButton:checked#hPushButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #77F, stop: 1 #33A);
border: 3px solid #4651A8;
}
QPushButton#viewModeGeneric, QPushButton#viewModePX4, QPushButton#viewModeAPM, QPushButton#viewModeAR {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #73D95D, stop: 1 #18A154);
border-radius: 12px;
......@@ -355,6 +408,18 @@ QPushButton#viewModeGeneric, QPushButton#viewModePX4, QPushButton#viewModeAPM, Q
border: 3px solid #465158;
}
QWidget#containerWidget {
background-color: qlineargradient(spread:pad, x1:0.527222, y1:0.961, x2:0.536946, y2:0.198864, stop:0.103448 rgba(65, 65, 65, 255), stop:1 rgba(119, 119, 119, 255));
border-radius: 16px;
border: 2px solid #CCCCCC;
}
QWidget#navBarWidget {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #404040, stop:1 #727272);
border-radius: 0px;
border: 1px solid #222222;
}
QPushButton#connectButton, QPushButton#controlButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #73D95D, stop: 1 #18A154);
}
......
......@@ -142,6 +142,35 @@ INCLUDEPATH += \
include(src/apps/mavlinkgen/mavlinkgen.pri)
# Include QUpgrade tool
exists(qupgrade) {
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
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
FORMS += qupgrade/src/apps/qupgrade/dialog_bare.ui \
qupgrade/src/apps/qupgrade/boardwidget.ui
RESOURCES += qupgrade/qupgrade.qrc
linux*:CONFIG += qesp_linux_udev
include(qupgrade/libs/qextserialport/src/qextserialport.pri)
INCLUDEPATH += qupgrade/src/apps/qupgrade
DEFINES += "QUPGRADE_SUPPORT"
}
# Include GLC library
#include(libs/GLC_lib/glc_lib.pri)
# Include QWT plotting library
include(libs/qwt/qwt.pri)
......@@ -153,12 +182,6 @@ INCLUDEPATH += .
# Include serial port library (QSerialPort)
include(libs/serialport/qserialport.pri)
## Serial port detection (ripped-off from qextserialport library)
#macx|macx-g++|macx-g++42::SOURCES += libs/qextserialport/qextserialenumerator_osx.cpp
#linux-g++::SOURCES += libs/qextserialport/qextserialenumerator_unix.cpp
#linux-g++-64::SOURCES += libs/qextserialport/qextserialenumerator_unix.cpp
#win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += libs/qextserialport/qextserialenumerator_win.cpp
# Input
FORMS += src/ui/MainWindow.ui \
src/ui/CommSettings.ui \
......@@ -269,7 +292,10 @@ FORMS += src/ui/MainWindow.ui \
src/ui/main/QGCWelcomeMainWindow.ui \
src/ui/configuration/terminalconsole.ui \
src/ui/configuration/SerialSettingsDialog.ui \
src/ui/configuration/ApmFirmwareConfig.ui
src/ui/configuration/ApmFirmwareConfig.ui \
src/ui/px4_configuration/QGCPX4AirframeConfig.ui \
src/ui/px4_configuration/QGCPX4MulticopterConfig.ui \
src/ui/px4_configuration/QGCPX4SensorCalibration.ui
INCLUDEPATH += src \
src/ui \
......@@ -388,8 +414,7 @@ HEADERS += src/MG.h \
src/ui/QGCMAVLinkInspector.h \
src/ui/MAVLinkDecoder.h \
src/ui/WaypointViewOnlyView.h \
src/ui/WaypointEditableView.h \
src/ui/UnconnectedUASInfoWidget.h \
src/ui/WaypointEditableView.h \
src/ui/QGCRGBDView.h \
src/ui/mavlink/QGCMAVLinkMessageSender.h \
src/ui/firmwareupdate/QGCFirmwareUpdateWidget.h \
......@@ -471,7 +496,11 @@ HEADERS += src/MG.h \
src/ui/configuration/ApmFirmwareConfig.h \
src/uas/UASParameterDataModel.h \
src/uas/UASParameterCommsMgr.h \
src/ui/QGCPendingParamWidget.h
src/ui/QGCPendingParamWidget.h \
src/ui/px4_configuration/QGCPX4AirframeConfig.h \
src/ui/QGCBaseParamWidget.h \
src/ui/px4_configuration/QGCPX4MulticopterConfig.h \
src/ui/px4_configuration/QGCPX4SensorCalibration.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
......@@ -689,7 +718,11 @@ SOURCES += src/main.cc \
src/ui/configuration/ApmFirmwareConfig.cc \
src/uas/UASParameterDataModel.cc \
src/uas/UASParameterCommsMgr.cc \
src/ui/QGCPendingParamWidget.cc
src/ui/QGCPendingParamWidget.cc \
src/ui/px4_configuration/QGCPX4AirframeConfig.cc \
src/ui/QGCBaseParamWidget.cc \
src/ui/px4_configuration/QGCPX4MulticopterConfig.cc \
src/ui/px4_configuration/QGCPX4SensorCalibration.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
......@@ -157,6 +157,29 @@
<file>files/images/firmware/X8_on.png</file>
<file>files/images/firmware/Y6_off.png</file>
<file>files/images/firmware/Y6_on.png</file>
<file>files/images/px4/airframes/quad_x.png</file>
<file>files/images/px4/airframes/quad_+.png</file>
<file>files/images/px4/airframes/octo_+.png</file>
<file>files/images/px4/airframes/hexa_+.png</file>
<file>files/images/px4/airframes/hexa_x.png</file>
<file>files/images/px4/airframes/octo_x.png</file>
<file>files/images/px4/airframes/flying_wing.png</file>
<file>files/images/px4/airframes/plane_ert.png</file>
<file>files/images/px4/airframes/plane_aert.png</file>
<file>files/images/px4/airframes/quad_h.png</file>
<file>files/images/px4/calibration/arrows.png</file>
<file>files/images/px4/calibration/accel_x+.png</file>
<file>files/images/px4/calibration/accel_x-.png</file>
<file>files/images/px4/calibration/accel_y-.png</file>
<file>files/images/px4/calibration/accel_z+.png</file>
<file>files/images/px4/calibration/accel_z-.png</file>
<file>files/images/px4/calibration/accel_y+.png</file>
<file>files/images/px4/calibration/mag_calibration_figure8.png</file>
<file>files/images/px4/menu/sensors.png</file>
<file>files/images/px4/menu/firmware_upgrade.png</file>
<file>files/images/px4/menu/plane.png</file>
<file>files/images/px4/menu/remote.png</file>
<file>files/images/px4/menu/cogwheels.png</file>
</qresource>
<qresource prefix="/general">
<file alias="vera.ttf">files/styles/Vera.ttf</file>
......
......@@ -250,9 +250,9 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
if (decodeState == 0 && !decodedFirstPacket)
{
nonmavlinkCount++;
if (nonmavlinkCount > 500 && !warnedUserNonMavlink)
if (nonmavlinkCount > 2000 && !warnedUserNonMavlink)
{
//500 bytes with no mavlink message. Are we connected to a mavlink capable device?
//2000 bytes with no mavlink message. Are we connected to a mavlink capable device?
if (!checkedUserNonMavlink)
{
link->requestReset();
......
......@@ -19,6 +19,8 @@
#include "QGC.h"
#include <MG.h>
SerialLink::SerialLink(QString portname, int baudRate, bool hardwareFlowControl, bool parity,
int dataBits, int stopBits) :
m_bytesRead(0),
......@@ -137,8 +139,7 @@ void SerialLink::writeSettings()
void SerialLink::run()
{
// Initialize the connection
if (!hardwareConnect())
{
if (!hardwareConnect()) {
//Need to error out here.
emit communicationError(getName(),"Error connecting: " + m_port->errorString());
disconnect(); // This tidies up and sends the necessary signals
......@@ -155,20 +156,17 @@ void SerialLink::run()
qint64 timeout = 5000;
int linkErrorCount = 0;
forever
{
forever {
{
QMutexLocker locker(&this->m_stoppMutex);
if(m_stopp)
{
QMutexLocker locker(&this->m_stoppMutex);
if(m_stopp) {
m_stopp = false;
break; // exit the thread
}
if (m_reqReset)
{
if (m_reqReset) {
m_reqReset = false;
communicationUpdate(getName(),"Reset requested via DTR signal");
emit communicationUpdate(getName(),"Reset requested via DTR signal");
m_port->setDataTerminalReady(true);
msleep(250);
m_port->setDataTerminalReady(false);
......@@ -178,27 +176,29 @@ void SerialLink::run()
if (isConnected() && (linkErrorCount > 100)) {
qDebug() << "linkErrorCount too high: disconnecting!";
linkErrorCount = 0;
communicationError("SerialLink", tr("Disconnecting on too many link errors"));
emit communicationUpdate(getName(), tr("Disconnecting on too many link errors"));
disconnect();
}
if (m_transmitBuffer.count() > 0) {
QMutexLocker writeLocker(&m_writeMutex);
int numWritten = m_port->write(m_transmitBuffer);
bool txSuccess = m_port->waitForBytesWritten(1);
if (!txSuccess || (numWritten != m_transmitBuffer.count()))
{
bool txSuccess = m_port->waitForBytesWritten(5);
if (!txSuccess || (numWritten != m_transmitBuffer.count())) {
linkErrorCount++;
qDebug() << "TX Error! wrote" << numWritten << ", asked for " << m_transmitBuffer.count() << "bytes";
} else {
}
else {
linkErrorCount = 0;
}
m_transmitBuffer = m_transmitBuffer.remove(0, numWritten);
}
//wait n msecs for data to be ready
//[TODO][BB] lower to SerialLink::poll_interval?
bool success = m_port->waitForReadyRead(10);
if (success) { // Waits for 1/2 second [TODO][BB] lower to SerialLink::poll_interval?
if (success) {
QByteArray readData = m_port->readAll();
while (m_port->waitForReadyRead(10))
readData += m_port->readAll();
......@@ -210,24 +210,21 @@ void SerialLink::run()
m_bitsReceivedTotal += readData.length() * 8;
linkErrorCount = 0;
}
} else {
}
else {
linkErrorCount++;
//qDebug() << "Wait read response timeout" << QTime::currentTime().toString();
}
if (bytes != m_bytesRead) // i.e things are good and data is being read.
{
if (bytes != m_bytesRead) { // i.e things are good and data is being read.
bytes = m_bytesRead;
msecs = QDateTime::currentMSecsSinceEpoch();
}
else
{
if (QDateTime::currentMSecsSinceEpoch() - msecs > timeout)
{
else {
if (QDateTime::currentMSecsSinceEpoch() - msecs > timeout) {
//It's been 10 seconds since the last data came in. Reset and try again
msecs = QDateTime::currentMSecsSinceEpoch();
if (msecs - initialmsecs > 25000)
{
if (msecs - initialmsecs > 25000) {
//After initial 25 seconds, timeouts are increased to 30 seconds.
//This prevents temporary silences from things like calibration commands
//from screwing things up. In all reality, timeouts should be enabled/disabled
......@@ -235,25 +232,22 @@ void SerialLink::run()
//TODO ^^
timeout = 30000;
}
if (!triedDTR && triedreset)
{
if (!triedDTR && triedreset) {
triedDTR = true;
communicationUpdate(getName(),"No data to receive on COM port. Attempting to reset via DTR signal");
emit communicationUpdate(getName(),"No data to receive on COM port. Attempting to reset via DTR signal");
qDebug() << "No data!!! Attempting reset via DTR.";
m_port->setDataTerminalReady(true);
msleep(250);
m_port->setDataTerminalReady(false);
}
else if (!triedreset)
{
else if (!triedreset) {
qDebug() << "No data!!! Attempting reset via reboot command.";
communicationUpdate(getName(),"No data to receive on COM port. Assuming possible terminal mode, attempting to reset via \"reboot\" command");
emit communicationUpdate(getName(),"No data to receive on COM port. Assuming possible terminal mode, attempting to reset via \"reboot\" command");
m_port->write("reboot\r\n",8);
triedreset = true;
}
else
{
communicationUpdate(getName(),"No data to receive on COM port....");
else {
emit communicationUpdate(getName(),"No data to receive on COM port....");
qDebug() << "No data!!!";
}
}
......@@ -406,8 +400,7 @@ bool SerialLink::connect()
**/
bool SerialLink::hardwareConnect()
{
if(m_port)
{
if(m_port) {
qDebug() << "SerialLink:" << QString::number((long)this, 16) << "closing port";
m_port->close();
delete m_port;
......@@ -416,21 +409,19 @@ bool SerialLink::hardwareConnect()
qDebug() << "SerialLink: hardwareConnect to " << m_portName;
m_port = new QSerialPort(m_portName);
if (m_port == NULL)
{
if (m_port == NULL) {
emit communicationUpdate(getName(),"Error opening port: " + m_port->errorString());
return false; // couldn't create serial port.
}
QObject::connect(m_port,SIGNAL(aboutToClose()),this,SIGNAL(disconnected()));
QObject::connect(m_port, SIGNAL(error(QSerialPort::SerialPortError)),
this, SLOT(linkError(QSerialPort::SerialPortError)));
QObject::connect(m_port, SIGNAL(error(SerialLinkPortError_t)),
this, SLOT(linkError(SerialLinkPortError_t)));
// port->setCommTimeouts(QSerialPort::CtScheme_NonBlockingRead);
m_connectionStartTime = MG::TIME::getGroundTimeNow();
if (!m_port->open(QIODevice::ReadWrite))
{
if (!m_port->open(QIODevice::ReadWrite)) {
emit communicationUpdate(getName(),"Error opening port: " + m_port->errorString());
m_port->close();
return false; // couldn't open serial port
......@@ -456,7 +447,7 @@ bool SerialLink::hardwareConnect()
return true; // successful connection
}
void SerialLink::linkError(QSerialPort::SerialPortError error)
void SerialLink::linkError(SerialLinkPortError_t error)
{
qDebug() << error;
}
......
......@@ -40,6 +40,9 @@ This file is part of the QGROUNDCONTROL project
#include <configuration.h>
#include "SerialLinkInterface.h"
// convenience type for passing errors
typedef QSerialPort::SerialPortError SerialLinkPortError_t;
/**
* @brief The SerialLink class provides cross-platform access to serial links.
* It takes care of the link management and provides a common API to higher
......@@ -53,6 +56,7 @@ class SerialLink : public SerialLinkInterface
Q_OBJECT
//Q_INTERFACES(SerialLinkInterface:LinkInterface)
public:
SerialLink(QString portname = "",
int baudrate=57600,
......@@ -142,7 +146,7 @@ public slots:
bool connect();
bool disconnect();
void linkError(QSerialPort::SerialPortError error);
void linkError(SerialLinkPortError_t error);
protected:
quint64 m_bytesRead;
......
#ifndef PX4_CUSTOM_MODE_H
#define PX4_CUSTOM_MODE_H
enum PX4_CUSTOM_MAIN_MODE {
PX4_CUSTOM_MAIN_MODE_MANUAL = 1,
PX4_CUSTOM_MAIN_MODE_SEATBELT,
PX4_CUSTOM_MAIN_MODE_EASY,
PX4_CUSTOM_MAIN_MODE_AUTO,
};
enum PX4_CUSTOM_SUB_MODE_AUTO {
PX4_CUSTOM_SUB_MODE_AUTO_READY = 1,
PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF,
PX4_CUSTOM_SUB_MODE_AUTO_LOITER,
PX4_CUSTOM_SUB_MODE_AUTO_MISSION,
PX4_CUSTOM_SUB_MODE_AUTO_RTL,
PX4_CUSTOM_SUB_MODE_AUTO_LAND,
};
union px4_custom_mode {
struct {
uint16_t reserved;
uint8_t main_mode;
uint8_t sub_mode;
};
uint32_t data;
float data_float;
};
#endif // PX4_CUSTOM_MODE_H
#include "QGCUASParamManager.h"
#include <QApplication>>
#include <QApplication>
#include <QDir>
#include <QMessageBox>
#include "UASInterface.h"
#include "UASParameterCommsMgr.h"
QGCUASParamManager::QGCUASParamManager(UASInterface* uas, QWidget *parent) :
QWidget(parent),
mav(uas),
paramDataModel(NULL),
paramCommsMgr(NULL)
QGCUASParamManager::QGCUASParamManager(QObject *parent) :
QObject(parent),
mav(NULL),
paramDataModel(this),
paramCommsMgr(NULL),
defaultComponentId(-1)
{
paramDataModel = uas->getParamDataModel();
paramCommsMgr = uas->getParamCommsMgr();
mav->setParamManager(this);
// Load default values and tooltips
}
QGCUASParamManager* QGCUASParamManager::initWithUAS(UASInterface* uas)
{
mav = uas;
// Load default values and tooltips for data model
loadParamMetaInfoCSV();
paramCommsMgr = new UASParameterCommsMgr(this);
paramCommsMgr->initWithUAS(uas);
connectToModelAndComms();
return this;
}
void QGCUASParamManager::connectToModelAndComms()
{
// Pass along comms mgr status msgs
connect(paramCommsMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)),
this, SIGNAL(parameterStatusMsgUpdated(QString,int)));
connect(paramCommsMgr, SIGNAL(parameterListUpToDate()),
this, SIGNAL(parameterListUpToDate()));
// Pass along data model updates
connect(&paramDataModel, SIGNAL(parameterUpdated(int, QString , QVariant )),
this, SIGNAL(parameterUpdated(int, QString , QVariant )));
connect(&paramDataModel, SIGNAL(pendingParamUpdate(int , const QString& , QVariant , bool )),
this, SIGNAL(pendingParamUpdate(int , const QString& , QVariant , bool )));
}
void QGCUASParamManager::clearAllPendingParams()
{
paramDataModel.clearAllPendingParams();
emit parameterStatusMsgUpdated(tr("Cleared all pending params"), UASParameterCommsMgr::ParamCommsStatusLevel_OK);
}
int QGCUASParamManager::getDefaultComponentId()
{
int result = 0;
if (-1 != defaultComponentId)
return defaultComponentId;
QList<int> components = getComponentForParam("SYS_AUTOSTART");//TODO is this the best way to find the right component?
// Guard against multiple components responding - this will never show in practice
if (1 == components.count()) {
result = components.first();
defaultComponentId = result;
}
qDebug() << "Default compId: " << result;
return result;
}
QList<int> QGCUASParamManager::getComponentForParam(const QString& parameter) const
{
return paramDataModel.getComponentForOnboardParam(parameter);
}
bool QGCUASParamManager::getParameterValue(int component, const QString& parameter, QVariant& value) const
{
return paramDataModel->getOnboardParamValue(component,parameter,value);
return paramDataModel.getOnboardParamValue(component,parameter,value);
}
......@@ -42,39 +108,53 @@ void QGCUASParamManager::requestParameterUpdate(int component, const QString& pa
*/
void QGCUASParamManager::requestParameterList()
{
if (!mav) {
return;
if (mav) {
emit parameterStatusMsgUpdated(tr("Requested param list.. waiting"), UASParameterCommsMgr::ParamCommsStatusLevel_OK);
paramCommsMgr->requestParameterList();
}
setParameterStatusMsg(tr("Requested param list.. waiting"));
paramCommsMgr->requestParameterList();
}
void QGCUASParamManager::setParameterStatusMsg(const QString& msg)
void QGCUASParamManager::requestParameterListIfEmpty()
{
qDebug() << "parameterStatusMsg: " << msg;
parameterStatusMsg = msg;
if (mav) {
int totalOnboard = paramDataModel.countOnboardParams();
if (totalOnboard < 2) { //TODO arbitrary constant, maybe 0 is OK?
defaultComponentId = -1; //reset this ...we have no idea what the default component ID is
requestParameterList();
}
}
}
void QGCUASParamManager::setParamDescriptions(const QMap<QString,QString>& paramInfo) {
paramDataModel->setParamDescriptions(paramInfo);
paramDataModel.setParamDescriptions(paramInfo);
}
void QGCUASParamManager::setParameter(int compId, QString paramName, QVariant value)
{
//paramCommsMgr->setParameter(compId,paramName,value);
paramDataModel->updatePendingParamWithValue(compId,paramName,value);
if ((0 == compId) || (-1 == compId)) {
//attempt to get an actual component ID
compId = getDefaultComponentId();
}
paramDataModel.updatePendingParamWithValue(compId,paramName,value);
}
void QGCUASParamManager::sendPendingParameters()
void QGCUASParamManager::sendPendingParameters(bool persistAfterSend)
{
paramCommsMgr->sendPendingParameters();
paramCommsMgr->sendPendingParameters(persistAfterSend);
}
void QGCUASParamManager::setPendingParam(int compId, QString& paramName, const QVariant& value)
void QGCUASParamManager::setPendingParam(int compId, const QString& paramName, const QVariant& value)
{
paramDataModel->updatePendingParamWithValue(compId,paramName,value);
if ((0 == compId) || (-1 == compId)) {
//attempt to get an actual component ID
compId = getDefaultComponentId();
}
paramDataModel.updatePendingParamWithValue(compId,paramName,value);
}
......@@ -97,16 +177,59 @@ void QGCUASParamManager::loadParamMetaInfoCSV()
}
QTextStream in(&paramMetaFile);
paramDataModel->loadParamMetaInfoFromStream(in);
paramDataModel.loadParamMetaInfoFromStream(in);
paramMetaFile.close();
}
/**
* @return The MAV of this mgr. Unless the MAV object has been destroyed, this
* pointer is never zero.
*/
UASInterface* QGCUASParamManager::getUAS()
{
return mav;
}
UASParameterDataModel* QGCUASParamManager::dataModel()
{
return &paramDataModel;
}
void QGCUASParamManager::writeOnboardParamsToStream(QTextStream &stream, const QString& uasName)
{
paramDataModel.writeOnboardParamsToStream(stream,uasName);
}
void QGCUASParamManager::readPendingParamsFromStream(QTextStream &stream)
{
paramDataModel.readUpdateParamsFromStream(stream);
}
void QGCUASParamManager::copyVolatileParamsToPersistent()
{
int changedParamCount = paramDataModel.countPendingParams();
if (changedParamCount > 0) {
QMessageBox msgBox;
msgBox.setText(tr("There are locally changed parameters. Please transmit them first (<TRANSMIT>) or update them with the onboard values (<REFRESH>) before storing onboard from RAM to ROM."));
msgBox.exec();
}
else {
paramCommsMgr->writeParamsToPersistentStorage();
}
}
void QGCUASParamManager::copyPersistentParamsToVolatile()
{
if (mav) {
mav->readParametersFromStorage(); //TODO use comms mgr instead?
}
}
void QGCUASParamManager::requestRcCalibrationParamsUpdate() {
paramCommsMgr->requestRcCalibrationParamsUpdate();
}
......@@ -6,67 +6,126 @@
#include <QTimer>
#include <QVariant>
#include "UASParameterDataModel.h"
//forward declarations
class QTextStream;
class UASInterface;
class UASParameterCommsMgr;
class UASParameterDataModel;
class QGCUASParamManager : public QWidget
class QGCUASParamManager : public QObject
{
Q_OBJECT
public:
QGCUASParamManager(UASInterface* uas, QWidget *parent = 0);
QGCUASParamManager(QObject* parent = 0);
QGCUASParamManager* initWithUAS(UASInterface* uas);
/** @brief Get the known, confirmed value of a parameter */
virtual bool getParameterValue(int component, const QString& parameter, QVariant& value) const;
/** @brief determine which component is the root component for the UAS and return its ID or 0 if unknown */
virtual int getDefaultComponentId();
/**
* @brief Get a list of all component IDs using this parameter name
* @param parameter The string encoding the parameter name
* @return A list with all components using this parameter name. Can be empty.
*/
virtual QList<int> getComponentForParam(const QString& parameter) const;
/** @brief Provide tooltips / user-visible descriptions for parameters */
virtual void setParamDescriptions(const QMap<QString,QString>& paramDescs);
/**
* @brief Count the pending parameters in the current transmission
* @return The number of pending parameters
*/
virtual int countPendingParams() {
return paramDataModel.countPendingParams();
}
/**
* @brief Count the number of onboard parameters
* @return The number of onboard parameters
*/
virtual int countOnboardParams() {
return paramDataModel.countOnboardParams();
}
/** @brief Get the UAS of this widget
* @return The MAV of this mgr. Unless the MAV object has been destroyed, this is never null.
*/
UASInterface* getUAS();
/** @return The data model managed by this class */
virtual UASParameterDataModel* dataModel();
protected:
//TODO decouple this UI message display further?
virtual void setParameterStatusMsg(const QString& msg);
/** @brief Load parameter meta information from appropriate CSV file */
virtual void loadParamMetaInfoCSV();
void connectToModelAndComms();
signals:
void parameterChanged(int component, QString parameter, QVariant value);
void parameterChanged(int component, int parameterIndex, QVariant value);
/** @brief We updated the parameter status message */
void parameterStatusMsgUpdated(QString msg, int level);
/** @brief We have received a complete list of all parameters onboard the MAV */
void parameterListUpToDate();
/** @brief We've received an update of a parameter's value */
void parameterUpdated(int compId, QString paramName, QVariant value);
/** @brief Notifies listeners that a param was added to or removed from the pending list */
void pendingParamUpdate(int compId, const QString& paramName, QVariant value, bool isPending);
public slots:
/** @brief Send one parameter to the MAV: changes value in transient memory of MAV */
virtual void setParameter(int component, QString parameterName, QVariant value);
/** @brief Send all pending parameters to the MAV, for storage in transient (RAM) memory */
virtual void sendPendingParameters();
/** @brief Send all pending parameters to the MAV, for storage in transient (RAM) memory
* @param persistAfterSend If true, all parameters will be written to persistent storage as well
*/
virtual void sendPendingParameters(bool persistAfterSend = false);
/** @brief Request list of parameters from MAV */
virtual void requestParameterList();
virtual void setPendingParam(int componentId, QString& key, const QVariant& value);
/** @brief Request a list of params onboard the MAV if the onboard param list we have is empty */
virtual void requestParameterListIfEmpty();
/** @brief queue a pending parameter for sending to the MAV */
virtual void setPendingParam(int componentId, const QString& key, const QVariant& value);
/** @brief remove all params from the pending list */
virtual void clearAllPendingParams();
/** @brief Request a single parameter by name from the MAV */
virtual void requestParameterUpdate(int component, const QString& parameter);
virtual void handleParameterUpdate(int component, const QString& parameterName, QVariant value) = 0;
virtual void handleParameterListUpToDate() = 0;
virtual void writeOnboardParamsToStream(QTextStream &stream, const QString& uasName);
virtual void readPendingParamsFromStream(QTextStream &stream);
virtual void requestRcCalibrationParamsUpdate();
/** @brief Copy the current parameters in volatile RAM to persistent storage (EEPROM/HDD) */
virtual void copyVolatileParamsToPersistent();
/** @brief Copy the parameters from persistent storage to volatile RAM */
virtual void copyPersistentParamsToVolatile();
protected:
// Parameter data model
UASInterface* mav; ///< The MAV this manager is controlling
UASParameterDataModel* paramDataModel;///< Shared data model of parameters
UASParameterDataModel paramDataModel;///< Shared data model of parameters
UASParameterCommsMgr* paramCommsMgr; ///< Shared comms mgr for parameters
// Status
QString parameterStatusMsg;
int defaultComponentId; ///< Cached default component ID
};
......
This diff is collapsed.
......@@ -69,7 +69,7 @@ public:
/** @brief Get short mode */
const QString& getShortMode() const;
/** @brief Translate from mode id to text */
static QString getShortModeTextFor(int id);
static QString getShortModeTextFor(uint8_t base_mode, uint32_t custom_mode, int autopilot);
/** @brief Translate from mode id to audio text */
static QString getAudioModeTextFor(int id);
/** @brief Get the unique system id */
......@@ -362,9 +362,8 @@ protected: //COMMENTS FOR TEST UNIT
int airframe; ///< The airframe type
int autopilot; ///< Type of the Autopilot: -1: None, 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
bool systemIsArmed; ///< If the system is armed
uint8_t mode; ///< The current mode of the MAV
uint8_t base_mode; ///< The current mode of the MAV
uint32_t custom_mode; ///< The current mode of the MAV
uint32_t navMode; ///< The current navigation mode of the MAV
int status; ///< The current status of the MAV
QString shortModeText; ///< Short textual mode description
QString shortStateText; ///< Short textual state description
......@@ -492,9 +491,7 @@ protected: //COMMENTS FOR TEST UNIT
/// PARAMETERS
QMap<int, QMap<QString, QVariant>* > parameters; ///< All parameters
bool paramsOnceRequested; ///< If the parameter list has been read at least once
QGCUASParamManager* paramManager; ///< Parameter manager class
UASParameterDataModel* paramDataModel; ///< The parameter data model for this UAS
UASParameterCommsMgr* paramCommsMgr;
QGCUASParamManager paramMgr; ///< Parameter manager for this UAS
/// SIMULATION
QGCHilLink* simulation; ///< Hardware in the loop simulation link
......@@ -508,43 +505,27 @@ public:
float getChargeLevel();
/** @brief Get the human-readable status message for this code */
void getStatusForCode(int statusCode, QString& uasState, QString& stateDescription);
/** @brief Get the human-readable navigation mode translation for this mode */
QString getNavModeText(int mode);
/** @brief Check if vehicle is in autonomous mode */
bool isAuto();
/** @brief Check if vehicle is armed */
bool isArmed() const { return systemIsArmed; }
/** @brief Get reference to the waypoint manager **/
UASWaypointManager* getWaypointManager() {
return &waypointManager;
}
/** @brief Get reference to the param manager **/
QGCUASParamManager* getParamManager() const {
return paramManager;
}
/** @brief Get reference to the parameter data model (same one shared with the parameter manager) **/
UASParameterDataModel* getParamDataModel() {
return paramDataModel;
}
UASParameterCommsMgr* getParamCommsMgr() {
return paramCommsMgr;
/** @brief Get reference to the param manager **/
virtual QGCUASParamManager* getParamManager() {
return &paramMgr;
}
/** @brief Get the HIL simulation */
QGCHilLink* getHILSimulation() const {
return simulation;
}
// TODO Will be removed
/** @brief Set reference to the param manager **/
void setParamManager(QGCUASParamManager* manager) {
paramManager = manager;
}
int getSystemType();
/**
......@@ -850,7 +831,7 @@ public slots:
void setSelected();
/** @brief Set current mode of operation, e.g. auto or manual */
void setMode(int mode);
void setMode(uint8_t newBaseMode, uint32_t newCustomMode);
/** @brief Request all parameters */
void requestParameters();
......@@ -861,7 +842,7 @@ public slots:
void requestParameter(int component, int id);
/** @brief Set a system parameter */
void setParameter(const int component, const QString& id, const QVariant& value);
void setParameter(const int compId, const QString& paramId, const QVariant& value);
/** @brief Write parameters to permanent storage */
void writeParametersToStorage();
......@@ -953,6 +934,8 @@ protected:
/** @brief Get the UNIX timestamp in milliseconds, ignore attitudeStamped mode */
quint64 getUnixReferenceTime(quint64 time);
virtual void processParamValueMsg(mavlink_message_t& msg, const QString& paramName,const mavlink_param_value_t& rawValue, mavlink_param_union_t& paramValue);
int componentID[256];
bool componentMulti[256];
bool connectionLost; ///< Flag indicates a timed out connection
......
......@@ -154,18 +154,8 @@ public:
/** @brief Get reference to the waypoint manager **/
virtual UASWaypointManager* getWaypointManager(void) = 0;
/** @brief Access the parameter data model for this UAS (sans widget). This is the same parameter data model used by the parameter manager. **/
virtual UASParameterDataModel* getParamDataModel() = 0;
virtual UASParameterCommsMgr* getParamCommsMgr() = 0;
/** @brief Get reference to the param manager **/
virtual QGCUASParamManager* getParamManager() const = 0;
// TODO Will be removed
/** @brief Set reference to the param manager **/
virtual void setParamManager(QGCUASParamManager* manager) = 0;
virtual QGCUASParamManager* getParamManager() = 0;
/* COMMUNICATION FLAGS */
......@@ -305,7 +295,7 @@ public slots:
/** @brief Start/continue the current robot action */
virtual void go() = 0;
/** @brief Set the current mode of operation */
virtual void setMode(int mode) = 0;
virtual void setMode(uint8_t newBaseMode, uint32_t newCustomMode) = 0;
/** Stops the robot system. If it is an MAV, the robot starts the emergency landing procedure **/
virtual void emergencySTOP() = 0;
/** Kills the robot. All systems are immediately shut down (e.g. the main power line is cut). This might lead to a crash **/
......
......@@ -7,9 +7,9 @@
#define RC_CAL_CHAN_MAX 8
UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent, UASInterface *uas) :
UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent) :
QObject(parent),
mav(uas),
mav(NULL),
paramDataModel(NULL),
transmissionListMode(false),
transmissionActive(false),
......@@ -18,10 +18,16 @@ UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent, UASInterface *uas) :
rewriteTimeout(1000),
retransmissionBurstRequestSize(5)
{
paramDataModel = mav->getParamDataModel();
loadParamCommsSettings();
}
UASParameterCommsMgr* UASParameterCommsMgr::initWithUAS(UASInterface* uas)
{
mav = uas;
paramDataModel = mav->getParamManager()->dataModel();
loadParamCommsSettings();
//Requesting parameters one-by-one from mav
connect(this, SIGNAL(parameterUpdateRequestedById(int,int)),
mav, SLOT(requestParameter(int,int)));
......@@ -34,10 +40,11 @@ UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent, UASInterface *uas) :
connect(mav, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)),
this, SLOT(receivedParameterUpdate(int,int,int,int,QString,QVariant)));
//connecto retransmissionTimer
//connect to retransmissionTimer
connect(&retransmissionTimer, SIGNAL(timeout()),
this, SLOT(retransmissionGuardTick()));
return this;
}
......@@ -60,15 +67,6 @@ void UASParameterCommsMgr::loadParamCommsSettings()
}
void UASParameterCommsMgr::requestParameterListIfEmpty()
{
int totalOnboard = paramDataModel->countOnboardParams();
if (totalOnboard < 2) { //TODO arbitrary constant, maybe 0 is OK?
requestParameterList();
}
}
/**
* Send a request to deliver the list of onboard parameters
......@@ -80,9 +78,6 @@ void UASParameterCommsMgr::requestParameterList()
return;
}
//TODO check: no need to cause datamodel to forget params here?
// paramDataModel->forgetAllOnboardParameters();
if (!transmissionListMode) {
// Clear transmission state
receivedParamsList.clear();
......@@ -161,11 +156,11 @@ void UASParameterCommsMgr::emitPendingParameterCommit(int compId, const QString&
}
break;
default:
qCritical() << "ABORTED PARAM SEND, NO VALID QVARIANT TYPE";
qCritical() << "ABORTED PARAM SEND, INVALID QVARIANT TYPE" << paramType;
return;
}
setParameterStatusMsg(tr("Requested write of: %1: %2").arg(key).arg(value.toDouble()));
setParameterStatusMsg(tr("Writing %1: %2 for comp. %3").arg(key).arg(value.toDouble()).arg(compId));
}
......@@ -218,7 +213,7 @@ void UASParameterCommsMgr::resendReadWriteRequests()
}
if ((0 == requestedWriteCount) && (0 == requestedReadCount) ) {
qDebug() << __FILE__ << __LINE__ << "NO re-read or rewrite requests??";
qDebug() << __FILE__ << __LINE__ << "No pending re-read or rewrite requests";
if (!transmissionListMode) {
setRetransmissionGuardEnabled(false);
transmissionActive = false;
......@@ -429,6 +424,8 @@ void UASParameterCommsMgr::receivedParameterUpdate(int uas, int compId, int para
{
Q_UNUSED(uas); //this object is assigned to one UAS only
qDebug() << "compId" << compId << "receivedParameterUpdate:" << paramName;
//notify the data model that we have an updated param
paramDataModel->handleParamUpdate(compId,paramName,value);
......@@ -476,6 +473,10 @@ void UASParameterCommsMgr::receivedParameterUpdate(int uas, int compId, int para
// Mark this parameter as received in write ACK list
QMap<QString, QVariant>* compMissWritePackets = missingWriteAckPackets.value(compId);
if (!compMissWritePackets) {
//we sometimes send a write request on compId 0 and get a response on a nonzero compId eg 50
compMissWritePackets = missingWriteAckPackets.value(0);
}
if (compMissWritePackets && compMissWritePackets->contains(paramName)) {
justWritten = true;
if (compMissWritePackets->value(paramName) != value) {
......@@ -500,6 +501,10 @@ void UASParameterCommsMgr::receivedParameterUpdate(int uas, int compId, int para
setParameterStatusMsg(tr("SUCCESS: Wrote %2 (#%1/%4): %3 [%5]").arg(paramId+1).arg(paramName).arg(value.toDouble()).arg(paramCount).arg(missWriteCount));
if (0 == missWriteCount) {
setParameterStatusMsg(tr("SUCCESS: WROTE ALL PARAMETERS"));
if (persistParamsAfterSend) {
writeParamsToPersistentStorage();
persistParamsAfterSend = false;
}
}
}
else {
......@@ -565,12 +570,15 @@ void UASParameterCommsMgr::writeParamsToPersistentStorage()
{
if (mav) {
mav->writeParametersToStorage(); //TODO track timeout, retransmit etc?
persistParamsAfterSend = false; //done
}
}
void UASParameterCommsMgr::sendPendingParameters()
void UASParameterCommsMgr::sendPendingParameters(bool copyToPersistent)
{
persistParamsAfterSend |= copyToPersistent;
// Iterate through all components, through all pending parameters and send them to UAS
int parametersSent = 0;
QMap<int, QMap<QString, QVariant>*>* changedValues = paramDataModel->getAllPendingParams();
......@@ -592,7 +600,11 @@ void UASParameterCommsMgr::sendPendingParameters()
// Change transmission status if necessary
if (parametersSent == 0) {
setParameterStatusMsg(tr("No transmission: No changed values."),ParamCommsStatusLevel_Warning);
} else {
if (persistParamsAfterSend) {
writeParamsToPersistentStorage();
}
}
else {
setParameterStatusMsg(tr("Transmitting %1 parameters.").arg(parametersSent));
// Set timeouts
if (transmissionActive) {
......
......@@ -18,7 +18,9 @@ class UASParameterCommsMgr : public QObject
public:
explicit UASParameterCommsMgr(QObject *parent = 0, UASInterface* uas = NULL);
explicit UASParameterCommsMgr(QObject *parent = 0);
UASParameterCommsMgr* initWithUAS(UASInterface* model);///< Two-stage constructor
~UASParameterCommsMgr();
typedef enum ParamCommsStatusLevel {
......@@ -62,7 +64,7 @@ signals:
public slots:
/** @brief Iterate through all components, through all pending parameters and send them to UAS */
virtual void sendPendingParameters();
virtual void sendPendingParameters(bool copyToPersistent = false);
/** @brief Write the current onboard parameters from transient RAM into persistent storage, e.g. EEPROM or harddisk */
virtual void writeParamsToPersistentStorage();
......@@ -72,8 +74,6 @@ public slots:
/** @brief Request list of parameters from MAV */
virtual void requestParameterList();
/** @brief Request a list of params onboard the MAV if the onboard param list we have is empty */
virtual void requestParameterListIfEmpty();
/** @brief Check for missing parameters */
virtual void retransmissionGuardTick();
......@@ -99,6 +99,7 @@ protected:
bool transmissionListMode; ///< Currently requesting list
QMap<int, bool> transmissionListSizeKnown; ///< List size initialized?
bool transmissionActive; ///< Missing packets, working on list?
bool persistParamsAfterSend; ///< Copy all parameters to persistent storage after sending
quint64 transmissionTimeout; ///< Timeout
QTimer retransmissionTimer; ///< Timer handling parameter retransmission
quint64 lastTimerReset; ///< Last time the guard timer was reset, to prevent premature firing
......
......@@ -45,7 +45,7 @@ int UASParameterDataModel::countOnboardParams()
}
bool UASParameterDataModel::updatePendingParamWithValue(int compId, QString& key, const QVariant& value)
bool UASParameterDataModel::updatePendingParamWithValue(int compId, const QString& key, const QVariant& value)
{
bool pending = true;
//ensure we have this component in our onboard and pending lists already
......@@ -76,18 +76,15 @@ bool UASParameterDataModel::isParamChangePending(int compId, const QString& key)
return ((NULL != pendingParms) && pendingParms->contains(key));
}
void UASParameterDataModel::setPendingParam(int compId, QString& key, const QVariant &value)
void UASParameterDataModel::setPendingParam(int compId, const QString& key, const QVariant &value)
{
//ensure we have a placeholder map for this component
addComponent(compId);
QMap<QString, QVariant> *pendParams = getPendingParamsForComponent(compId);
if (pendParams) {
pendParams->insert(key,value);
emit pendingParamUpdate(compId, key, value, true);
}
setParamWithTypeInMap(compId,key,value,pendingParameters);
emit pendingParamUpdate(compId, key, value, true);
}
void UASParameterDataModel::removePendingParam(int compId, QString& key)
void UASParameterDataModel::removePendingParam(int compId, const QString& key)
{
qDebug() << "removePendingParam:" << key;
......@@ -101,15 +98,16 @@ void UASParameterDataModel::removePendingParam(int compId, QString& key)
}
}
void UASParameterDataModel::setOnboardParam(int compId, QString& key, const QVariant& value)
void UASParameterDataModel::setOnboardParam(int compId, const QString &key, const QVariant& value)
{
//ensure we have a placeholder map for this component
addComponent(compId);
//TODO use setParamWithTypeInMap instead and verify
QMap<QString, QVariant> *params = getOnboardParamsForComponent(compId);
params->insert(key,value);
}
void UASParameterDataModel::setOnboardParamWithType(int compId, QString& key, QVariant& value)
void UASParameterDataModel::setParamWithTypeInMap(int compId, const QString& key, const QVariant &value, QMap<int, QMap<QString, QVariant>* >& map)
{
switch ((int)value.type())
......@@ -117,25 +115,35 @@ void UASParameterDataModel::setOnboardParamWithType(int compId, QString& key, QV
case QVariant::Int:
{
QVariant fixedValue(value.toInt());
onboardParameters.value(compId)->insert(key, fixedValue);
map.value(compId)->insert(key, fixedValue);
}
break;
case QVariant::UInt:
{
QVariant fixedValue(value.toUInt());
onboardParameters.value(compId)->insert(key, fixedValue);
map.value(compId)->insert(key, fixedValue);
}
break;
case QMetaType::Float:
{
QVariant fixedValue(value.toFloat());
onboardParameters.value(compId)->insert(key, fixedValue);
map.value(compId)->insert(key, fixedValue);
}
break;
case QMetaType::QChar:
{
QVariant fixedValue(QChar((unsigned char)value.toUInt()));
onboardParameters.value(compId)->insert(key, fixedValue);
map.value(compId)->insert(key, fixedValue);
}
break;
case QMetaType::QString:
{
QString strVal = value.toString();
float floatVal = strVal.toFloat();
QVariant fixedValue( floatVal );
//TODO track down WHY we're getting unexpected QString values here...this is a workaround
qDebug() << "Unexpected string QVariant:" << key << " val:" << value << "fixedVal:" << fixedValue;
map.value(compId)->insert(key, fixedValue);
}
break;
default:
......@@ -155,7 +163,7 @@ void UASParameterDataModel::addComponent(int compId)
}
void UASParameterDataModel::handleParamUpdate(int compId, QString& paramName, QVariant& value)
void UASParameterDataModel::handleParamUpdate(int compId, const QString &paramName, const QVariant &value)
{
//verify that the value requested by the user matches the set value
//if it doesn't match, leave the pending parameter in the pending list!
......@@ -165,8 +173,7 @@ void UASParameterDataModel::handleParamUpdate(int compId, QString& paramName, QV
QVariant reqVal = pendingParams->value(paramName);
if (reqVal == value) {
//notify everyone that this item is being removed from the pending parameters list since it's now confirmed
emit pendingParamUpdate(compId, paramName, value, false);
pendingParams->remove(paramName);
removePendingParam(compId,paramName);
}
else {
qDebug() << "Pending commit for " << paramName << " want: " << reqVal << " got: " << value;
......@@ -192,11 +199,38 @@ bool UASParameterDataModel::getOnboardParamValue(int componentId, const QString&
return false;
}
QList<int> UASParameterDataModel::getComponentForOnboardParam(const QString& parameter) const
{
QList<int> components;
// Iterate through all components
foreach (int comp, onboardParameters.keys())
{
if (onboardParameters.value(comp)->contains(parameter))
components.append(comp);
}
return components;
}
void UASParameterDataModel::forgetAllOnboardParams()
{
onboardParameters.clear();
}
void UASParameterDataModel::clearAllPendingParams()
{
QList<int> compIds = pendingParameters.keys();
foreach (int compId , compIds) {
QMap<QString, QVariant>* compParams = pendingParameters.value(compId);
QList<QString> paramNames = compParams->keys();
foreach (QString paramName, paramNames) {
//remove this item from pending status and broadcast update
removePendingParam(compId,paramName);
}
}
}
void UASParameterDataModel::readUpdateParamsFromStream( QTextStream& stream)
{
bool userWarned = false;
......
......@@ -34,20 +34,24 @@ public:
*/
virtual void addComponent(int compId);
/**
* @brief Return a list of all components for this parameter name
* @param parameter The parameter string to search for
* @return A list with all components, can be potentially empty
*/
virtual QList<int> getComponentForOnboardParam(const QString& parameter) const;
/** @brief Save the onboard parameter with a the type specified in the QVariant as fixed */
virtual void setOnboardParamWithType(int componentId, QString& key, QVariant& value);
/** @brief clears every parameter for every loaded component */
virtual void forgetAllOnboardParams();
/** @brief add this parameter to pending list iff it has changed from onboard value
* @return true if the parameter is now pending
*/
virtual bool updatePendingParamWithValue(int componentId, QString& key, const QVariant &value);
virtual void handleParamUpdate(int componentId, QString& key, QVariant& value);
virtual bool updatePendingParamWithValue(int componentId, const QString &key, const QVariant &value);
virtual void handleParamUpdate(int componentId, const QString& key, const QVariant& value);
virtual bool getOnboardParamValue(int componentId, const QString& key, QVariant& value) const;
virtual bool isParamChangePending(int componentId,const QString& key);
......@@ -83,12 +87,15 @@ public:
protected:
/** @brief set the confirmed value of a parameter in the onboard params list */
virtual void setOnboardParam(int componentId, QString& key, const QVariant& value);
virtual void setOnboardParam(int componentId, const QString& key, const QVariant& value);
/** @brief Save the parameter with a the type specified in the QVariant as fixed */
void setParamWithTypeInMap(int compId, const QString& key, const QVariant &value, QMap<int, QMap<QString, QVariant>* >& map);
/** @brief Write a new pending parameter value that may be eventually sent to the UAS */
virtual void setPendingParam(int componentId, QString& key, const QVariant& value);
virtual void setPendingParam(int componentId, const QString &key, const QVariant& value);
/** @brief remove a parameter from the pending list */
virtual void removePendingParam(int compId, QString& key);
virtual void removePendingParam(int compId, const QString &key);
signals:
......@@ -103,6 +110,7 @@ signals:
public slots:
virtual void clearAllPendingParams();
protected:
int uasId; ///< The UAS / MAV to which this data model pertains
......
......@@ -30,6 +30,7 @@ This file is part of the QGROUNDCONTROL project
*/
#include <QPainter>
#include <QSettings>
#include <QScrollBar>
#include "DebugConsole.h"
#include "ui_DebugConsole.h"
......@@ -313,9 +314,15 @@ void DebugConsole::receiveTextMessage(int id, int component, int severity, QStri
break;
}
//turn off updates while we're appending content to avoid breaking the autoscroll behavior
m_ui->receiveText->setUpdatesEnabled(false);
QScrollBar *scroller = m_ui->receiveText->verticalScrollBar();
m_ui->receiveText->appendHtml(QString("<font color=\"%1\">(%2:%3) %4</font>\n").arg(UASManager::instance()->getUASForId(id)->getColor().name(), name, comp, text));
// Ensure text area scrolls correctly
m_ui->receiveText->ensureCursorVisible();
scroller->setValue(scroller->maximum());
m_ui->receiveText->setUpdatesEnabled(true);
}
}
......
......@@ -176,7 +176,8 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
setToolTip(tr("View from top in body frame. Scroll with mouse wheel to change the horizontal field of view of the widget."));
setStatusTip(tr("View from top in body frame. Scroll with mouse wheel to change the horizontal field of view of the widget."));
connect(&statusClearTimer, SIGNAL(timeout()), this, SLOT(clearStatusMessage()));
// XXX this looks a potential recursive issue
//connect(&statusClearTimer, SIGNAL(timeout()), this, SLOT(clearStatusMessage()));
if (UASManager::instance()->getActiveUAS())
{
......
......@@ -57,7 +57,6 @@ This file is part of the QGROUNDCONTROL project
#include "MAVLinkDecoder.h"
#include "QGCMAVLinkMessageSender.h"
#include "QGCRGBDView.h"
#include "QGCFirmwareUpdate.h"
#include "QGCStatusBar.h"
#include "UASQuickView.h"
#include "QGCDataPlot2D.h"
......@@ -1414,8 +1413,9 @@ void MainWindow::connectCommonActions()
perspectives->addAction(ui.actionMissionView);
//perspectives->addAction(ui.actionConfiguration_2);
perspectives->addAction(ui.actionHardwareConfig);
perspectives->addAction(ui.actionSoftwareConfig);
perspectives->addAction(ui.actionFirmwareUpdateView);
if (getCustomMode() == CUSTOM_MODE_APM) {
perspectives->addAction(ui.actionSoftwareConfig);
}
perspectives->addAction(ui.actionTerminalView);
perspectives->addAction(ui.actionUnconnectedView);
perspectives->setExclusive(true);
......@@ -1456,11 +1456,6 @@ void MainWindow::connectCommonActions()
ui.actionSoftwareConfig->setChecked(true);
ui.actionSoftwareConfig->activate(QAction::Trigger);
}
if (currentView == VIEW_FIRMWAREUPDATE)
{
ui.actionFirmwareUpdateView->setChecked(true);
ui.actionFirmwareUpdateView->activate(QAction::Trigger);
}
if (currentView == VIEW_TERMINAL)
{
ui.actionTerminalView->setChecked(true);
......@@ -1509,7 +1504,6 @@ void MainWindow::connectCommonActions()
connect(ui.actionTerminalView,SIGNAL(triggered()),this,SLOT(loadTerminalView()));
}
connect(ui.actionFirmwareUpdateView, SIGNAL(triggered()), this, SLOT(loadFirmwareUpdateView()));
connect(ui.actionMavlinkView, SIGNAL(triggered()), this, SLOT(loadMAVLinkView()));
// Help Actions
......@@ -2027,9 +2021,9 @@ void MainWindow::loadViewState()
case VIEW_MAVLINK:
centerStack->setCurrentWidget(mavlinkView);
break;
case VIEW_FIRMWAREUPDATE:
centerStack->setCurrentWidget(firmwareUpdateWidget);
break;
// case VIEW_FIRMWAREUPDATE:
// centerStack->setCurrentWidget(firmwareUpdateWidget);
// break;
case VIEW_MISSION:
centerStack->setCurrentWidget(plannerView);
break;
......@@ -2190,17 +2184,6 @@ void MainWindow::loadMAVLinkView()
}
}
void MainWindow::loadFirmwareUpdateView()
{
if (currentView != VIEW_FIRMWAREUPDATE)
{
storeViewState();
currentView = VIEW_FIRMWAREUPDATE;
ui.actionFirmwareUpdateView->setChecked(true);
loadViewState();
}
}
//void MainWindow::loadDataView(QString fileName)
//{
// // Plot is now selected, now load data from file
......
......@@ -240,8 +240,6 @@ public slots:
void loadOperatorView();
/** @brief Load MAVLink XML generator view */
void loadMAVLinkView();
/** @brief Load firmware update view */
void loadFirmwareUpdateView();
/** @brief Load Terminal Console views */
void loadTerminalView();
......
......@@ -97,14 +97,15 @@ void ParameterInterface::addUAS(UASInterface* uas)
return;
}
QGCParamWidget* param = new QGCParamWidget(uas, this);
param->init();
QGCParamWidget* paramWidget = new QGCParamWidget(this);
paramWidget = (QGCParamWidget*)paramWidget->initWithUAS(uas);
QString ptrStr;
ptrStr.sprintf("QGCParamWidget %8p (parent %8p)", param,this);
ptrStr.sprintf("QGCParamWidget %8p (parent %8p)", paramWidget,this);
qDebug() << "Created " << ptrStr << " for UAS id: " << uasId << " count: " << paramWidgets->count();
paramWidgets->insert(uasId, param);
m_ui->stackedWidget->addWidget(param);
paramWidgets->insert(uasId, paramWidget);
m_ui->stackedWidget->addWidget(paramWidget);
QGCSensorSettingsWidget* sensor = NULL;
......@@ -119,7 +120,7 @@ void ParameterInterface::addUAS(UASInterface* uas)
// Clear
if (m_ui->sensorSettings && sensor)
m_ui->sensorSettings->setCurrentWidget(sensor);
m_ui->stackedWidget->setCurrentWidget(param);
m_ui->stackedWidget->setCurrentWidget(paramWidget);
curr = 0;
}
}
......
......@@ -357,6 +357,7 @@ void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, double roll, double
if (yaw<0) yaw+=360;
this->heading = yaw;
}
}
void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, int component, double roll, double pitch, double yaw, quint64 timestamp)
......
#include "QGCBaseParamWidget.h"
#include <QFileDialog>
#include <QFile>
#include <QVariant>
#include <QTextStream>>
#include "QGCUASParamManager.h"
#include "UASInterface.h"
QGCBaseParamWidget::QGCBaseParamWidget(QWidget *parent) :
QWidget(parent),
mav(NULL),
paramMgr(NULL),
updatingParamNameLock("")
{
}
QGCBaseParamWidget* QGCBaseParamWidget::initWithUAS(UASInterface *uas)
{
setUAS(uas);
return this;
}
void QGCBaseParamWidget::setUAS(UASInterface* uas)
{
if (uas != mav) {
if (mav) {
//TODO disconnect any connections as needed
disconnectViewSignalsAndSlots();
disconnectFromParamManager();
clearOnboardParamDisplay();
clearPendingParamDisplay();
}
mav = uas;
if (mav) {
connectToParamManager();
connectViewSignalsAndSlots();
layoutWidget();
paramMgr->requestParameterListIfEmpty();
}
}
}
void QGCBaseParamWidget::connectToParamManager()
{
paramMgr = mav->getParamManager();
//TODO route via paramManager instead?
// Listen to updated param signals from the data model
connect(paramMgr, SIGNAL(parameterUpdated(int, QString , QVariant )),
this, SLOT(handleOnboardParamUpdate(int,QString,QVariant)));
connect(paramMgr, SIGNAL(pendingParamUpdate(int , const QString&, QVariant , bool )),
this, SLOT(handlePendingParamUpdate(int , const QString& , QVariant, bool )));
// Listen for param list reload finished
connect(paramMgr, SIGNAL(parameterListUpToDate()),
this, SLOT(handleOnboardParameterListUpToDate()));
// Listen to communications status messages so we can display them
connect(paramMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)),
this, SLOT(handleParamStatusMsgUpdate(QString , int )));
}
void QGCBaseParamWidget::disconnectFromParamManager()
{
disconnect(paramMgr, SIGNAL(parameterUpdated(int, QString , QVariant )),
this, SLOT(handleOnboardParamUpdate(int,QString,QVariant)));
disconnect(paramMgr, SIGNAL(pendingParamUpdate(int , const QString&, QVariant , bool )),
this, SLOT(handlePendingParamUpdate(int , const QString& , QVariant, bool )));
disconnect(paramMgr, SIGNAL(parameterListUpToDate()),
this, SLOT(handleOnboardParameterListUpToDate()));
// Listen to communications status messages so we can display them
disconnect(paramMgr, SIGNAL(parameterStatusMsgUpdated(QString,int)),
this, SLOT(handleParamStatusMsgUpdate(QString , int )));
paramMgr = NULL;
}
void QGCBaseParamWidget::requestOnboardParamsUpdate()
{
paramMgr->requestParameterList();
}
void QGCBaseParamWidget::saveParametersToFile()
{
if (!mav)
return;
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "./parameters.txt", tr("Parameter File (*.txt)"));
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
return;
}
QTextStream outstream(&file);
paramMgr->writeOnboardParamsToStream(outstream,mav->getUASName());
file.close();
}
void QGCBaseParamWidget::loadParametersFromFile()
{
if (!mav)
return;
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Parameter file (*.txt)"));
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QTextStream in(&file);
paramMgr->readPendingParamsFromStream(in);
file.close();
}
#ifndef QGCBASEPARAMWIDGET_H
#define QGCBASEPARAMWIDGET_H
#include <QVariant>
#include <QWidget>
//forward declarations
class QGCUASParamManager;
class UASInterface;
class QGCBaseParamWidget : public QWidget
{
Q_OBJECT
public:
explicit QGCBaseParamWidget(QWidget *parent = 0);
virtual QGCBaseParamWidget* initWithUAS(UASInterface* uas);///< Two-stage construction: initialize this object
virtual void setUAS(UASInterface* uas);///< Allows swapping the underlying UAS
protected:
virtual void setParameterStatusMsg(const QString& msg) = 0;
virtual void layoutWidget() = 0;///< Layout the appearance of this widget
virtual void connectViewSignalsAndSlots() = 0;///< Connect view signals/slots as needed
virtual void disconnectViewSignalsAndSlots() = 0;///< Disconnect view signals/slots as needed
virtual void connectToParamManager(); ///>Connect to any required param manager signals
virtual void disconnectFromParamManager(); ///< Disconnect from any connected param manager signals
signals:
public slots:
virtual void handleOnboardParamUpdate(int component,const QString& parameterName, QVariant value) = 0;
virtual void handlePendingParamUpdate(int compId, const QString& paramName, QVariant value, bool isPending) = 0;
virtual void handleOnboardParameterListUpToDate() = 0;
virtual void handleParamStatusMsgUpdate(QString msg, int level) = 0;
/** @brief Clear the rendering of onboard parameters */
virtual void clearOnboardParamDisplay() = 0;
/** @brief Clear the rendering of pending parameters */
virtual void clearPendingParamDisplay() = 0;
/** @brief Request list of parameters from MAV */
virtual void requestOnboardParamsUpdate();
/** @brief Store parameters to a file */
virtual void saveParametersToFile();
/** @brief Load parameters from a file */
virtual void loadParametersFromFile();
protected:
QGCUASParamManager* paramMgr;
UASInterface* mav;
QString updatingParamNameLock; ///< Name of param currently being updated-- used for reducing echo on param change
};
#endif // QGCBASEPARAMWIDGET_H
......@@ -4,18 +4,33 @@
#include "QGCPX4VehicleConfig.h"
#include "QGCVehicleConfig.h"
#include "QGCPX4VehicleConfig.h"
#include "MainWindow.h"
QGCConfigView::QGCConfigView(QWidget *parent) :
QWidget(parent),
ui(new Ui::QGCConfigView),
config(NULL),
mav(NULL)
{
ui->setupUi(this);
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(activeUASChanged(UASInterface*)));
//don't show a configuration widget if no vehicle is connected
//show a placeholder informational widget instead
// The config screens are required for firmware uploading
if (MainWindow::instance()->getCustomMode() == MainWindow::CUSTOM_MODE_PX4) {
ui->gridLayout->removeWidget(ui->waitingLabel);
ui->waitingLabel->setVisible(false);
delete ui->waitingLabel;
ui->waitingLabel = NULL;
config = new QGCPX4VehicleConfig();
ui->gridLayout->addWidget(config);
} else {
//don't show a configuration widget if no vehicle is connected
//show a placeholder informational widget instead
}
}
......@@ -29,30 +44,53 @@ void QGCConfigView::activeUASChanged(UASInterface* uas)
if (mav == uas)
return;
//remove all child widgets since they could contain stale data
//for example, when we switch from one PX4 UAS to another UAS
foreach (QObject* obj, ui->gridLayout->children()) {
QWidget* w = dynamic_cast<QWidget*>(obj);
if (w) {
if (obj != ui->waitingLabel) {
ui->gridLayout->removeWidget(w);
delete obj;
}
}
}
int type = -1;
if (mav)
type = mav->getAutopilotType();
mav = uas;
if (NULL != mav) {
ui->gridLayout->removeWidget(ui->waitingLabel);
ui->waitingLabel->setVisible(false);
if (uas && type != uas->getAutopilotType()) {
if (ui->waitingLabel) {
ui->gridLayout->removeWidget(ui->waitingLabel);
ui->waitingLabel->setVisible(false);
}
//remove all child widgets since they could contain stale data
//for example, when we switch from one PX4 UAS to another UAS
foreach (QObject* obj, ui->gridLayout->children()) {
QWidget* w = dynamic_cast<QWidget*>(obj);
if (w) {
if (obj != ui->waitingLabel) {
ui->gridLayout->removeWidget(w);
delete obj;
}
}
}
int autopilotType = mav->getAutopilotType();
switch (autopilotType) {
case MAV_AUTOPILOT_PX4:
ui->gridLayout->addWidget(new QGCPX4VehicleConfig());
{
QGCPX4VehicleConfig* px4config = qobject_cast<QGCPX4VehicleConfig*>(config);
if (!px4config) {
if (config)
delete config;
config = new QGCPX4VehicleConfig();
ui->gridLayout->addWidget(config);
}
}
break;
default:
ui->gridLayout->addWidget(new QGCVehicleConfig());
{
QGCVehicleConfig* generalconfig = qobject_cast<QGCVehicleConfig*>(config);
if (!generalconfig) {
if (config)
delete config;
config = new QGCVehicleConfig();
ui->gridLayout->addWidget(config);
}
}
break;
}
}
......
......@@ -21,6 +21,7 @@ public slots:
private:
Ui::QGCConfigView *ui;
QWidget *config;
UASInterface* mav;
};
......
......@@ -14,6 +14,9 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="waitingLabel">
<property name="text">
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -37,72 +37,65 @@ This file is part of the QGROUNDCONTROL project
#include <QLabel>
#include <QTimer>
#include "QGCUASParamManager.h"
#include "UASInterface.h"
#include "QGCBaseParamWidget.h"
//forward declarations
class QGridLayout;
class UASInterface;
/**
* @brief Widget to read/set onboard parameters
*/
class QGCParamWidget : public QGCUASParamManager
class QGCParamWidget : public QGCBaseParamWidget
{
Q_OBJECT
public:
QGCParamWidget(UASInterface* uas, QWidget *parent = 0);
virtual void init(); ///< Two-stage construction: initialize the object
QGCParamWidget(QWidget *parent = 0);
protected:
virtual void setParameterStatusMsg(const QString& msg);
virtual void layoutWidget();///< Layout the appearance of this widget
virtual void connectSignalsAndSlots();///< Connect signals/slots as needed
virtual void connectViewSignalsAndSlots();///< Connect view signals/slots as needed
virtual void disconnectViewSignalsAndSlots();///< Connect view signals/slots as needed
virtual QTreeWidgetItem* getParentWidgetItemForParam(int compId, const QString& paramName);
virtual QTreeWidgetItem* findChildWidgetItemForParam(QTreeWidgetItem* parentItem, const QString& paramName);
signals:
public slots:
/** @brief Add a component to the list
/** @brief Add a component item as a child of this widget
* @param compId Component id of the component
* @param compName Human friendly name of the component
*/
void addComponentItem(int compId, QString compName);
virtual void addActionButtonsToLayout(QGridLayout* layout);
virtual void handleParameterUpdate(int component,const QString& parameterName, QVariant value);
virtual void handlePendingParamUpdate(int compId, const QString& paramName, QVariant value, bool isPending);
virtual void handleParameterListUpToDate();
signals:
public slots:
virtual void handleOnboardParamUpdate(int component,const QString& parameterName, QVariant value);
virtual void handlePendingParamUpdate(int compId, const QString& paramName, QVariant value, bool isPending);
virtual void handleOnboardParameterListUpToDate();
virtual void handleParamStatusMsgUpdate(QString msg, int level);
virtual void clearOnboardParamDisplay();
virtual void clearPendingParamDisplay();
/** @brief Ensure that view of parameter matches data in the model */
QTreeWidgetItem* updateParameterDisplay(int component, QString parameterName, QVariant value);
/** @brief Request list of parameters from MAV */
void requestAllParamsUpdate();
/** @brief Write the current parameters to permanent storage (EEPROM/HDD) */
void writeParameters();
/** @brief Read the parameters from permanent storage to RAM */
void readParameters();
/** @brief Clear the parameter list */
void clear();
/** @brief Update when user changes parameters */
void parameterItemChanged(QTreeWidgetItem* prev, int column);
/** @brief Store parameters to a file */
void saveParametersToFile();
/** @brief Load parameters from a file */
void loadParametersFromFile();
/** @brief Update when user changes parameters */
void parameterItemChanged(QTreeWidgetItem* prev, int column);
protected:
QTreeWidget* tree; ///< The parameter tree
QLabel* statusLabel; ///< User-facing parameter status label
QMap<int, QTreeWidgetItem*>* componentItems; ///< The tree of component items, stored by component ID
QMap<int, QMap<QString, QTreeWidgetItem*>* > paramGroups; ///< Parameter groups to organize component items
QString updatingParamNameLock; ///< Name of param currently being updated-- used for reducing echo on param change
QLabel* statusLabel; ///< User-facing parameter status label
QTreeWidget* tree; ///< The parameter tree
};
......
This diff is collapsed.
......@@ -4,17 +4,23 @@
#include "QGCParamWidget.h"
class QGridLayout;
class QGCPendingParamWidget : public QGCParamWidget
{
Q_OBJECT
public:
explicit QGCPendingParamWidget(QObject* parent);
virtual void init(); ///< Two-stage construction: initialize the object
protected:
virtual void connectSignalsAndSlots();
virtual void connectToParamManager();
virtual void disconnectFromParamManager();
virtual void connectViewSignalsAndSlots();
virtual void disconnectViewSignalsAndSlots();
virtual void addActionButtonsToLayout(QGridLayout* layout);
signals:
......
......@@ -4,18 +4,18 @@ QGCTabbedInfoView::QGCTabbedInfoView(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
messageView = new QGCMessageView(this);
actionsWidget = new UASActionsWidget(this);
//actionsWidget = new UASActionsWidget(this);
quickView = new UASQuickView(this);
rawView = new UASRawStatusView(this);
//rawView = new UASRawStatusView(this);
ui.tabWidget->addTab(quickView,"Quick");
ui.tabWidget->addTab(actionsWidget,"Actions");
ui.tabWidget->addTab(rawView,"Status");
//ui.tabWidget->addTab(actionsWidget,"Actions");
//ui.tabWidget->addTab(rawView,"Status");
ui.tabWidget->addTab(messageView,"Messages");
}
void QGCTabbedInfoView::addSource(MAVLinkDecoder *decoder)
{
m_decoder = decoder;
rawView->addSource(decoder);
//rawView->addSource(decoder);
quickView->addSource(decoder);
}
......
This diff is collapsed.
......@@ -31,6 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include <QLabel>
#include <QProgressBar>
#include <QComboBox>
#include <QTimer>
#include "UASInterface.h"
#include "QGCMAVLinkLogPlayer.h"
#include "SerialLink.h"
......@@ -84,13 +85,19 @@ public slots:
void clearStatusString();
/** @brief Set an activity action as checked in menu */
void advancedActivityTriggered(QAction* action);
void updateComboBox();
/**
* @brief User selected baud rate
* @param index The current index of the combo box
*/
void baudSelected(int index);
protected:
void storeSettings();
void loadSettings();
void createUI();
void resetToolbarUI();
void updateComboBox();
UASInterface* mav;
QLabel* symbolLabel;
QLabel* toolBarNameLabel;
......@@ -108,6 +115,8 @@ protected:
QGCMAVLinkLogPlayer* player;
QComboBox *portComboBox;
QComboBox *baudcomboBox;
QTimer portBoxTimer;
bool userBaudChoice;
bool changed;
float batteryPercent;
float batteryVoltage;
......
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