Browse Source

Merged master

QGC4.4
Lorenz Meier 12 years ago
parent
commit
771732f936
  1. 11
      qgroundcontrol.pri
  2. 1
      qgroundcontrol.pro
  3. 25
      src/QGCCore.cc
  4. 67
      src/uas/UAS.cc
  5. 4
      src/uas/UAS.h
  6. 12
      src/ui/QGCParamWidget.cc
  7. 60
      src/ui/map/QGCMapToolBar.cc
  8. 4
      src/ui/map/QGCMapToolBar.h
  9. 7
      src/ui/map/QGCMapWidget.cc
  10. 14
      src/ui/uas/QGCMessageView.cc
  11. 17
      src/ui/uas/UASControlWidget.cc

11
qgroundcontrol.pri

@ -192,7 +192,8 @@ linux-g++|linux-g++-64{
INCLUDEPATH += /usr/include \ INCLUDEPATH += /usr/include \
/usr/local/include \ /usr/local/include \
/usr/include/qt4/phonon /usr/include/qt4/phonon \
/usr/include/phonon
LIBS += \ LIBS += \
-L/usr/lib \ -L/usr/lib \
@ -228,7 +229,8 @@ linux-g++|linux-g++-64{
DEFINES += QGC_OSG_QT_ENABLED DEFINES += QGC_OSG_QT_ENABLED
} }
exists(/usr/local/include/google/protobuf) { exists(/usr/local/include/google/protobuf) |
exists(/usr/include/google/protobuf) {
message("Building support for Protocol Buffers") message("Building support for Protocol Buffers")
DEPENDENCIES_PRESENT += protobuf DEPENDENCIES_PRESENT += protobuf
# Include Protocol Buffers libraries # Include Protocol Buffers libraries
@ -239,7 +241,8 @@ linux-g++|linux-g++-64{
DEFINES += QGC_PROTOBUF_ENABLED DEFINES += QGC_PROTOBUF_ENABLED
} }
exists(/usr/local/include/libfreenect/libfreenect.h) { exists(/usr/local/include/libfreenect/libfreenect.h) |
exists(/usr/include/libfreenect/libfreenect.h) {
message("Building support for libfreenect") message("Building support for libfreenect")
DEPENDENCIES_PRESENT += libfreenect DEPENDENCIES_PRESENT += libfreenect
INCLUDEPATH += /usr/include/libusb-1.0 INCLUDEPATH += /usr/include/libusb-1.0
@ -269,7 +272,7 @@ linux-g++ {
linux-g++-64 { linux-g++-64 {
message("Building for GNU/Linux 64bit/x64 (g++-64)") message("Building for GNU/Linux 64bit/x64 (g++-64)")
exists(/usr/local/lib64) { exists(/usr/local/lib64) {
LIBS += -L/usr/local/lib64 LIBS += -L/usr/local/lib64 -L/usr/lib64
} }
} }

1
qgroundcontrol.pro

@ -382,7 +382,6 @@ HEADERS += src/MG.h \
src/ui/QGCMAVLinkInspector.h \ src/ui/QGCMAVLinkInspector.h \
src/ui/MAVLinkDecoder.h \ src/ui/MAVLinkDecoder.h \
src/ui/WaypointViewOnlyView.h \ src/ui/WaypointViewOnlyView.h \
src/ui/WaypointViewOnlyView.h \
src/ui/WaypointEditableView.h \ src/ui/WaypointEditableView.h \
src/ui/QGCRGBDView.h \ src/ui/QGCRGBDView.h \
src/ui/mavlink/QGCMAVLinkMessageSender.h \ src/ui/mavlink/QGCMAVLinkMessageSender.h \

25
src/QGCCore.cc

@ -148,6 +148,9 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv)
// first messages arrive // first messages arrive
UDPLink* udpLink = new UDPLink(QHostAddress::Any, 14550); UDPLink* udpLink = new UDPLink(QHostAddress::Any, 14550);
MainWindow::instance()->addLink(udpLink); MainWindow::instance()->addLink(udpLink);
// Listen on Multicast-Address 239.255.77.77, Port 14550
//QHostAddress * multicast_udp = new QHostAddress("239.255.77.77");
//UDPLink* udpLink = new UDPLink(*multicast_udp, 14550);
#ifdef OPAL_RT #ifdef OPAL_RT
// Add OpalRT Link, but do not connect // Add OpalRT Link, but do not connect
@ -168,7 +171,27 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv)
if (upgraded) mainWindow->showInfoMessage(tr("Default Settings Loaded"), if (upgraded) mainWindow->showInfoMessage(tr("Default Settings Loaded"),
tr("qgroundcontrol has been upgraded from version %1 to version %2. Some of your user preferences have been reset to defaults for safety reasons. Please adjust them where needed.").arg(lastApplicationVersion).arg(QGC_APPLICATION_VERSION)); tr("qgroundcontrol has been upgraded from version %1 to version %2. Some of your user preferences have been reset to defaults for safety reasons. Please adjust them where needed.").arg(lastApplicationVersion).arg(QGC_APPLICATION_VERSION));
// Check if link could be connected
if (!udpLink->connect())
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText("Could not connect UDP port. Is an instance of " + qAppName() + "already running?");
msgBox.setInformativeText("It is recommended to close the application and stop all instances. Click Yes to close.");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
int ret = msgBox.exec();
// Close the message box shortly after the click to prevent accidental clicks
QTimer::singleShot(15000, &msgBox, SLOT(reject()));
// Exit application
if (ret == QMessageBox::Yes)
{
//mainWindow->close();
QTimer::singleShot(200, mainWindow, SLOT(close()));
}
}
} }
/** /**

67
src/uas/UAS.cc

@ -38,7 +38,10 @@
* as the previous one created unless one calls deleteSettings in the code after * as the previous one created unless one calls deleteSettings in the code after
* creating the UAS. * creating the UAS.
*/ */
UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
lipoFull(4.2f),
lipoEmpty(3.5f),
uasId(id), uasId(id),
links(new QList<LinkInterface*>()), links(new QList<LinkInterface*>()),
unknownPackets(), unknownPackets(),
@ -3329,41 +3332,51 @@ QString UAS::getAudioModeTextFor(int id)
* The mode returned can be auto, stabilized, test, manual, preflight or unknown. * The mode returned can be auto, stabilized, test, manual, preflight or unknown.
* @return the short text of the mode for the id given. * @return the short text of the mode for the id given.
*/ */
/**
* The mode returned can be auto, stabilized, test, manual, preflight or unknown.
* @return the short text of the mode for the id given.
*/
QString UAS::getShortModeTextFor(int id) QString UAS::getShortModeTextFor(int id)
{ {
QString mode; QString mode = "";
uint8_t modeid = id; uint8_t modeid = id;
qDebug() << "MODE:" << modeid;
// BASE MODE DECODING // BASE MODE DECODING
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_AUTO)
{ if (modeid == 0)
mode += "|AUTO";
}
else if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_GUIDED)
{
mode += "|VECTOR";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_STABILIZE)
{
mode += "|STABILIZED";
}
else if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_TEST)
{
mode += "|TEST";
}
else if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_MANUAL)
{
mode += "|MANUAL";
}
else if (modeid == 0)
{ {
mode = "|PREFLIGHT"; mode = "|PREFLIGHT";
} }
else else {
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_AUTO){
mode += "|AUTO";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_MANUAL){
mode += "|MANUAL";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_GUIDED){
mode += "|VECTOR";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_STABILIZE){
mode += "|STABILIZED";
}
if (modeid & (uint8_t)MAV_MODE_FLAG_DECODE_POSITION_TEST){
mode += "|TEST";
}
}
if (mode.length() == 0)
{ {
mode = "|UNKNOWN"; mode = "|UNKNOWN";
qDebug() << __FILE__ << __LINE__ << " Unknown modeid: " << modeid;
} }
// ARMED STATE DECODING // ARMED STATE DECODING
@ -3382,6 +3395,8 @@ QString UAS::getShortModeTextFor(int id)
mode.prepend("HIL:"); mode.prepend("HIL:");
} }
qDebug() << "MODE: " << modeid << " " << mode;
return mode; return mode;
} }
@ -3445,8 +3460,8 @@ void UAS::setBattery(BatteryType type, int cells)
case LIION: case LIION:
break; break;
case LIPOLY: case LIPOLY:
fullVoltage = this->cells * UAS::lipoFull; fullVoltage = this->cells * lipoFull;
emptyVoltage = this->cells * UAS::lipoEmpty; emptyVoltage = this->cells * lipoEmpty;
break; break;
case LIFE: case LIFE:
break; break;

