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

Toolbar and calibration improvements

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