Commit 1d1d3fdf authored by Lorenz Meier's avatar Lorenz Meier
Browse files

Toolbar and calibration improvements

parent 5948605c
...@@ -97,11 +97,11 @@ QGCToolBar::QGCToolBar(QWidget *parent) : ...@@ -97,11 +97,11 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
toolBarWpLabel = new QLabel("WP--", this); toolBarWpLabel = new QLabel("WP--", this);
toolBarWpLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 18px; color: #3C7B9E; }"); toolBarWpLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 18px; color: #3C7B9E; }");
toolBarWpLabel->setToolTip(tr("Current mission")); toolBarWpLabel->setToolTip(tr("Current waypoint"));
addWidget(toolBarWpLabel); addWidget(toolBarWpLabel);
toolBarDistLabel = new QLabel("--- ---- m", this); toolBarDistLabel = new QLabel("--- ---- m", this);
toolBarDistLabel->setToolTip(tr("Distance to current mission")); toolBarDistLabel->setToolTip(tr("Distance to current waypoint"));
addWidget(toolBarDistLabel); addWidget(toolBarDistLabel);
toolBarMessageLabel = new QLabel("No system messages.", this); toolBarMessageLabel = new QLabel("No system messages.", this);
...@@ -109,6 +109,12 @@ QGCToolBar::QGCToolBar(QWidget *parent) : ...@@ -109,6 +109,12 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
toolBarMessageLabel->setToolTip(tr("Most recent system message")); toolBarMessageLabel->setToolTip(tr("Most recent system message"));
addWidget(toolBarMessageLabel); addWidget(toolBarMessageLabel);
connectButton = new QPushButton(tr("Connect"), this);
connectButton->setCheckable(true);
connectButton->setToolTip(tr("Connect wireless link to MAV"));
addWidget(connectButton);
connect(connectButton, SIGNAL(clicked(bool)), this, SLOT(connectLink(bool)));
// DONE INITIALIZING BUTTONS // DONE INITIALIZING BUTTONS
// Configure the toolbar for the current default UAS // Configure the toolbar for the current default UAS
...@@ -450,6 +456,31 @@ void QGCToolBar::receiveTextMessage(int uasid, int componentid, int severity, QS ...@@ -450,6 +456,31 @@ void QGCToolBar::receiveTextMessage(int uasid, int componentid, int severity, QS
lastSystemMessage = text; lastSystemMessage = text;
} }
void QGCToolBar::connectLink(bool connect)
{
if (connect && LinkManager::instance()->getLinks().count() < 3)
{
MainWindow::instance()->addLink();
} else if (connect) {
LinkManager::instance()->getLinks().last()->connect();
} else if (!connect && LinkManager::instance()->getLinks().count() > 2) {
LinkManager::instance()->getLinks().last()->disconnect();
}
if (LinkManager::instance()->getLinks().count() > 2) {
if (LinkManager::instance()->getLinks().last()->isConnected())
{
connectButton->setText(tr("Disconnect"));
}
else
{
connectButton->setText(tr("Connect"));
}
}
}
QGCToolBar::~QGCToolBar() QGCToolBar::~QGCToolBar()
{ {
if (toggleLoggingAction) toggleLoggingAction->deleteLater(); if (toggleLoggingAction) toggleLoggingAction->deleteLater();
......
...@@ -27,6 +27,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -27,6 +27,7 @@ This file is part of the QGROUNDCONTROL project
#include <QToolBar> #include <QToolBar>
#include <QAction> #include <QAction>
#include <QToolButton> #include <QToolButton>
#include <QPushButton>
#include <QLabel> #include <QLabel>
#include <QProgressBar> #include <QProgressBar>
#include "UASInterface.h" #include "UASInterface.h"
...@@ -72,6 +73,8 @@ public slots: ...@@ -72,6 +73,8 @@ public slots:
void updateView(); void updateView();
/** @brief Update connection timeout time */ /** @brief Update connection timeout time */
void heartbeatTimeout(bool timeout, unsigned int ms); void heartbeatTimeout(bool timeout, unsigned int ms);
/** @brief Create or connect link */
void connectLink(bool connect);
protected: protected:
void createCustomWidgets(); void createCustomWidgets();
...@@ -88,6 +91,7 @@ protected: ...@@ -88,6 +91,7 @@ protected:
QLabel* toolBarWpLabel; QLabel* toolBarWpLabel;
QLabel* toolBarDistLabel; QLabel* toolBarDistLabel;
QLabel* toolBarMessageLabel; QLabel* toolBarMessageLabel;
QPushButton* connectButton;
QProgressBar* toolBarBatteryBar; QProgressBar* toolBarBatteryBar;
QLabel* toolBarBatteryVoltageLabel; QLabel* toolBarBatteryVoltageLabel;
QGCMAVLinkLogPlayer* player; QGCMAVLinkLogPlayer* player;
......
...@@ -235,8 +235,8 @@ void QGCVehicleConfig::resetCalibrationRC() ...@@ -235,8 +235,8 @@ void QGCVehicleConfig::resetCalibrationRC()
{ {
for (unsigned int i = 0; i < chanMax; ++i) for (unsigned int i = 0; i < chanMax; ++i)
{ {
rcMin[i] = (float)INT_MAX; rcMin[i] = 1200;
rcMax[i] = (float)INT_MIN; rcMax[i] = 1800;
} }
} }
......
Supports Markdown
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