Commit 45d5c5e6 authored by Don Gagne's avatar Don Gagne

Remove unused code

parent c1e6f573
......@@ -272,7 +272,6 @@ FORMS += \
src/ui/AudioOutputWidget.ui \
src/ui/QGCSensorSettingsWidget.ui \
src/ui/QGCDataPlot2D.ui \
src/ui/QGCRemoteControlView.ui \
src/ui/QMap3D.ui \
src/ui/QGCWebView.ui \
src/ui/map3D/QGCGoogleEarthView.ui \
......@@ -290,7 +289,6 @@ FORMS += \
src/ui/QGCUDPLinkConfiguration.ui \
src/ui/QGCTCPLinkConfiguration.ui \
src/ui/SettingsDialog.ui \
src/ui/UASControlParameters.ui \
src/ui/map/QGCMapTool.ui \
src/ui/map/QGCMapToolBar.ui \
src/ui/QGCMAVLinkInspector.ui \
......@@ -317,7 +315,6 @@ FORMS += \
src/ui/QGCHilXPlaneConfiguration.ui \
src/ui/uas/UASQuickView.ui \
src/ui/uas/UASQuickViewItemSelect.ui \
src/ui/uas/UASActionsWidget.ui \
src/ui/QGCTabbedInfoView.ui \
src/ui/UASRawStatusView.ui \
src/ui/uas/QGCMessageView.ui \
......@@ -384,13 +381,6 @@ HEADERS += \
src/QGC.h \
src/ui/QGCDataPlot2D.h \
src/ui/linechart/IncrementalPlot.h \
src/ui/QGCRemoteControlView.h \
src/ui/RadioCalibration/RadioCalibrationData.h \
src/ui/RadioCalibration/RadioCalibrationWindow.h \
src/ui/RadioCalibration/AirfoilServoCalibrator.h \
src/ui/RadioCalibration/SwitchCalibrator.h \
src/ui/RadioCalibration/CurveCalibrator.h \
src/ui/RadioCalibration/AbstractCalibrator.h \
src/comm/QGCMAVLink.h \
src/ui/QGCWebView.h \
src/ui/map3D/QGCWebPage.h \
......@@ -415,7 +405,6 @@ HEADERS += \
src/ui/QGCUDPLinkConfiguration.h \
src/ui/QGCTCPLinkConfiguration.h \
src/ui/SettingsDialog.h \
src/ui/uas/UASControlParameters.h \
src/uas/QGCUASParamManager.h \
src/ui/map/QGCMapWidget.h \
src/ui/map/MAV2DIcon.h \
......@@ -457,7 +446,6 @@ HEADERS += \
src/ui/uas/UASQuickViewItemSelect.h \
src/ui/uas/UASQuickViewTextItem.h \
src/ui/uas/UASQuickViewGaugeItem.h \
src/ui/uas/UASActionsWidget.h \
src/ui/QGCTabbedInfoView.h \
src/ui/UASRawStatusView.h \
src/ui/PrimaryFlightDisplay.h \
......@@ -538,13 +526,6 @@ SOURCES += \
src/QGC.cc \
src/ui/QGCDataPlot2D.cc \
src/ui/linechart/IncrementalPlot.cc \
src/ui/QGCRemoteControlView.cc \
src/ui/RadioCalibration/RadioCalibrationWindow.cc \
src/ui/RadioCalibration/AirfoilServoCalibrator.cc \
src/ui/RadioCalibration/SwitchCalibrator.cc \
src/ui/RadioCalibration/CurveCalibrator.cc \
src/ui/RadioCalibration/AbstractCalibrator.cc \
src/ui/RadioCalibration/RadioCalibrationData.cc \
src/ui/QGCWebView.cc \
src/ui/map3D/QGCWebPage.cc \
src/ui/QGCMainWindowAPConfigurator.cc \
......@@ -568,7 +549,6 @@ SOURCES += \
src/ui/QGCUDPLinkConfiguration.cc \
src/ui/QGCTCPLinkConfiguration.cc \
src/ui/SettingsDialog.cc \
src/ui/uas/UASControlParameters.cpp \
src/uas/QGCUASParamManager.cc \
src/ui/map/QGCMapWidget.cc \
src/ui/map/MAV2DIcon.cc \
......@@ -608,7 +588,6 @@ SOURCES += \
src/ui/uas/UASQuickViewTextItem.cc \
src/ui/uas/UASQuickViewGaugeItem.cc \
src/ui/uas/UASQuickViewItemSelect.cc \
src/ui/uas/UASActionsWidget.cpp \
src/ui/QGCTabbedInfoView.cpp \
src/ui/UASRawStatusView.cpp \
src/ui/PrimaryFlightDisplay.cc \
......
......@@ -43,7 +43,6 @@ This file is part of the QGROUNDCONTROL project
#include "UASParameterDataModel.h"
#include "UASWaypointManager.h"
#include "QGCUASParamManagerInterface.h"
#include "RadioCalibration/RadioCalibrationData.h"
class QGCUASFileManager;
......@@ -584,8 +583,6 @@ signals:
void remoteControlChannelScaledChanged(int channelId, float normalized);
/** @brief Remote control RSSI changed */
void remoteControlRSSIChanged(float rssi);
/** @brief Radio Calibration Data has been received from the MAV*/
void radioCalibrationReceived(const QPointer<RadioCalibrationData>&);
/**
* @brief Localization quality changed
......
#include "UASParameterCommsMgr.h"
#include <QSettings>
#include <QDebug>
#include "QGCUASParamManagerInterface.h"
#include "UASInterface.h"
......
#include "MAVLinkDecoder.h"
#include "UASManager.h"
#include <QDebug>
MAVLinkDecoder::MAVLinkDecoder(MAVLinkProtocol* protocol, QObject *parent) :
QThread()
{
......
......@@ -61,7 +61,6 @@ This file is part of the QGROUNDCONTROL project
#include "UASQuickView.h"
#include "QGCDataPlot2D.h"
#include "Linecharts.h"
#include "UASActionsWidget.h"
#include "QGCTabbedInfoView.h"
#include "UASRawStatusView.h"
#include "PrimaryFlightDisplay.h"
......
......@@ -57,7 +57,6 @@ This file is part of the QGROUNDCONTROL project
#include "ParameterInterface.h"
#include "HDDisplay.h"
#include "HSIDisplay.h"
#include "QGCRemoteControlView.h"
#include "opmapcontrol.h"
#ifdef QGC_GOOGLE_EARTH_ENABLED
#include "QGCGoogleEarthView.h"
......@@ -65,11 +64,11 @@ This file is part of the QGROUNDCONTROL project
#include "QGCToolBar.h"
#include "LogCompressor.h"
#include "UASControlParameters.h"
#include "QGCMAVLinkInspector.h"
#include "QGCMAVLinkLogPlayer.h"
#include "MAVLinkDecoder.h"
#include "QGCUASFileViewMulti.h"
#include "QGCFlightGearLink.h"
class QGCMapTool;
class QGCMAVLinkMessageSender;
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of QGCRemoteControlView
* @author Lorenz Meier <mail@qgroundcontrol.org>
* @author Bryan Godbolt <godbolt@ece.ualberta.ca>
*/
#include <QGridLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QLabel>
#include <QProgressBar>
#include "QGCRemoteControlView.h"
#include "ui_QGCRemoteControlView.h"
#include "UASManager.h"
QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) :
QWidget(parent),
uasId(-1),
rssi(0.0f),
updated(false),
channelLayout(new QVBoxLayout()),
ui(NULL)
{
ui->setupUi(this);
QGridLayout* layout = new QGridLayout(this);
layout->addLayout(channelLayout, 1, 0, 1, 2);
nameLabel = new QLabel(this);
layout->addWidget(nameLabel, 0, 0, 1, 2);
this->setVisible(false);
//setVisible(false);
// calibrate = new QPushButton(tr("Calibrate"), this);
// QHBoxLayout *calibrateButtonLayout = new QHBoxLayout();
// calibrateButtonLayout->addWidget(calibrate, 0, Qt::AlignHCenter);
// layout->addItem(calibrateButtonLayout, 3, 0, 1, 2);
// calibrationWindow = new RadioCalibrationWindow(this);
// connect(calibrate, SIGNAL(clicked()), calibrationWindow, SLOT(show()));
connect(UASManager::instance(), SIGNAL(activeUASSet(int)), this, SLOT(setUASId(int)));
connect(&updateTimer, SIGNAL(timeout()), this, SLOT(redraw()));
updateTimer.start(1500);
}
QGCRemoteControlView::~QGCRemoteControlView()
{
if(this->ui)
{
delete ui;
}
if(this->channelLayout)
{
delete channelLayout;
}
}
void QGCRemoteControlView::setUASId(int id)
{
if (uasId != -1)
{
UASInterface* uas = UASManager::instance()->getUASForId(uasId);
if (uas)
{
// The UAS exists, disconnect any existing connections
disconnect(uas, SIGNAL(remoteControlChannelRawChanged(int,float,float)), this, SLOT(setChannel(int,float,float)));
disconnect(uas, SIGNAL(remoteControlRSSIChanged(float)), this, SLOT(setRemoteRSSI(float)));
//disconnect(uas, SIGNAL(radioCalibrationRawReceived(const QPointer<RadioCalibrationData>&)), calibrationWindow, SLOT(receive(const QPointer<RadioCalibrationData>&)));
//disconnect(uas, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannel(int,float)));
disconnect(uas, SIGNAL(remoteControlChannelScaledChanged(int,float)), this, SLOT(setChannelScaled(int,float)));
}
}
// Clear channel count
raw.clear();
raw.resize(0);
normalized.clear();
normalized.resize(0);
foreach (QLabel* label, rawLabels)
{
label->deleteLater();
}
foreach(QProgressBar* bar, progressBars)
{
bar->deleteLater();
}
rawLabels.clear();
rawLabels.resize(0);
progressBars.clear();
progressBars.resize(0);
// Connect the new UAS
UASInterface* newUAS = UASManager::instance()->getUASForId(id);
if (newUAS)
{
// New UAS exists, connect
nameLabel->setText(QString("RC Input of %1").arg(newUAS->getUASName()));
//calibrationWindow->setUASId(id);
//connect(newUAS, SIGNAL(radioCalibrationReceived(const QPointer<RadioCalibrationData>&)), calibrationWindow, SLOT(receive(const QPointer<RadioCalibrationData>&)));
connect(newUAS, SIGNAL(remoteControlRSSIChanged(float)), this, SLOT(setRemoteRSSI(float)));
connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), this, SLOT(setChannelRaw(int,float)));
connect(newUAS, SIGNAL(remoteControlChannelScaledChanged(int,float)), this, SLOT(setChannelScaled(int,float)));
// only connect raw channels to calibration window widget
//connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannel(int,float)));
}
}
void QGCRemoteControlView::setChannelRaw(int channelId, float raw)
{
if (this->raw.count() <= channelId) {
// This is a new channel, append it
this->raw.append(raw);
appendChannelWidget(channelId);
updated = true;
} else {
// This is an existing channel, aupdate it
if (this->raw[channelId] != raw) updated = true;
this->raw[channelId] = raw;
}
}
void QGCRemoteControlView::setChannelScaled(int channelId, float normalized)
{
if (this->normalized.count() <= channelId) // using raw vector as size indicator
{
// This is a new channel, append it
this->normalized.append(normalized);
appendChannelWidget(channelId);
updated = true;
}
else
{
// This is an existing channel, update it
if (this->normalized[channelId] != normalized) updated = true;
this->normalized[channelId] = normalized;
}
}
void QGCRemoteControlView::setRemoteRSSI(float rssiNormalized)
{
if (rssi != rssiNormalized) updated = true;
rssi = rssiNormalized;
}
void QGCRemoteControlView::appendChannelWidget(int channelId)
{
// Create new layout
QHBoxLayout* layout = new QHBoxLayout();
// Add content
layout->addWidget(new QLabel(QString("Channel %1").arg(channelId + 1), this));
QLabel* raw = new QLabel(this);
// Append raw label
rawLabels.append(raw);
layout->addWidget(raw);
// Append progress bar
QProgressBar* normalized = new QProgressBar(this);
normalized->setMinimum(-100);
normalized->setMaximum(100);
normalized->setFormat("%v%");
progressBars.append(normalized);
layout->addWidget(normalized);
channelLayout->addLayout(layout);
}
void QGCRemoteControlView::redraw()
{
if(isVisible() && updated)
{
// Update percent bars and raw labels
for(int i = 0; (i < progressBars.count()) && (i < rawLabels.count()) && (i < normalized.count()) && (i < raw.count()); i++)
{
rawLabels.at(i)->setText(QString("%1 us").arg(raw.at(i), 4, 10, QChar('0')));
int vv = normalized.at(i)*100.0f;
progressBars.at(i)->setValue(vv);
}
// Update RSSI
if(rssi>0) {
//rssiBar->setValue(rssi);//*100);
}
updated = false;
}
}
void QGCRemoteControlView::changeEvent(QEvent *e)
{
Q_UNUSED(e);
// FIXME If the lines below are commented in
// runtime errors can occur on x64 systems.
// QWidget::changeEvent(e);
// switch (e->type()) {
// case QEvent::LanguageChange:
// //ui->retranslateUi(this);
// break;
// default:
// break;
// }
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Declaration of QGCRemoteControlView
* @author Lorenz Meier <mail@qgroundcontrol.org>
*/
#ifndef QGCREMOTECONTROLVIEW_H
#define QGCREMOTECONTROLVIEW_H
#include <QWidget>
#include <QVector>
#include <QPushButton>
#include "RadioCalibration/RadioCalibrationWindow.h"
namespace Ui
{
class QGCRemoteControlView;
}
class QVBoxLayout;
class QLabel;
class QProgressBar;
class QGCRemoteControlView : public QWidget
{
Q_OBJECT
public:
QGCRemoteControlView(QWidget *parent = 0);
~QGCRemoteControlView();
public slots:
void setUASId(int id);
void setChannelRaw(int channelId, float raw);
void setChannelScaled(int channelId, float normalized);
void setRemoteRSSI(float rssiNormalized);
void redraw();
protected slots:
void appendChannelWidget(int channelId);
protected:
void changeEvent(QEvent *e);
int uasId;
float rssi;
bool updated;
QVBoxLayout* channelLayout;
QVector<int> raw;
QVector<float> normalized;
QVector<QLabel*> rawLabels;
QVector<QProgressBar*> progressBars;
QProgressBar* rssiBar;
QLabel* nameLabel;
QPushButton *calibrate;
RadioCalibrationWindow *calibrationWindow;
QTimer updateTimer;
private:
Ui::QGCRemoteControlView *ui;
};
#endif // QGCREMOTECONTROLVIEW_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCRemoteControlView</class>
<widget class="QWidget" name="QGCRemoteControlView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>155</width>
<height>106</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
</widget>
<resources/>
<connections/>
</ui>
......@@ -24,6 +24,8 @@ This file is part of the QGROUNDCONTROL project
#include <QToolButton>
#include <QLabel>
#include <QSpacerItem>
#include <QFileDialog>
#include "QGCStatusBar.h"
#include "UASManager.h"
#include "MainWindow.h"
......
......@@ -5,7 +5,6 @@
#include "ui_QGCTabbedInfoView.h"
#include "MAVLinkDecoder.h"
#include "QGCMessageView.h"
#include "UASActionsWidget.h"
#include "UASQuickView.h"
#include "UASRawStatusView.h"
class QGCTabbedInfoView : public QWidget
......@@ -20,7 +19,6 @@ private:
MAVLinkDecoder *m_decoder;
Ui::QGCTabbedInfoView ui;
QGCMessageView *messageView;
UASActionsWidget *actionsWidget;
UASQuickView *quickView;
UASRawStatusView *rawView;
};
......
#include "AbstractCalibrator.h"
AbstractCalibrator::AbstractCalibrator(QWidget *parent) :
QWidget(parent),
pulseWidth(new QLabel()),
log(new QVector<uint16_t>())
{
}
AbstractCalibrator::~AbstractCalibrator()
{
delete log;
}
uint16_t AbstractCalibrator::logAverage()
{
// Short-circuit here if the log is empty otherwise we get a div-by-0 error.
if (log->empty())
{
return 0;
}
uint16_t total = 0;
for (int i=0; i<log->size(); ++i)
{
total += log->value(i);
}
return total/log->size();
}
uint16_t AbstractCalibrator::logExtrema()
{
uint16_t extrema = logAverage();
if (logAverage() < 1500)
{
for (int i=0; i<log->size(); ++i)
{
if (log->value(i) < extrema)
{
extrema = log->value(i);
}
}
extrema -= 5; // add 5us to prevent integer overflow
}
else
{
for (int i=0; i<log->size(); ++i)
{
if (log->value(i) > extrema)
{
extrema = log->value(i);
}
}
extrema += 5; // subtact 5us to prevent integer overflow
}
return extrema;
}
void AbstractCalibrator::channelChanged(uint16_t raw)
{
pulseWidth->setText(QString::number(raw));
if (log->size() == 5)
{
log->pop_front();
}
log->push_back(raw);
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Common aspects of radio calibration widgets
* @author Bryan Godbolt <godbolt@ualberta.ca>
*/
#ifndef ABSTRACTCALIBRATOR_H
#define ABSTRACTCALIBRATOR_H
#include <QWidget>
#include <QString>
#include <QLabel>
#include <QVector>
#include <math.h>
#include <stdint.h>
/**
@brief Holds the code which is common to all the radio calibration widgets.
@author Bryan Godbolt <godbolt@ece.ualberta.ca>
*/
class AbstractCalibrator : public QWidget
{
Q_OBJECT
public:
explicit AbstractCalibrator(QWidget *parent = 0);
~AbstractCalibrator();
/** Change the setpoints of the widget. Used when
changing the display from an external source (file/uav).
@param data QVector of setpoints
*/
virtual void set(const QVector<uint16_t>& data)=0;
signals:
/** Announce a setpoint change.
@param index setpoint number - 0 based in the current implementation
@param value new value
*/
void setpointChanged(int index, uint16_t value);
public slots:
/** Slot to call when the relevant channel is updated
@param raw current channel value
*/
void channelChanged(uint16_t raw);
protected:
/** Display the current pulse width */
QLabel *pulseWidth;
/** Log of the past few samples for use in averaging and finding extrema */
QVector<uint16_t> *log;
/** Find the maximum or minimum of the data log */
uint16_t logExtrema();
/** Find the average of the log */
uint16_t logAverage();
};
#endif // ABSTRACTCALIBRATOR_H
#include "AirfoilServoCalibrator.h"
AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent) :
AbstractCalibrator(parent),
highPulseWidth(new QLabel()),
centerPulseWidth(new QLabel()),
lowPulseWidth(new QLabel())
{
QGridLayout *grid = new QGridLayout(this);
/* Add title */
QHBoxLayout *titleLayout = new QHBoxLayout();
QLabel* title;
if (type == AILERON) {
title = new QLabel(tr("Aileron"));
} else if (type == ELEVATOR) {
title = new QLabel(tr("Elevator"));
} else if (type == RUDDER) {
title = new QLabel(tr("Rudder"));
} else {
title = new QLabel(tr("Unknown"));
}
titleLayout->addWidget(title);
grid->addLayout(titleLayout, 0, 0, 1, 3, Qt::AlignHCenter);
/* Add current Pulse Width Display */
QLabel *pulseWidthTitle = new QLabel(tr("Pulse Width (us)"));
QHBoxLayout *pulseLayout = new QHBoxLayout();
pulseLayout->addWidget(pulseWidthTitle);
pulseLayout->addWidget(pulseWidth);
grid->addLayout(pulseLayout, 1, 0, 1, 3);
QLabel *highPulseString;
QLabel *centerPulseString;
QLabel *lowPulseString;
if (type == AILERON) {
highPulseString = new QLabel(tr("Bank Right"));
centerPulseString = new QLabel(tr("Center"));
lowPulseString = new QLabel(tr("Bank Left"));
} else if (type == ELEVATOR) {
highPulseString = new QLabel(tr("Nose Up"));
centerPulseString = new QLabel(tr("Center"));
lowPulseString = new QLabel(tr("Nose Down"));
} else if (type == RUDDER) {
highPulseString = new QLabel(tr("Nose Right"));
centerPulseString = new QLabel(tr("Center"));
lowPulseString = new QLabel(tr("Nose Left"));
} else {
highPulseString = new QLabel(tr("High"));
centerPulseString = new QLabel(tr("Center"));
lowPulseString = new QLabel(tr("Low"));
}
QPushButton *highButton = new QPushButton(tr("Set"));
QPushButton *centerButton = new QPushButton(tr("Set"));