5 changed files with 0 additions and 991 deletions
@ -1,647 +0,0 @@
@@ -1,647 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>uasInfo</class> |
||||
<widget class="QWidget" name="uasInfo"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>243</width> |
||||
<height>161</height> |
||||
</rect> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>Status Details</string> |
||||
</property> |
||||
<property name="styleSheet"> |
||||
<string notr="true"/> |
||||
</property> |
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,100,0" columnstretch="0,0,0,0,0,0,0"> |
||||
<property name="leftMargin"> |
||||
<number>3</number> |
||||
</property> |
||||
<property name="topMargin"> |
||||
<number>3</number> |
||||
</property> |
||||
<property name="rightMargin"> |
||||
<number>3</number> |
||||
</property> |
||||
<property name="bottomMargin"> |
||||
<number>3</number> |
||||
</property> |
||||
<property name="spacing"> |
||||
<number>5</number> |
||||
</property> |
||||
<item row="0" column="0"> |
||||
<widget class="QLabel" name="label"> |
||||
<property name="text"> |
||||
<string>Battery</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="0" column="1"> |
||||
<spacer name="horizontalSpacer_2"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeType"> |
||||
<enum>QSizePolicy::Maximum</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>13</width> |
||||
<height>15</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
<item row="0" column="2"> |
||||
<widget class="QLabel" name="voltageLabel"> |
||||
<property name="text"> |
||||
<string>12</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="0" column="3"> |
||||
<widget class="QLabel" name="label_7"> |
||||
<property name="text"> |
||||
<string>V</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="0" column="4" colspan="2"> |
||||
<widget class="QProgressBar" name="batteryBar"> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> |
||||
<horstretch>10</horstretch> |
||||
<verstretch>18</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="minimumSize"> |
||||
<size> |
||||
<width>100</width> |
||||
<height>0</height> |
||||
</size> |
||||
</property> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>16777215</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
<property name="baseSize"> |
||||
<size> |
||||
<width>0</width> |
||||
<height>18</height> |
||||
</size> |
||||
</property> |
||||
<property name="minimum"> |
||||
<number>0</number> |
||||
</property> |
||||
<property name="maximum"> |
||||
<number>100</number> |
||||
</property> |
||||
<property name="value"> |
||||
<number>0</number> |
||||
</property> |
||||
<property name="textVisible"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<property name="format"> |
||||
<string>%p%</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="0"> |
||||
<widget class="QLabel" name="label_2"> |
||||
<property name="text"> |
||||
<string>MAV RX Loss</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="1"> |
||||
<spacer name="horizontalSpacer_3"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeType"> |
||||
<enum>QSizePolicy::Maximum</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>13</width> |
||||
<height>15</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
<item row="1" column="2"> |
||||
<widget class="QLabel" name="receiveLossLabel"> |
||||
<property name="text"> |
||||
<string>0</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="3"> |
||||
<widget class="QLabel" name="label_8"> |
||||
<property name="text"> |
||||
<string>%</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="4" colspan="2"> |
||||
<widget class="QProgressBar" name="receiveLossBar"> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> |
||||
<horstretch>10</horstretch> |
||||
<verstretch>18</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="minimumSize"> |
||||
<size> |
||||
<width>100</width> |
||||
<height>0</height> |
||||
</size> |
||||
</property> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>16777215</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
<property name="baseSize"> |
||||
<size> |
||||
<width>0</width> |
||||
<height>18</height> |
||||
</size> |
||||
</property> |
||||
<property name="value"> |
||||
<number>0</number> |
||||
</property> |
||||
<property name="textVisible"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<property name="format"> |
||||
<string>%p%</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="2" column="0"> |
||||
<widget class="QLabel" name="label_6"> |
||||
<property name="text"> |
||||
<string>MAV TX Loss</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="2" column="1"> |
||||
<spacer name="horizontalSpacer_9"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeType"> |
||||
<enum>QSizePolicy::Maximum</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>13</width> |
||||
<height>15</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
<item row="2" column="2"> |
||||
<widget class="QLabel" name="sendLossLabel"> |
||||
<property name="text"> |
||||
<string>0</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="2" column="3"> |
||||
<widget class="QLabel" name="label_11"> |
||||
<property name="text"> |
||||
<string>%</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="2" column="4" colspan="2"> |
||||
<widget class="QProgressBar" name="sendLossBar"> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> |
||||
<horstretch>10</horstretch> |
||||
<verstretch>18</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="minimumSize"> |
||||
<size> |
||||
<width>100</width> |
||||
<height>0</height> |
||||
</size> |
||||
</property> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>16777215</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
<property name="baseSize"> |
||||
<size> |
||||
<width>0</width> |
||||
<height>18</height> |
||||
</size> |
||||
</property> |
||||
<property name="value"> |
||||
<number>0</number> |
||||
</property> |
||||
<property name="textVisible"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<property name="format"> |
||||
<string>%p%</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="3" column="0"> |
||||
<widget class="QLabel" name="label_seq"> |
||||
<property name="text"> |
||||
<string>MAV Seq Loss</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="3" column="1"> |
||||
<spacer name="horizontalSpacer_seq"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeType"> |
||||
<enum>QSizePolicy::Maximum</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>13</width> |
||||
<height>15</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
<item row="3" column="2"> |
||||
<widget class="QLabel" name="seqLossLabel"> |
||||
<property name="text"> |
||||
<string>0</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="3" column="3"> |
||||
<widget class="QLabel" name="label_seq1"> |
||||
<property name="text"> |
||||
<string>%</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="3" column="4" colspan="2"> |
||||
<widget class="QProgressBar" name="seqLossBar"> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> |
||||
<horstretch>10</horstretch> |
||||
<verstretch>18</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="minimumSize"> |
||||
<size> |
||||
<width>100</width> |
||||
<height>0</height> |
||||
</size> |
||||
</property> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>16777215</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
<property name="baseSize"> |
||||
<size> |
||||
<width>0</width> |
||||
<height>18</height> |
||||
</size> |
||||
</property> |
||||
<property name="value"> |
||||
<number>0</number> |
||||
</property> |
||||
<property name="textVisible"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<property name="format"> |
||||
<string>%p%</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="4" column="0"> |
||||
<widget class="QLabel" name="label_seqcnt"> |
||||
<property name="text"> |
||||
<string>Seq Loss Cnt</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="4" column="1"> |
||||
<spacer name="horizontalSpacer_seqcnt"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeType"> |
||||
<enum>QSizePolicy::Maximum</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>13</width> |
||||
<height>15</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
<item row="4" column="2"> |
||||
<widget class="QLabel" name="seqcntLossLabel"> |
||||
<property name="text"> |
||||
<string>0</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="4" column="3"> |
||||
<widget class="QLabel" name="label_seqcnt1"> |
||||
<property name="text"> |
||||
<string></string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="4" column="4" colspan="2"> |
||||
<widget class="QProgressBar" name="seqcntLossBar"> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> |
||||
<horstretch>10</horstretch> |
||||
<verstretch>18</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="minimumSize"> |
||||
<size> |
||||
<width>100</width> |
||||
<height>0</height> |
||||
</size> |
||||
</property> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>16777215</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
<property name="baseSize"> |
||||
<size> |
||||
<width>0</width> |
||||
<height>18</height> |
||||
</size> |
||||
</property> |
||||
<property name="value"> |
||||
<number>0</number> |
||||
</property> |
||||
<property name="textVisible"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<property name="format"> |
||||
<string>%p%</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="5" column="0"> |
||||
<widget class="QLabel" name="label_3"> |
||||
<property name="text"> |
||||
<string>MCU Load</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="5" column="1"> |
||||
<spacer name="horizontalSpacer_4"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeType"> |
||||
<enum>QSizePolicy::Maximum</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>13</width> |
||||
<height>15</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
<item row="5" column="2"> |
||||
<widget class="QLabel" name="loadLabel"> |
||||
<property name="text"> |
||||
<string>0</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="5" column="3"> |
||||
<widget class="QLabel" name="label_9"> |
||||
<property name="text"> |
||||
<string>%</string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::AutoText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="5" column="4" colspan="2"> |
||||
<widget class="QProgressBar" name="loadBar"> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> |
||||
<horstretch>10</horstretch> |
||||
<verstretch>18</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="minimumSize"> |
||||
<size> |
||||
<width>100</width> |
||||
<height>0</height> |
||||
</size> |
||||
</property> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>16777215</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
<property name="baseSize"> |
||||
<size> |
||||
<width>0</width> |
||||
<height>18</height> |
||||
</size> |
||||
</property> |
||||
<property name="value"> |
||||
<number>0</number> |
||||
</property> |
||||
<property name="textVisible"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<property name="format"> |
||||
<string>%p%</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="6" column="0"> |
||||
<widget class="QLabel" name="label_4"> |
||||
<property name="text"> |
||||
<string>CPU Load</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="6" column="1"> |
||||
<spacer name="horizontalSpacer"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>13</width> |
||||
<height>15</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
<item row="6" column="2"> |
||||
<widget class="QLabel" name="label_5"> |
||||
<property name="text"> |
||||
<string>0</string> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="6" column="3"> |
||||
<widget class="QLabel" name="label_10"> |
||||
<property name="text"> |
||||
<string>%</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="6" column="4" colspan="2"> |
||||
<widget class="QProgressBar" name="progressBar"> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>16777215</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
<property name="baseSize"> |
||||
<size> |
||||
<width>0</width> |
||||
<height>18</height> |
||||
</size> |
||||
</property> |
||||
<property name="value"> |
||||
<number>0</number> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="7" column="0" colspan="6"> |
||||
<widget class="Line" name="line"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="8" column="0" colspan="6"> |
||||
<widget class="QLabel" name="errorLabel"> |
||||
<property name="text"> |
||||
<string>No error status received yet</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="9" column="0" colspan="7"> |
||||
<spacer name="verticalSpacer"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Vertical</enum> |
||||
</property> |
||||
<property name="sizeType"> |
||||
<enum>QSizePolicy::Expanding</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>0</width> |
||||
<height>0</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<resources/> |
||||
<connections/> |
||||
</ui> |
@ -1,228 +0,0 @@
@@ -1,228 +0,0 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
* |
||||
* 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 <mavteam@student.ethz.ch> |
||||
* |
||||
*/ |
||||
|
||||
#include <QtGlobal> |
||||
#include <QTimer> |
||||
#include <QDir> |
||||
#include <QDebug> |
||||
|
||||
#include <float.h> |
||||
#include <cstdlib> |
||||
#include <cmath> |
||||
|
||||
#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<QString, int>(); |
||||
|
||||
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<UAS*>(_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<UAS*>(_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<int>(this->chargeLevel), 100))); |
||||
|
||||
ui.loadLabel->setText(QString::number(this->load, 'f', loadDecimals)); |
||||
ui.loadBar->setValue(qMax(0, qMin(static_cast<int>(this->load), 100))); |
||||
|
||||
ui.receiveLossBar->setValue(qMax(0, qMin(static_cast<int>(receiveLoss), 100))); |
||||
ui.receiveLossLabel->setText(QString::number(receiveLoss, 'f', 2)); |
||||
|
||||
ui.seqLossBar->setValue(qMax(0, qMin(static_cast<int>(_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<int>(this->load), 100))); |
||||
|
||||
QString errorString; |
||||
QMapIterator<QString, int> i(errors); |
||||
while (i.hasNext()) { |
||||
i.next(); |
||||
errorString += QString(i.key() + ": %1 ").arg(i.value()); |
||||
|
||||
// FIXME
|
||||
errorString.replace("IMU:", ""); |
||||
|
||||
|
||||
} |
||||
ui.errorLabel->setText(errorString); |
||||
} |
@ -1,107 +0,0 @@
@@ -1,107 +0,0 @@
|
||||
/****************************************************************************
|
||||
* |
||||
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
* |
||||
* 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 <mavteam@student.ethz.ch> |
||||
* |
||||
*/ |
||||
|
||||
#ifndef _UASINFOWIDGET_H_ |
||||
#define _UASINFOWIDGET_H_ |
||||
|
||||
#include <QTimer> |
||||
#include <QMap> |
||||
|
||||
#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<QString, int> 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_
|
Loading…
Reference in new issue