Commit f1e7c9bd authored by dogmaphobic's avatar dogmaphobic

Separating RC from Telemetry RSSI

parent 29d1ba18
......@@ -156,7 +156,8 @@
<file alias="Kill">resources/Kill.svg</file>
<file alias="Shutdown">resources/Shutdown.svg</file>
<file alias="Antenna">resources/antenna.svg</file>
<file alias="AntennaT">resources/Antenna_T.svg</file>
<file alias="AntennaRC">resources/Antenna_RC.svg</file>
<file alias="Gps">resources/Gps.svg</file>
<file alias="Megaphone">resources/Megaphone.png</file>
<file alias="Yield">resources/Yield.png</file>
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 288 288" enable-background="new 0 0 288 288" xml:space="preserve">
<g id="Layer_1">
<g>
<path fill="#FFFFFF" d="M130.837,125.576l0.249,38.177h26.325l-0.249-38.16c7.832-4.559,13.162-12.957,13.162-22.692
c0-14.534-11.774-26.325-26.325-26.325c-14.534,0-26.325,11.791-26.325,26.325C117.675,112.637,123.005,121.035,130.837,125.576z"
/>
<path fill="#FFFFFF" d="M184.344,143.246l18.613,18.613c15.734-15.734,24.405-36.677,24.405-58.957s-8.672-43.19-24.439-58.957
L184.31,62.557c10.78,10.798,16.727,25.125,16.727,40.345C201.037,118.155,195.107,132.483,184.344,143.246z"/>
<path fill="#FFFFFF" d="M240.551,163.753h30.055c9.024-18.75,13.794-39.435,13.794-60.851
c-0.001-37.534-14.62-72.805-41.167-99.302L224.62,22.213c21.578,21.561,33.455,50.216,33.455,80.689
C258.075,124.772,251.965,145.706,240.551,163.753z"/>
<path fill="#FFFFFF" d="M85.077,161.858l18.613-18.613c-10.798-10.763-16.727-25.091-16.727-40.345
c-0.001-15.218,5.93-29.546,16.693-40.344L85.043,43.944c-15.734,15.768-24.405,36.711-24.405,58.957
C60.637,125.181,69.31,146.125,85.077,161.858z"/>
<path fill="#FFFFFF" d="M47.475,163.753c-11.431-18.047-17.55-38.981-17.55-60.851c0-30.473,11.86-59.129,33.421-80.655
L44.733,3.635C18.202,30.131,3.6,65.402,3.6,102.902c0,21.416,4.776,42.102,13.811,60.851H47.475z"/>
</g>
</g>
<g id="Layer_2">
<g>
<path fill="#FFFFFF" d="M36.956,278.969V171.596h55.298c10.254,0,18.091,0.879,23.511,2.637s9.789,5.018,13.11,9.777
c3.32,4.762,4.98,10.56,4.98,17.396c0,5.958-1.271,11.097-3.811,15.417c-2.541,4.322-6.035,7.826-10.479,10.511
c-2.834,1.71-6.718,3.125-11.652,4.248c3.951,1.32,6.831,2.641,8.637,3.959c1.22,0.88,2.988,2.761,5.307,5.645
c2.317,2.884,3.867,5.107,4.647,6.671l16.067,31.113h-37.489l-17.735-32.812c-2.246-4.248-4.248-7.006-6.006-8.276
c-2.393-1.659-5.103-2.49-8.13-2.49h-2.93v43.579H36.956z M70.281,215.102h13.989c1.513,0,4.442-0.487,8.789-1.465
c2.197-0.439,3.992-1.562,5.383-3.369c1.393-1.806,2.088-3.882,2.088-6.226c0-3.467-1.099-6.127-3.296-7.983
c-2.197-1.855-6.324-2.783-12.378-2.783H70.281V215.102z"/>
<path fill="#FFFFFF" d="M221.966,235.024l29.078,8.789c-1.953,8.155-5.029,14.967-9.229,20.435
c-4.201,5.469-9.412,9.595-15.639,12.378c-6.225,2.783-14.146,4.175-23.766,4.175c-11.672,0-21.205-1.696-28.602-5.087
c-7.398-3.391-13.781-9.355-19.152-17.896c-5.373-8.539-8.057-19.47-8.057-32.792c0-17.761,4.723-31.411,14.172-40.951
c9.447-9.539,22.814-14.31,40.1-14.31c13.525,0,24.158,2.735,31.896,8.203c7.74,5.47,13.488,13.868,17.25,25.195l-29.297,6.519
c-1.025-3.271-2.1-5.664-3.223-7.178c-1.857-2.538-4.127-4.492-6.812-5.859c-2.686-1.366-5.688-2.051-9.008-2.051
c-7.52,0-13.283,3.024-17.285,9.071c-3.029,4.487-4.541,11.535-4.541,21.142c0,11.9,1.805,20.058,5.42,24.471
c3.613,4.414,8.689,6.62,15.234,6.62c6.346,0,11.145-1.782,14.391-5.347C218.145,246.988,220.501,241.811,221.966,235.024z"/>
</g>
</g>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 288 288" enable-background="new 0 0 288 288" xml:space="preserve">
<g id="Layer_1">
<path fill="#FFFFFF" d="M29.925,102.902c0,30.473,11.877,59.129,33.455,80.689l-18.613,18.613
C18.219,175.672,3.6,140.401,3.6,102.902S18.202,30.131,44.733,3.635l18.613,18.612C41.785,43.773,29.925,72.429,29.925,102.902z
M103.656,62.557L85.043,43.944c-15.734,15.768-24.405,36.711-24.405,58.957c0,22.28,8.672,43.224,24.44,58.957l18.613-18.613
c-10.798-10.763-16.727-25.091-16.727-40.345C86.962,87.683,92.893,73.355,103.656,62.557z M243.233,3.6L224.62,22.213
c21.578,21.561,33.455,50.216,33.455,80.689s-11.86,59.129-33.403,80.689l18.613,18.613c26.514-26.531,41.116-61.802,41.116-99.302
C284.399,65.368,269.78,30.097,243.233,3.6z M144,76.577c-14.534,0-26.325,11.791-26.325,26.325c0,9.735,5.33,18.133,13.162,22.675
l0,33.674h26.325l0-33.657c7.832-4.559,13.162-12.957,13.162-22.692C170.325,88.368,158.55,76.577,144,76.577z M202.923,43.945
L184.31,62.557c10.78,10.798,16.727,25.126,16.727,40.345c0,15.254-5.93,29.582-16.693,40.345l18.613,18.613
c15.734-15.734,24.405-36.677,24.405-58.957S218.69,59.712,202.923,43.945z"/>
</g>
<g id="Layer_2">
<g>
<path fill="#FFFFFF" d="M93.573,173.427h100.855v26.514H160.59V280.8H127.41v-80.859H93.573V173.427z"/>
</g>
</g>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 288 288" enable-background="new 0 0 288 288" xml:space="preserve">
<path fill="#FFFFFF" d="M27,101.848c0,31.254,12.181,60.645,34.312,82.758l-19.09,19.09C14.994,176.484,0,140.309,0,101.848
S14.977,27.211,42.187,0.036l19.09,19.09C39.164,41.203,27,70.594,27,101.848z M102.621,60.469l-19.09-19.09
C67.394,57.551,58.5,79.031,58.5,101.847c0,22.852,8.895,44.332,25.067,60.469l19.09-19.09
C91.582,132.187,85.5,117.492,85.5,101.847C85.5,86.239,91.582,71.543,102.621,60.469z M245.777,0l-19.09,19.09
C248.818,41.204,261,70.594,261,101.848s-12.164,60.645-34.26,82.758l19.09,19.09C273.023,176.485,288,140.309,288,101.848
C287.999,63.352,273.005,27.176,245.777,0z M144,74.848c-14.906,0-27,12.094-27,27c0,9.984,5.467,18.598,13.5,23.256V288h27V125.121
c8.033-4.676,13.5-13.289,13.5-23.273C171,86.942,158.923,74.848,144,74.848z M204.433,41.379l-19.09,19.09
C196.4,71.543,202.5,86.239,202.5,101.848c0,15.645-6.082,30.34-17.121,41.379l19.09,19.09
C220.605,146.18,229.5,124.7,229.5,101.849S220.605,57.551,204.433,41.379z"/>
</svg>
......@@ -923,10 +923,28 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
mavlink_rc_channels_t channels;
mavlink_msg_rc_channels_decode(&message, &channels);
// UINT8_MAX indicates this value is unknown
if (channels.rssi != UINT8_MAX) {
emit remoteControlRSSIChanged(channels.rssi/100.0f);
}
/*
* Full RSSI field: 0b 1 111 1111
* | | |
* | | ^ These four bits encode a total of
* | | 16 RSSI levels. 15 = full, 0 = no signal
* | |
* | ^ These three bits encode a total of 8
* | digital RC input types.
* | 0: PPM, 1: SBUS, 2: Spektrum, 3: ST24
* |
* ^ If bit is set, RSSI encodes type + RSSI
*/
// TODO: Because the code on the firmware side never sets rssi to 0 on loss of connection
// we get a minimum value of 1 (3.5dB). This is what it does to compute it:
// msg.rssi |= (rc.rssi <= 100) ? ((rc.rssi / 7) + 1) : 15;
// Therefore, I'm eliminating bit 0 as well.
int tRssi = (channels.rssi & 0x0E) * 7;
if(tRssi > 100) {
tRssi = 100;
}
emit remoteControlRSSIChanged((uint8_t)tRssi);
if (channels.chan1_raw != UINT16_MAX && channels.chancount > 0)
emit remoteControlChannelRawChanged(0, channels.chan1_raw);
......@@ -967,6 +985,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
}
break;
// TODO: (gg 20150420) PX4 Firmware does not seem to send this message. Don't know what to do about it.
case MAVLINK_MSG_ID_RC_CHANNELS_SCALED:
{
mavlink_rc_channels_scaled_t channels;
......@@ -974,7 +994,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
const unsigned int portWidth = 8; // XXX magic number
emit remoteControlRSSIChanged(channels.rssi/255.0f);
// TODO: This makes an assumption the RSSI has been normalized to 0-100
emit remoteControlRSSIChanged(channels.rssi);
if (static_cast<uint16_t>(channels.chan1_scaled) != UINT16_MAX)
emit remoteControlChannelScaledChanged(channels.port * portWidth + 0, channels.chan1_scaled/10000.0f);
if (static_cast<uint16_t>(channels.chan2_scaled) != UINT16_MAX)
......
......@@ -570,8 +570,8 @@ signals:
void remoteControlChannelRawChanged(int channelId, float raw);
/** @brief Value of a remote control channel (scaled)*/
void remoteControlChannelScaledChanged(int channelId, float normalized);
/** @brief Remote control RSSI changed */
void remoteControlRSSIChanged(float rssi);
/** @brief Remote control RSSI changed (0% - 100%)*/
void remoteControlRSSIChanged(uint8_t rssi);
/**
* @brief Localization quality changed
......
......@@ -61,8 +61,9 @@ MainToolBar::MainToolBar(QWidget* parent)
, _showRSSI(true)
, _showBattery(true)
, _progressBarValue(0.0f)
, _remoteRSSI(0.0f)
, _telemetryRSSI(0)
, _remoteRSSI(0)
, _telemetryRRSSI(0)
, _telemetryLRSSI(0)
, _rollDownMessages(0)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
......@@ -359,13 +360,19 @@ void MainToolBar::_setActiveUAS(UASInterface* active)
emit mavPresentChanged(_mav != NULL);
}
void MainToolBar::_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned rssi, unsigned, unsigned, unsigned, unsigned)
void MainToolBar::_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned rssi, unsigned remrssi, unsigned, unsigned, unsigned)
{
// We only care if we haveone single connection
if(_connectionCount == 1) {
if((unsigned)_telemetryRSSI != rssi) {
_telemetryRSSI = rssi;
emit telemetryRSSIChanged(_telemetryRSSI);
if((unsigned)_telemetryLRSSI != rssi) {
// According to the Silabs data sheet, the RSSI value is 0.5db per bit
_telemetryLRSSI = rssi >> 1;
emit telemetryLRSSIChanged(_telemetryLRSSI);
}
if((unsigned)_telemetryRRSSI != remrssi) {
// According to the Silabs data sheet, the RSSI value is 0.5db per bit
_telemetryRRSSI = remrssi >> 1;
emit telemetryRRSSIChanged(_telemetryRRSSI);
}
}
}
......@@ -461,12 +468,16 @@ void MainToolBar::_updateConnection(LinkInterface *disconnectedLink)
emit connectedListChanged(_connectedList);
}
// Update telemetry RSSI display
if(_connectionCount != 1 && _telemetryRSSI > 0) {
_telemetryRSSI = 0;
emit telemetryRSSIChanged(_telemetryRSSI);
if(_connectionCount != 1 && _telemetryRRSSI > 0) {
_telemetryRRSSI = 0;
emit telemetryRRSSIChanged(_telemetryRRSSI);
}
if(_connectionCount != 1 && _telemetryLRSSI > 0) {
_telemetryLRSSI = 0;
emit telemetryLRSSIChanged(_telemetryLRSSI);
}
if(_connectionCount != 1 && _remoteRSSI > 0.0f) {
_remoteRSSI = 0.0f;
if(_connectionCount != 1 && _remoteRSSI > 0) {
_remoteRSSI = 0;
emit remoteRSSIChanged(_remoteRSSI);
}
}
......
......@@ -99,12 +99,14 @@ public:
Q_PROPERTY(bool showBattery MEMBER _showBattery NOTIFY showBatteryChanged)
Q_PROPERTY(bool showRSSI MEMBER _showRSSI NOTIFY showRSSIChanged)
Q_PROPERTY(float progressBarValue MEMBER _progressBarValue NOTIFY progressBarValueChanged)
Q_PROPERTY(float remoteRSSI READ remoteRSSI NOTIFY remoteRSSIChanged)
Q_PROPERTY(int telemetryRSSI READ telemetryRSSI NOTIFY telemetryRSSIChanged)
Q_PROPERTY(int remoteRSSI READ remoteRSSI NOTIFY remoteRSSIChanged)
Q_PROPERTY(int telemetryRRSSI READ telemetryRRSSI NOTIFY telemetryRRSSIChanged)
Q_PROPERTY(int telemetryLRSSI READ telemetryLRSSI NOTIFY telemetryLRSSIChanged)
bool mavPresent () { return _mav != NULL; }
float remoteRSSI () { return _remoteRSSI; }
int telemetryRSSI () { return _telemetryRSSI; }
int remoteRSSI () { return _remoteRSSI; }
int telemetryRRSSI () { return _telemetryRRSSI; }
int telemetryLRSSI () { return _telemetryLRSSI; }
void setCurrentView (int currentView);
void viewStateChanged (const QString& key, bool value);
......@@ -134,8 +136,9 @@ signals:
void showBatteryChanged (bool value);
void showRSSIChanged (bool value);
void progressBarValueChanged (float value);
void remoteRSSIChanged (float value);
void telemetryRSSIChanged (int value);
void remoteRSSIChanged (int value);
void telemetryRRSSIChanged (int value);
void telemetryLRSSIChanged (int value);
private slots:
void _setActiveUAS (UASInterface* active);
......@@ -194,8 +197,9 @@ private:
bool _showRSSI;
bool _showBattery;
float _progressBarValue;
float _remoteRSSI;
int _telemetryRSSI;
int _remoteRSSI;
int _telemetryRRSSI;
int _telemetryLRSSI;
UASMessageViewRollDown* _rollDownMessages;
};
......
......@@ -126,9 +126,12 @@ Rectangle {
return colorGreen;
}
function getRSSIColor() {
// TODO: Figure out RSSI threshold values
return colorBlue;
function getRSSIColor(value) {
if(value < 10)
return colorRed;
if(value < 50)
return colorOrange;
return colorGreen;
}
function showMavStatus() {
......@@ -231,7 +234,7 @@ Rectangle {
visible: (mainToolBar.connectionCount > 0) && (mainToolBar.showMessages)
anchors.verticalCenter: parent.verticalCenter
color: getMessageColor()
radius: cellRadius
//radius: cellRadius
border.color: "#00000000"
border.width: 0
property bool showTriangle: false
......@@ -305,7 +308,7 @@ Rectangle {
visible: showMavStatus() && (mainToolBar.showMav)
anchors.verticalCenter: parent.verticalCenter
color: colorBlue
radius: cellRadius
//radius: cellRadius
border.color: "#00000000"
border.width: 0
Image {
......@@ -324,7 +327,7 @@ Rectangle {
visible: showMavStatus() && (mainToolBar.showGPS)
anchors.verticalCenter: parent.verticalCenter
color: getSatelliteColor();
radius: cellRadius
//radius: cellRadius
border.color: "#00000000"
border.width: 0
......@@ -353,19 +356,18 @@ Rectangle {
}
Rectangle {
id: rssi
width: getProportionalDimmension(70)
id: rssiRC
width: getProportionalDimmension(55)
height: cellHeight
visible: showMavStatus() && (mainToolBar.showRSSI) && ((mainToolBar.remoteRSSI > 0) || (mainToolBar.telemetryRSSI > 0))
visible: showMavStatus() && mainToolBar.showRSSI
anchors.verticalCenter: parent.verticalCenter
color: getRSSIColor();
radius: cellRadius
color: getRSSIColor(mainToolBar.remoteRSSI);
//radius: cellRadius
border.color: "#00000000"
border.width: 0
Image {
source: "qrc:/res/Antenna";
height: cellHeight * 0.65
source: "qrc:/res/AntennaRC";
width: cellHeight * 0.7
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
......@@ -373,26 +375,55 @@ Rectangle {
mipmap: true
smooth: true
}
QGCLabel {
text: mainToolBar.remoteRSSI
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight
font.pointSize: screenTools.dpiAdjustedPointSize(12);
font.weight: Font.DemiBold
color: colorWhite
}
}
Rectangle {
id: rssiTelemetry
width: getProportionalDimmension(80)
height: cellHeight
visible: showMavStatus() && (mainToolBar.showRSSI) && ((mainToolBar.telemetryRRSSI > 0) && (mainToolBar.telemetryLRSSI > 0))
anchors.verticalCenter: parent.verticalCenter
color: getRSSIColor(Math.min(mainToolBar.telemetryRRSSI,mainToolBar.telemetryLRSSI));
//radius: cellRadius
border.color: "#00000000"
border.width: 0
Image {
source: "qrc:/res/AntennaT";
width: cellHeight * 0.7
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(6)
mipmap: true
smooth: true
}
Column {
id: rssiCombined
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
visible: (mainToolBar.remoteRSSI > 0) && (mainToolBar.telemetryRSSI > 0)
Row {
anchors.right: parent.right
QGCLabel {
text: 'R '
font.pointSize: screenTools.dpiAdjustedPointSize(12);
font.pointSize: screenTools.dpiAdjustedPointSize(11);
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: (mainToolBar.remoteRSSI * 100).toFixed(0)
width: getProportionalDimmension(20)
text: mainToolBar.telemetryRRSSI + 'dB'
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pointSize: screenTools.dpiAdjustedPointSize(12);
font.pointSize: screenTools.dpiAdjustedPointSize(11);
font.weight: Font.DemiBold
color: colorWhite
}
......@@ -400,65 +431,21 @@ Rectangle {
Row {
anchors.right: parent.right
QGCLabel {
text: 'T '
font.pointSize: screenTools.dpiAdjustedPointSize(12);
text: 'L '
font.pointSize: screenTools.dpiAdjustedPointSize(11);
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: mainToolBar.telemetryRSSI
width: getProportionalDimmension(20)
text: mainToolBar.telemetryLRSSI + 'dB'
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pointSize: screenTools.dpiAdjustedPointSize(12);
font.pointSize: screenTools.dpiAdjustedPointSize(11);
font.weight: Font.DemiBold
color: colorWhite
}
}
}
Row {
id: telemetryRSSISingle
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
visible: (mainToolBar.remoteRSSI < 0.01) && (mainToolBar.telemetryRSSI > 0)
anchors.verticalCenter: parent.verticalCenter
QGCLabel {
text: 'T '
font.pointSize: screenTools.dpiAdjustedPointSize(12);
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: mainToolBar.telemetryRSSI
width: getProportionalDimmension(20)
horizontalAlignment: Text.AlignRight
font.pointSize: screenTools.dpiAdjustedPointSize(12);
font.weight: Font.DemiBold
color: colorWhite
}
}
Row {
id: remoteRSSISingle
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
visible: (mainToolBar.remoteRSSI > 0) && (mainToolBar.telemetryRSSI === 0)
anchors.verticalCenter: parent.verticalCenter
QGCLabel {
text: 'R '
font.pointSize: screenTools.dpiAdjustedPointSize(12);
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: (mainToolBar.remoteRSSI * 100).toFixed(0)
width: getProportionalDimmension(20)
horizontalAlignment: Text.AlignRight
font.pointSize: screenTools.dpiAdjustedPointSize(12);
font.weight: Font.DemiBold
color: colorWhite
}
}
}
Rectangle {
......@@ -468,7 +455,7 @@ Rectangle {
visible: showMavStatus() && (mainToolBar.showBattery)
anchors.verticalCenter: parent.verticalCenter
color: (mainToolBar.batteryPercent > 40.0 || mainToolBar.batteryPercent < 0.01) ? colorBlue : colorRed
radius: cellRadius
//radius: cellRadius
border.color: "#00000000"
border.width: 0
......
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