4
src/uas/UAS.h

@ -56,8 +56,8 @@ public:
UAS(MAVLinkProtocol* protocol, int id = 0); UAS(MAVLinkProtocol* protocol, int id = 0);
~UAS(); ~UAS();
static const int lipoFull = 4.2f; ///< 100% charged voltage float lipoFull; ///< 100% charged voltage
static const int lipoEmpty = 3.5f; ///< Discharged voltage float lipoEmpty; ///< Discharged voltage
/* MANAGEMENT */ /* MANAGEMENT */

12
src/ui/QGCParamWidget.cc

@ -705,7 +705,7 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
current->setBackground(1, QBrush(QColor(QGC::colorOrange))); current->setBackground(1, QBrush(QColor(QGC::colorOrange)));
} }
switch (parameters.value(key)->value(str).type()) switch ((int)parameters.value(key)->value(str).type())
{ {
case QVariant::Int: case QVariant::Int:
{ {
@ -766,7 +766,7 @@ void QGCParamWidget::saveParameters()
{ {
QString paramValue("%1"); QString paramValue("%1");
QString paramType("%1"); QString paramType("%1");
switch (j.value().type()) switch ((int)j.value().type())
{ {
case QVariant::Int: case QVariant::Int:
paramValue = paramValue.arg(j.value().toInt()); paramValue = paramValue.arg(j.value().toInt());
@ -777,7 +777,9 @@ void QGCParamWidget::saveParameters()
paramType = paramType.arg(MAV_PARAM_TYPE_UINT32); paramType = paramType.arg(MAV_PARAM_TYPE_UINT32);
break; break;
case QMetaType::Float: case QMetaType::Float:
paramValue = paramValue.arg(j.value().toDouble(), 25, 'g', 12); // We store parameters as floats, with only 6 digits of precision guaranteed for decimal string conversion
// (see IEEE 754, 32 bit single-precision)
paramValue = paramValue.arg((double)j.value().toFloat(), 25, 'g', 6);
paramType = paramType.arg(MAV_PARAM_TYPE_REAL32); paramType = paramType.arg(MAV_PARAM_TYPE_REAL32);
break; break;
default: default:
@ -955,7 +957,7 @@ void QGCParamWidget::retransmissionGuardTick()
if (count < retransmissionBurstRequestSize) { if (count < retransmissionBurstRequestSize) {
// Re-request write operation // Re-request write operation
QVariant value = missingParams->value(key); QVariant value = missingParams->value(key);
switch (parameters.value(component)->value(key).type()) switch ((int)parameters.value(component)->value(key).type())
{ {
case QVariant::Int: case QVariant::Int:
{ {
@ -1025,7 +1027,7 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant
return; return;
} }
switch (parameters.value(component)->value(parameterName).type()) switch ((int)parameters.value(component)->value(parameterName).type())
{ {
case QVariant::Char: case QVariant::Char:
{ {

60
src/ui/map/QGCMapToolBar.cc

@ -7,8 +7,10 @@ QGCMapToolBar::QGCMapToolBar(QWidget *parent) :
ui(new Ui::QGCMapToolBar), ui(new Ui::QGCMapToolBar),
map(NULL), map(NULL),
optionsMenu(this), optionsMenu(this),
mapTypesMenu(this),
trailPlotMenu(this), trailPlotMenu(this),
updateTimesMenu(this), updateTimesMenu(this),
mapTypesGroup(new QActionGroup(this)),
trailSettingsGroup(new QActionGroup(this)), trailSettingsGroup(new QActionGroup(this)),
updateTimesGroup(new QActionGroup(this)) updateTimesGroup(new QActionGroup(this))
{ {
@ -45,21 +47,43 @@ void QGCMapToolBar::setMap(QGCMapWidget* map)
// Set exclusive items // Set exclusive items
trailSettingsGroup->setExclusive(true); trailSettingsGroup->setExclusive(true);
updateTimesGroup->setExclusive(true); updateTimesGroup->setExclusive(true);
mapTypesGroup->setExclusive(true);
// Build up menu // Build up menu
trailPlotMenu.setTitle(tr("&Add trail dot every..")); trailPlotMenu.setTitle(tr("&Add trail dot every.."));
updateTimesMenu.setTitle(tr("&Limit map view update rate to..")); updateTimesMenu.setTitle(tr("&Limit map view update rate to.."));
mapTypesMenu.setTitle(tr("&Map type"));
// FIXME MARK CURRENT VALUES IN MENU
QAction* action = trailPlotMenu.addAction(tr("No trail"), this, SLOT(setUAVTrailTime())); //setup the mapTypesMenu
action->setData(-1); QAction* action;
action = mapTypesMenu.addAction(tr("Bing Hybrid"),this,SLOT(setMapType()));
action->setData(MapType::BingHybrid);
action->setCheckable(true);
mapTypesGroup->addAction(action);
action = mapTypesMenu.addAction(tr("Google Hybrid"),this,SLOT(setMapType()));
action->setData(MapType::GoogleHybrid);
action->setCheckable(true);
mapTypesGroup->addAction(action);
action = mapTypesMenu.addAction(tr("OpenStreetMap"),this,SLOT(setMapType()));
action->setData(MapType::OpenStreetMap);
action->setCheckable(true); action->setCheckable(true);
trailSettingsGroup->addAction(action); mapTypesGroup->addAction(action);
//TODO check current item
optionsMenu.addMenu(&mapTypesMenu);
// FIXME MARK CURRENT VALUES IN MENU
QAction *defaultTrailAction = trailPlotMenu.addAction(tr("No trail"), this, SLOT(setUAVTrailTime()));
defaultTrailAction->setData(-1);
defaultTrailAction->setCheckable(true);
trailSettingsGroup->addAction(defaultTrailAction);
for (int i = 0; i < uavTrailTimeCount; ++i) for (int i = 0; i < uavTrailTimeCount; ++i)
{ {
QAction* action = trailPlotMenu.addAction(tr("%1 second%2").arg(uavTrailTimeList[i]).arg((uavTrailTimeList[i] > 1) ? "s" : ""), this, SLOT(setUAVTrailTime())); action = trailPlotMenu.addAction(tr("%1 second%2").arg(uavTrailTimeList[i]).arg((uavTrailTimeList[i] > 1) ? "s" : ""), this, SLOT(setUAVTrailTime()));
action->setData(uavTrailTimeList[i]); action->setData(uavTrailTimeList[i]);
action->setCheckable(true); action->setCheckable(true);
trailSettingsGroup->addAction(action); trailSettingsGroup->addAction(action);
@ -71,7 +95,7 @@ void QGCMapToolBar::setMap(QGCMapWidget* map)
} }
for (int i = 0; i < uavTrailDistanceCount; ++i) for (int i = 0; i < uavTrailDistanceCount; ++i)
{ {
QAction* action = trailPlotMenu.addAction(tr("%1 meter%2").arg(uavTrailDistanceList[i]).arg((uavTrailDistanceList[i] > 1) ? "s" : ""), this, SLOT(setUAVTrailDistance())); action = trailPlotMenu.addAction(tr("%1 meter%2").arg(uavTrailDistanceList[i]).arg((uavTrailDistanceList[i] > 1) ? "s" : ""), this, SLOT(setUAVTrailDistance()));
action->setData(uavTrailDistanceList[i]); action->setData(uavTrailDistanceList[i]);
action->setCheckable(true); action->setCheckable(true);
trailSettingsGroup->addAction(action); trailSettingsGroup->addAction(action);
@ -85,7 +109,7 @@ void QGCMapToolBar::setMap(QGCMapWidget* map)
// Set no trail checked if no action is checked yet // Set no trail checked if no action is checked yet
if (!trailSettingsGroup->checkedAction()) if (!trailSettingsGroup->checkedAction())
{ {
action->setChecked(true); defaultTrailAction->setChecked(true);
} }
optionsMenu.addMenu(&trailPlotMenu); optionsMenu.addMenu(&trailPlotMenu);
@ -119,7 +143,6 @@ void QGCMapToolBar::setMap(QGCMapWidget* map)
} }
optionsMenu.addMenu(&updateTimesMenu); optionsMenu.addMenu(&updateTimesMenu);
ui->optionsButton->setMenu(&optionsMenu); ui->optionsButton->setMenu(&optionsMenu);
} }
} }
@ -175,6 +198,23 @@ void QGCMapToolBar::setUpdateInterval()
} }
} }
void QGCMapToolBar::setMapType()
{
QObject* sender = QObject::sender();
QAction* action = qobject_cast<QAction*>(sender);
if (action)
{
bool ok;
int mapType = action->data().toInt(&ok);
if (ok)
{
map->SetMapType((MapType::Types)mapType);
ui->posLabel->setText(tr("Map type: %1").arg(mapType));
}
}
}
void QGCMapToolBar::tileLoadStart() void QGCMapToolBar::tileLoadStart()
{ {
ui->posLabel->setText(tr("Starting to load tiles..")); ui->posLabel->setText(tr("Starting to load tiles.."));
@ -201,10 +241,12 @@ void QGCMapToolBar::tileLoadProgress(int progress)
} }
} }
QGCMapToolBar::~QGCMapToolBar() QGCMapToolBar::~QGCMapToolBar()
{ {
delete ui; delete ui;
delete trailSettingsGroup; delete trailSettingsGroup;
delete updateTimesGroup; delete updateTimesGroup;
delete mapTypesGroup;
// FIXME Delete all actions // FIXME Delete all actions
} }

4
src/ui/map/QGCMapToolBar.h

@ -28,6 +28,7 @@ public slots:
void setUAVTrailTime(); void setUAVTrailTime();
void setUAVTrailDistance(); void setUAVTrailDistance();
void setUpdateInterval(); void setUpdateInterval();
void setMapType();
private: private:
Ui::QGCMapToolBar *ui; Ui::QGCMapToolBar *ui;
@ -37,8 +38,11 @@ protected:
QMenu optionsMenu; QMenu optionsMenu;
QMenu trailPlotMenu; QMenu trailPlotMenu;
QMenu updateTimesMenu; QMenu updateTimesMenu;
QMenu mapTypesMenu;
QActionGroup* trailSettingsGroup; QActionGroup* trailSettingsGroup;
QActionGroup* updateTimesGroup; QActionGroup* updateTimesGroup;
QActionGroup* mapTypesGroup;
}; };
#endif // QGCMAPTOOLBAR_H #endif // QGCMAPTOOLBAR_H

7
src/ui/map/QGCMapWidget.cc

@ -30,6 +30,12 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) :
defaultGuidedAlt = -1; defaultGuidedAlt = -1;
loadSettings(false); loadSettings(false);
//handy for debugging:
//this->SetShowTileGridLines(true);
//default appears to be Google Hybrid, and is broken currently
this->SetMapType(MapType::BingHybrid);
this->setContextMenuPolicy(Qt::ActionsContextMenu); this->setContextMenuPolicy(Qt::ActionsContextMenu);
QAction *guidedaction = new QAction(this); QAction *guidedaction = new QAction(this);
@ -519,6 +525,7 @@ void QGCMapWidget::updateHomePosition(double latitude, double longitude, double
void QGCMapWidget::goHome() void QGCMapWidget::goHome()
{ {
SetCurrentPosition(Home->Coord()); SetCurrentPosition(Home->Coord());
SetZoom(18); //zoom to "large RC park" size
} }
/** /**

14
src/ui/uas/QGCMessageView.cc

@ -4,6 +4,7 @@
#include "UASManager.h" #include "UASManager.h"
#include "QGCUnconnectedInfoWidget.h" #include "QGCUnconnectedInfoWidget.h"
#include <QMenu> #include <QMenu>
#include <QScrollBar>
QGCMessageView::QGCMessageView(QWidget *parent) : QGCMessageView::QGCMessageView(QWidget *parent) :
QWidget(parent), QWidget(parent),
@ -55,9 +56,18 @@ void QGCMessageView::handleTextMessage(int uasid, int componentid, int severity,
{ {
// XXX color messages according to severity // XXX color messages according to severity
ui->plainTextEdit->appendHtml(QString("<font color=\"%1\">[%2:%3] %4</font>\n").arg(UASManager::instance()->getUASForId(uasid)->getColor().name()).arg(UASManager::instance()->getUASForId(uasid)->getUASName()).arg(componentid).arg(text)); QPlainTextEdit *msgWidget = ui->plainTextEdit;
//turn off updates while we're appending content to avoid breaking the autoscroll behavior
msgWidget->setUpdatesEnabled(false);
QScrollBar *scroller = msgWidget->verticalScrollBar();
UASInterface *uas = UASManager::instance()->getUASForId(uasid);
msgWidget->appendHtml(QString("<font color=\"%1\">[%2:%3] %4</font>\n").arg(uas->getColor().name()).arg(uas->getUASName()).arg(componentid).arg(text));
// Ensure text area scrolls correctly // Ensure text area scrolls correctly
ui->plainTextEdit->ensureCursorVisible(); scroller->setValue(scroller->maximum());
msgWidget->setUpdatesEnabled(true);
} }
void QGCMessageView::contextMenuEvent(QContextMenuEvent* event) void QGCMessageView::contextMenuEvent(QContextMenuEvent* event)

17
src/ui/uas/UASControlWidget.cc

@ -51,12 +51,17 @@ UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent),
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setUAS(UASInterface*)));
ui.modeComboBox->clear(); ui.modeComboBox->clear();
ui.modeComboBox->insertItem(0, UAS::getShortModeTextFor(MAV_MODE_PREFLIGHT).remove(0, 2), MAV_MODE_PREFLIGHT); int modes[] = {
ui.modeComboBox->insertItem(1, UAS::getShortModeTextFor((MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_MANUAL_INPUT_ENABLED)).remove(0, 2), (MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_MANUAL_INPUT_ENABLED)); MAV_MODE_PREFLIGHT,
ui.modeComboBox->insertItem(2, UAS::getShortModeTextFor(MAV_MODE_FLAG_MANUAL_INPUT_ENABLED).remove(0, 2), MAV_MODE_FLAG_MANUAL_INPUT_ENABLED); MAV_MODE_FLAG_MANUAL_INPUT_ENABLED,
ui.modeComboBox->insertItem(3, UAS::getShortModeTextFor((MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_MANUAL_INPUT_ENABLED | MAV_MODE_FLAG_GUIDED_ENABLED)).remove(0, 2), (MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_MANUAL_INPUT_ENABLED | MAV_MODE_FLAG_GUIDED_ENABLED)); MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_MANUAL_INPUT_ENABLED,
ui.modeComboBox->insertItem(4, UAS::getShortModeTextFor((MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_MANUAL_INPUT_ENABLED | MAV_MODE_FLAG_GUIDED_ENABLED | MAV_MODE_FLAG_AUTO_ENABLED)).remove(0, 2), (MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_MANUAL_INPUT_ENABLED | MAV_MODE_FLAG_GUIDED_ENABLED | MAV_MODE_FLAG_AUTO_ENABLED)); MAV_MODE_FLAG_STABILIZE_ENABLED | MAV_MODE_FLAG_AUTO_ENABLED,
ui.modeComboBox->insertItem(5, UAS::getShortModeTextFor((MAV_MODE_FLAG_MANUAL_INPUT_ENABLED | MAV_MODE_FLAG_TEST_ENABLED)).remove(0, 2), (MAV_MODE_FLAG_MANUAL_INPUT_ENABLED | MAV_MODE_FLAG_TEST_ENABLED)); MAV_MODE_FLAG_MANUAL_INPUT_ENABLED | MAV_MODE_FLAG_TEST_ENABLED,
};
for (int i = 0; i < sizeof(modes) / sizeof(int); i++) {
int mode = modes[i];
ui.modeComboBox->insertItem(i, UAS::getShortModeTextFor(mode).remove(0, 2), mode);
}
connect(ui.modeComboBox, SIGNAL(activated(int)), this, SLOT(setMode(int))); connect(ui.modeComboBox, SIGNAL(activated(int)), this, SLOT(setMode(int)));
connect(ui.setModeButton, SIGNAL(clicked()), this, SLOT(transmitMode())); connect(ui.setModeButton, SIGNAL(clicked()), this, SLOT(transmitMode()));

Loading…
Cancel
Save