diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 5cd8718fb7b3552be482b246bb3381fea7bf6633..780346697bf0dc8b563a81e596b73178f0efb0cc 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -245,7 +245,6 @@ FORMS += \ src/ui/QGCUASFileViewMulti.ui \ src/ui/uas/UASQuickView.ui \ src/ui/uas/UASQuickViewItemSelect.ui \ - src/ui/UASInfo.ui \ } HEADERS += \ @@ -379,7 +378,6 @@ HEADERS += \ src/ui/QGCTabbedInfoView.h \ src/ui/QGCUASFileView.h \ src/ui/QGCUASFileViewMulti.h \ - src/ui/uas/UASInfoWidget.h \ src/ui/uas/UASQuickView.h \ src/ui/uas/UASQuickViewGaugeItem.h \ src/ui/uas/UASQuickViewItem.h \ @@ -525,7 +523,6 @@ SOURCES += \ src/ui/QGCTabbedInfoView.cpp \ src/ui/QGCUASFileView.cc \ src/ui/QGCUASFileViewMulti.cc \ - src/ui/uas/UASInfoWidget.cc \ src/ui/uas/UASQuickView.cc \ src/ui/uas/UASQuickViewGaugeItem.cc \ src/ui/uas/UASQuickViewItem.cc \ diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index c2c9f015520fdc84e5094e4a27961f696fc23bb2..fbc1b53eed140f5373c64cad60331f40236a5c1a 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -50,7 +50,6 @@ #include "QGCTabbedInfoView.h" #include "CustomCommandWidget.h" #include "QGCDockWidget.h" -#include "UASInfoWidget.h" #include "HILDockWidget.h" #include "LogDownload.h" #include "AppMessages.h" @@ -72,7 +71,6 @@ enum DockWidgetTypes { MAVLINK_INSPECTOR, CUSTOM_COMMAND, ONBOARD_FILES, - STATUS_DETAILS, INFO_VIEW, HIL_CONFIG, ANALYZE, @@ -83,7 +81,6 @@ static const char *rgDockWidgetNames[] = { "MAVLink Inspector", "Custom Command", "Onboard Files", - "Status Details", "Info View", "HIL Config", "Analyze", @@ -358,9 +355,6 @@ bool MainWindow::_createInnerDockWidget(const QString& widgetName) case LOG_DOWNLOAD: widget = new LogDownload(widgetName, action, this); break; - case STATUS_DETAILS: - widget = new UASInfoWidget(widgetName, action, this); - break; case HIL_CONFIG: widget = new HILDockWidget(widgetName, action, this); break; diff --git a/src/ui/UASInfo.ui b/src/ui/UASInfo.ui deleted file mode 100644 index 8eda19d645bb9022ca5f33920cd440b603da1b43..0000000000000000000000000000000000000000 --- a/src/ui/UASInfo.ui +++ /dev/null @@ -1,647 +0,0 @@ - - - uasInfo - - - - 0 - 0 - 243 - 161 - - - - Status Details - - - - - - - 3 - - - 3 - - - 3 - - - 3 - - - 5 - - - - - Battery - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 13 - 15 - - - - - - - - 12 - - - Qt::AutoText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - V - - - Qt::AutoText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 10 - 18 - - - - - 100 - 0 - - - - - 16777215 - 20 - - - - - 0 - 18 - - - - 0 - - - 100 - - - 0 - - - true - - - %p% - - - - - - - MAV RX Loss - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 13 - 15 - - - - - - - - 0 - - - Qt::AutoText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - % - - - Qt::AutoText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 10 - 18 - - - - - 100 - 0 - - - - - 16777215 - 20 - - - - - 0 - 18 - - - - 0 - - - true - - - %p% - - - - - - - MAV TX Loss - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 13 - 15 - - - - - - - - 0 - - - Qt::AutoText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - % - - - Qt::AutoText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 10 - 18 - - - - - 100 - 0 - - - - - 16777215 - 20 - - - - - 0 - 18 - - - - 0 - - - true - - - %p% - - - - - - - MAV Seq Loss - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 13 - 15 - - - - - - - - 0 - - - Qt::AutoText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - % - - - Qt::AutoText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 10 - 18 - - - - - 100 - 0 - - - - - 16777215 - 20 - - - - - 0 - 18 - - - - 0 - - - true - - - %p% - - - - - - - Seq Loss Cnt - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 13 - 15 - - - - - - - - 0 - - - Qt::AutoText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Qt::AutoText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 10 - 18 - - - - - 100 - 0 - - - - - 16777215 - 20 - - - - - 0 - 18 - - - - 0 - - - true - - - %p% - - - - - - - MCU Load - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 13 - 15 - - - - - - - - 0 - - - Qt::AutoText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - % - - - Qt::AutoText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 10 - 18 - - - - - 100 - 0 - - - - - 16777215 - 20 - - - - - 0 - 18 - - - - 0 - - - true - - - %p% - - - - - - - CPU Load - - - - - - - Qt::Horizontal - - - - 13 - 15 - - - - - - - - 0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - % - - - - - - - - 16777215 - 20 - - - - - 0 - 18 - - - - 0 - - - - - - - Qt::Horizontal - - - - - - - No error status received yet - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 0 - 0 - - - - - - - - - diff --git a/src/ui/uas/UASInfoWidget.cc b/src/ui/uas/UASInfoWidget.cc deleted file mode 100644 index 1ace6bc25572c4ac18f571b7e4e656aeae7cffef..0000000000000000000000000000000000000000 --- a/src/ui/uas/UASInfoWidget.cc +++ /dev/null @@ -1,228 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -/** - * @file - * @brief Implementation of class UASInfoWidget - * - * @author Lorenz Meier - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -#include "UASInfoWidget.h" -#include "MultiVehicleManager.h" -#include "QGC.h" -#include "UAS.h" -#include "QGCApplication.h" - -UASInfoWidget::UASInfoWidget(const QString& title, QAction* action, QWidget *parent, QString name) - : QGCDockWidget(title, action, parent) - , _activeUAS(NULL) - , _seqLossPercent(0) - , _seqLossTotal(0) -{ - ui.setupUi(this); - this->name = name; - - connect(qgcApp()->toolbox()->multiVehicleManager(), &MultiVehicleManager::activeVehicleChanged, this, &UASInfoWidget::_activeVehicleChanged); - _activeVehicleChanged(qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()); - - startTime = QGC::groundTimeMilliseconds(); - - // Set default values - /** Set two voltage decimals and zero charge level decimals **/ - this->voltageDecimals = 2; - this->loadDecimals = 2; - - this->voltage = 0; - this->chargeLevel = 0; - this->load = 0; - receiveLoss = 0; - sendLoss = 0; - changed = true; - errors = QMap(); - - updateTimer = new QTimer(this); - connect(updateTimer, &QTimer::timeout, this, &UASInfoWidget::refresh); - updateTimer->start(updateInterval); - - this->setVisible(false); - - loadSettings(); - - connect(qgcApp()->toolbox()->mavlinkProtocol(), &MAVLinkProtocol::receiveLossPercentChanged, this, &UASInfoWidget::updateSeqLossPercent); - connect(qgcApp()->toolbox()->mavlinkProtocol(), &MAVLinkProtocol::receiveLossTotalChanged, this, &UASInfoWidget::updateSeqLossTotal); -} - -UASInfoWidget::~UASInfoWidget() -{ - -} - -void UASInfoWidget::showEvent(QShowEvent* event) -{ - // React only to internal (pre-display) - // events - Q_UNUSED(event); - updateTimer->start(updateInterval); -} - -void UASInfoWidget::hideEvent(QHideEvent* event) -{ - // React only to internal (pre-display) - // events - Q_UNUSED(event); - updateTimer->stop(); -} - -void UASInfoWidget::_activeVehicleChanged(Vehicle* vehicle) -{ - if (_activeUAS) { - disconnect(_activeUAS, &UASInterface::batteryChanged, this, &UASInfoWidget::updateBattery); - disconnect(_activeUAS, &UASInterface::dropRateChanged, this, &UASInfoWidget::updateReceiveLoss); - disconnect(static_cast(_activeUAS), &UAS::loadChanged, this, &UASInfoWidget::updateCPULoad); - disconnect(_activeUAS, &UASInterface::errCountChanged, this, &UASInfoWidget::updateErrorCount); - _activeUAS = NULL; - } - - if (vehicle) { - _activeUAS = vehicle->uas(); - connect(_activeUAS, &UASInterface::batteryChanged, this, &UASInfoWidget::updateBattery); - connect(_activeUAS, &UASInterface::dropRateChanged, this, &UASInfoWidget::updateReceiveLoss); - connect(static_cast(_activeUAS), &UAS::loadChanged, this, &UASInfoWidget::updateCPULoad); - connect(_activeUAS, &UASInterface::errCountChanged, this, &UASInfoWidget::updateErrorCount); - } -} - -void UASInfoWidget::updateBattery(UASInterface* uas, double voltage, double current, double percent, int seconds) -{ - Q_UNUSED(current) - setVoltage(uas, voltage); - setChargeLevel(uas, percent); - setTimeRemaining(uas, seconds); -} - -void UASInfoWidget::updateErrorCount(int uasid, QString component, QString device, int count) -{ - //qDebug() << __FILE__ << __LINE__ << _activeUAS->getUASID() << "=" << uasid; - if (_activeUAS->getUASID() == uasid) { - errors.remove(component + ":" + device); - errors.insert(component + ":" + device, count); - } -} - -/** - * - */ -void UASInfoWidget::updateCPULoad(UASInterface* uas, double load) -{ - if (_activeUAS == uas) { - this->load = load; - } -} - -void UASInfoWidget::updateReceiveLoss(int uasId, float receiveLoss) -{ - Q_UNUSED(uasId); - this->receiveLoss = this->receiveLoss * 0.8f + receiveLoss * 0.2f; -} - -void UASInfoWidget::updateSeqLossPercent(int uasId, float seqLossPercent) -{ - if (_activeUAS && _activeUAS->getUASID() == uasId) { - _seqLossPercent = _seqLossPercent * 0.8f + seqLossPercent * 0.2f; - } else { - _seqLossPercent = 0; - } -} - -void UASInfoWidget::updateSeqLossTotal(int uasId, int seqLossTotal) -{ - if (_activeUAS && _activeUAS->getUASID() == uasId) { - _seqLossTotal = seqLossTotal; - } else { - _seqLossTotal = 0; - } -} - -/** - The send loss is typically calculated on the GCS based on packets - that were received scrambled from the MAV - */ -void UASInfoWidget::updateSendLoss(int uasId, float sendLoss) -{ - Q_UNUSED(uasId); - this->sendLoss = this->sendLoss * 0.8f + sendLoss * 0.2f; -} - -void UASInfoWidget::setVoltage(UASInterface* uas, double voltage) -{ - Q_UNUSED(uas); - this->voltage = voltage; -} - -void UASInfoWidget::setChargeLevel(UASInterface* uas, double chargeLevel) -{ - if (_activeUAS == uas) { - this->chargeLevel = chargeLevel; - } -} - -void UASInfoWidget::setTimeRemaining(UASInterface* uas, double seconds) -{ - if (_activeUAS == uas) { - this->timeRemaining = seconds; - } -} - -void UASInfoWidget::refresh() -{ - ui.voltageLabel->setText(QString::number(this->voltage, 'f', voltageDecimals)); - ui.batteryBar->setValue(qMax(0,qMin(static_cast(this->chargeLevel), 100))); - - ui.loadLabel->setText(QString::number(this->load, 'f', loadDecimals)); - ui.loadBar->setValue(qMax(0, qMin(static_cast(this->load), 100))); - - ui.receiveLossBar->setValue(qMax(0, qMin(static_cast(receiveLoss), 100))); - ui.receiveLossLabel->setText(QString::number(receiveLoss, 'f', 2)); - - ui.seqLossBar->setValue(qMax(0, qMin(static_cast(_seqLossPercent), 100))); - ui.seqLossLabel->setText(QString::number(_seqLossPercent, 'f', 2)); - - ui.seqcntLossLabel->setText(QString::number(_seqLossTotal)); - - ui.sendLossBar->setValue(sendLoss); - ui.sendLossLabel->setText(QString::number(sendLoss, 'f', 2)); - - ui.label_5->setText(QString::number(this->load, 'f', loadDecimals)); - ui.progressBar->setValue(qMax(0, qMin(static_cast(this->load), 100))); - - QString errorString; - QMapIterator i(errors); - while (i.hasNext()) { - i.next(); - errorString += QString(i.key() + ": %1 ").arg(i.value()); - - // FIXME - errorString.replace("IMU:", ""); - - - } - ui.errorLabel->setText(errorString); -} diff --git a/src/ui/uas/UASInfoWidget.h b/src/ui/uas/UASInfoWidget.h deleted file mode 100644 index 7cf846aa1c13d4bc1fc9254c6254c728b187f47d..0000000000000000000000000000000000000000 --- a/src/ui/uas/UASInfoWidget.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -/** - * @file - * @brief Detail information of one MAV - * - * @author Lorenz Meier - * - */ - -#ifndef _UASINFOWIDGET_H_ -#define _UASINFOWIDGET_H_ - -#include -#include - -#include "QGCDockWidget.h" -#include "UASInterface.h" -#include "ui_UASInfo.h" -#include "Vehicle.h" - -/** - * @brief Info indicator for the currently active UAS - * - **/ -class UASInfoWidget : public QGCDockWidget -{ - Q_OBJECT -public: - UASInfoWidget(const QString& title, QAction* action, QWidget *parent = 0, QString name = ""); - ~UASInfoWidget(); - -public slots: - void updateBattery(UASInterface* uas, double voltage, double current, double percent, int seconds); - void updateCPULoad(UASInterface* uas, double load); - /** - * @brief Set the loss rate of packets received by the MAV. - * @param uasId UNUSED - * @param receiveLoss A percentage value (0-100) of how many message the UAS has failed to receive. - */ - void updateReceiveLoss(int uasId, float receiveLoss); - - void updateSeqLossPercent(int uasId, float seqLoss); - void updateSeqLossTotal(int uasId, int seqLossTotal); - - /** - * @brief Set the loss rate of packets sent from the MAV - * @param uasId UNUSED - * @param sendLoss A percentage value (0-100) of how many message QGC has failed to receive. - */ - void updateSendLoss(int uasId, float sendLoss); - - /** @brief Update the error count */ - void updateErrorCount(int uasid, QString component, QString device, int count); - - void setVoltage(UASInterface* uas, double voltage); - void setChargeLevel(UASInterface* uas, double chargeLevel); - void setTimeRemaining(UASInterface* uas, double seconds); - - void refresh(); - -protected: - - - // Configuration variables - int voltageDecimals; - int loadDecimals; - - // State variables - - // Voltage - double voltage; - double chargeLevel; - double timeRemaining; - double load; - float receiveLoss; - float sendLoss; - bool changed; - QTimer* updateTimer; - QString name; - quint64 startTime; - QMap errors; - static const int updateInterval = 800; ///< Refresh interval in milliseconds - - void showEvent(QShowEvent* event); - void hideEvent(QHideEvent* event); - -private slots: - void _activeVehicleChanged(Vehicle* vehicle); - -private: - Ui::uasInfo ui; - - UASInterface* _activeUAS; - float _seqLossPercent; - int _seqLossTotal; -}; - -#endif // _UASINFOWIDGET_H_