Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
22f6b1a4
Commit
22f6b1a4
authored
May 08, 2017
by
Gus Grubba
Committed by
GitHub
May 08, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5110 from dogmaphobic/telemetryRSSI
Telemetry RSSI
parents
a7985ec0
dc9cbc4d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
85 deletions
+89
-85
Vehicle.cc
src/Vehicle/Vehicle.cc
+61
-32
Vehicle.h
src/Vehicle/Vehicle.h
+9
-9
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+0
-33
TelemetryRSSIIndicator.qml
src/ui/toolbar/TelemetryRSSIIndicator.qml
+19
-11
No files found.
src/Vehicle/Vehicle.cc
View file @
22f6b1a4
...
...
@@ -165,7 +165,6 @@ Vehicle::Vehicle(LinkInterface* link,
_mavlink
=
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
();
connect
(
_mavlink
,
&
MAVLinkProtocol
::
messageReceived
,
this
,
&
Vehicle
::
_mavlinkMessageReceived
);
connect
(
_mavlink
,
&
MAVLinkProtocol
::
radioStatusChanged
,
this
,
&
Vehicle
::
_telemetryChanged
);
connect
(
this
,
&
Vehicle
::
_sendMessageOnLinkOnThread
,
this
,
&
Vehicle
::
_sendMessageOnLink
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
Vehicle
::
flightModeChanged
,
this
,
&
Vehicle
::
_handleFlightModeChanged
);
...
...
@@ -445,37 +444,6 @@ void Vehicle::resetCounters()
_heardFrom
=
false
;
}
void
Vehicle
::
_telemetryChanged
(
LinkInterface
*
,
unsigned
rxerrors
,
unsigned
fixed
,
int
rssi
,
int
remrssi
,
unsigned
txbuf
,
unsigned
noise
,
unsigned
remnoise
)
{
if
(
_telemetryLRSSI
!=
rssi
)
{
_telemetryLRSSI
=
rssi
;
emit
telemetryLRSSIChanged
(
_telemetryLRSSI
);
}
if
(
_telemetryRRSSI
!=
remrssi
)
{
_telemetryRRSSI
=
remrssi
;
emit
telemetryRRSSIChanged
(
_telemetryRRSSI
);
}
if
(
_telemetryRXErrors
!=
rxerrors
)
{
_telemetryRXErrors
=
rxerrors
;
emit
telemetryRXErrorsChanged
(
_telemetryRXErrors
);
}
if
(
_telemetryFixed
!=
fixed
)
{
_telemetryFixed
=
fixed
;
emit
telemetryFixedChanged
(
_telemetryFixed
);
}
if
(
_telemetryTXBuffer
!=
txbuf
)
{
_telemetryTXBuffer
=
txbuf
;
emit
telemetryTXBufferChanged
(
_telemetryTXBuffer
);
}
if
(
_telemetryLNoise
!=
noise
)
{
_telemetryLNoise
=
noise
;
emit
telemetryLNoiseChanged
(
_telemetryLNoise
);
}
if
(
_telemetryRNoise
!=
remnoise
)
{
_telemetryRNoise
=
remnoise
;
emit
telemetryRNoiseChanged
(
_telemetryRNoise
);
}
}
void
Vehicle
::
_mavlinkMessageReceived
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
...
...
@@ -529,6 +497,9 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes
case
MAVLINK_MSG_ID_HEARTBEAT
:
_handleHeartbeat
(
message
);
break
;
case
MAVLINK_MSG_ID_RADIO_STATUS
:
_handleRadioStatus
(
message
);
break
;
case
MAVLINK_MSG_ID_RC_CHANNELS
:
_handleRCChannels
(
message
);
break
;
...
...
@@ -1018,6 +989,64 @@ void Vehicle::_handleHeartbeat(mavlink_message_t& message)
}
}
void
Vehicle
::
_handleRadioStatus
(
mavlink_message_t
&
message
)
{
//-- Process telemetry status message
mavlink_radio_status_t
rstatus
;
mavlink_msg_radio_status_decode
(
&
message
,
&
rstatus
);
int
rssi
=
rstatus
.
rssi
;
int
remrssi
=
rstatus
.
remrssi
;
int
lnoise
=
(
int
)(
int8_t
)
rstatus
.
noise
;
int
rnoise
=
(
int
)(
int8_t
)
rstatus
.
remnoise
;
//-- 3DR Si1k radio needs rssi fields to be converted to dBm
if
(
message
.
sysid
==
'3'
&&
message
.
compid
==
'D'
)
{
/* Per the Si1K datasheet figure 23.25 and SI AN474 code
* samples the relationship between the RSSI register
* and received power is as follows:
*
* 10
* inputPower = rssi * ------ 127
* 19
*
* Additionally limit to the only realistic range [-120,0] dBm
*/
rssi
=
qMin
(
qMax
(
qRound
(
static_cast
<
qreal
>
(
rssi
)
/
1.9
-
127.0
),
-
120
),
0
);
remrssi
=
qMin
(
qMax
(
qRound
(
static_cast
<
qreal
>
(
remrssi
)
/
1.9
-
127.0
),
-
120
),
0
);
}
else
{
rssi
=
(
int
)(
int8_t
)
rstatus
.
rssi
;
remrssi
=
(
int
)(
int8_t
)
rstatus
.
remrssi
;
}
//-- Check for changes
if
(
_telemetryLRSSI
!=
rssi
)
{
_telemetryLRSSI
=
rssi
;
emit
telemetryLRSSIChanged
(
_telemetryLRSSI
);
}
if
(
_telemetryRRSSI
!=
remrssi
)
{
_telemetryRRSSI
=
remrssi
;
emit
telemetryRRSSIChanged
(
_telemetryRRSSI
);
}
if
(
_telemetryRXErrors
!=
rstatus
.
rxerrors
)
{
_telemetryRXErrors
=
rstatus
.
rxerrors
;
emit
telemetryRXErrorsChanged
(
_telemetryRXErrors
);
}
if
(
_telemetryFixed
!=
rstatus
.
fixed
)
{
_telemetryFixed
=
rstatus
.
fixed
;
emit
telemetryFixedChanged
(
_telemetryFixed
);
}
if
(
_telemetryTXBuffer
!=
rstatus
.
txbuf
)
{
_telemetryTXBuffer
=
rstatus
.
txbuf
;
emit
telemetryTXBufferChanged
(
_telemetryTXBuffer
);
}
if
(
_telemetryLNoise
!=
lnoise
)
{
_telemetryLNoise
=
lnoise
;
emit
telemetryLNoiseChanged
(
_telemetryLNoise
);
}
if
(
_telemetryRNoise
!=
rnoise
)
{
_telemetryRNoise
=
rnoise
;
emit
telemetryRNoiseChanged
(
_telemetryRNoise
);
}
}
void
Vehicle
::
_handleRCChannels
(
mavlink_message_t
&
message
)
{
mavlink_rc_channels_t
channels
;
...
...
src/Vehicle/Vehicle.h
View file @
22f6b1a4
...
...
@@ -308,8 +308,8 @@ public:
Q_PROPERTY
(
unsigned
int
telemetryRXErrors
READ
telemetryRXErrors
NOTIFY
telemetryRXErrorsChanged
)
Q_PROPERTY
(
unsigned
int
telemetryFixed
READ
telemetryFixed
NOTIFY
telemetryFixedChanged
)
Q_PROPERTY
(
unsigned
int
telemetryTXBuffer
READ
telemetryTXBuffer
NOTIFY
telemetryTXBufferChanged
)
Q_PROPERTY
(
unsigned
int
telemetryLNoise
READ
telemetryLNoise
NOTIFY
telemetryLNoiseChanged
)
Q_PROPERTY
(
unsigned
int
telemetryRNoise
READ
telemetryRNoise
NOTIFY
telemetryRNoiseChanged
)
Q_PROPERTY
(
int
telemetryLNoise
READ
telemetryLNoise
NOTIFY
telemetryLNoiseChanged
)
Q_PROPERTY
(
int
telemetryRNoise
READ
telemetryRNoise
NOTIFY
telemetryRNoiseChanged
)
Q_PROPERTY
(
QVariantList
toolBarIndicators
READ
toolBarIndicators
CONSTANT
)
Q_PROPERTY
(
QVariantList
cameraList
READ
cameraList
CONSTANT
)
...
...
@@ -590,8 +590,8 @@ public:
unsigned
int
telemetryRXErrors
()
{
return
_telemetryRXErrors
;
}
unsigned
int
telemetryFixed
()
{
return
_telemetryFixed
;
}
unsigned
int
telemetryTXBuffer
()
{
return
_telemetryTXBuffer
;
}
unsigned
int
telemetryLNoise
()
{
return
_telemetryLNoise
;
}
unsigned
int
telemetryRNoise
()
{
return
_telemetryRNoise
;
}
int
telemetryLNoise
()
{
return
_telemetryLNoise
;
}
int
telemetryRNoise
()
{
return
_telemetryRNoise
;
}
bool
autoDisarm
();
Fact
*
roll
(
void
)
{
return
&
_rollFact
;
}
...
...
@@ -730,8 +730,8 @@ signals:
void
telemetryRXErrorsChanged
(
unsigned
int
value
);
void
telemetryFixedChanged
(
unsigned
int
value
);
void
telemetryTXBufferChanged
(
unsigned
int
value
);
void
telemetryLNoiseChanged
(
unsigned
int
value
);
void
telemetryRNoiseChanged
(
unsigned
int
value
);
void
telemetryLNoiseChanged
(
int
value
);
void
telemetryRNoiseChanged
(
int
value
);
void
autoDisarmChanged
(
void
);
void
firmwareMajorVersionChanged
(
int
major
);
...
...
@@ -770,7 +770,6 @@ signals:
private
slots
:
void
_mavlinkMessageReceived
(
LinkInterface
*
link
,
mavlink_message_t
message
);
void
_telemetryChanged
(
LinkInterface
*
link
,
unsigned
rxerrors
,
unsigned
fixed
,
int
rssi
,
int
remrssi
,
unsigned
txbuf
,
unsigned
noise
,
unsigned
remnoise
);
void
_linkInactiveOrDeleted
(
LinkInterface
*
link
);
void
_sendMessageOnLink
(
LinkInterface
*
link
,
mavlink_message_t
message
);
void
_sendMessageMultipleNext
(
void
);
...
...
@@ -810,6 +809,7 @@ private:
void
_startJoystick
(
bool
start
);
void
_handleHomePosition
(
mavlink_message_t
&
message
);
void
_handleHeartbeat
(
mavlink_message_t
&
message
);
void
_handleRadioStatus
(
mavlink_message_t
&
message
);
void
_handleRCChannels
(
mavlink_message_t
&
message
);
void
_handleRCChannelsRaw
(
mavlink_message_t
&
message
);
void
_handleBatteryStatus
(
mavlink_message_t
&
message
);
...
...
@@ -900,8 +900,8 @@ private:
uint32_t
_telemetryRXErrors
;
uint32_t
_telemetryFixed
;
uint32_t
_telemetryTXBuffer
;
uint32_t
_telemetryLNoise
;
uint32_t
_telemetryRNoise
;
int
_telemetryLNoise
;
int
_telemetryRNoise
;
bool
_vehicleCapabilitiesKnown
;
bool
_supportsMissionItemInt
;
...
...
src/comm/MAVLinkProtocol.cc
View file @
22f6b1a4
...
...
@@ -208,39 +208,6 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
link
->
setDecodedFirstMavlinkPacket
(
true
);
}
if
(
message
.
msgid
==
MAVLINK_MSG_ID_RADIO_STATUS
)
{
// process telemetry status message
mavlink_radio_status_t
rstatus
;
mavlink_msg_radio_status_decode
(
&
message
,
&
rstatus
);
int
rssi
=
rstatus
.
rssi
;
int
remrssi
=
rstatus
.
remrssi
;
int
noise
=
rstatus
.
noise
;
int
remnoise
=
rstatus
.
remnoise
;
// 3DR Si1k radio needs rssi fields to be converted to dBm
if
(
message
.
sysid
==
'3'
&&
message
.
compid
==
'D'
)
{
/* Per the Si1K datasheet figure 23.25 and SI AN474 code
* samples the relationship between the RSSI register
* and received power is as follows:
*
* 10
* inputPower = rssi * ------ 127
* 19
*
* Additionally limit to the only realistic range [-120,0] dBm
*/
rssi
=
qMin
(
qMax
(
qRound
(
static_cast
<
qreal
>
(
rssi
)
/
1.9
-
127.0
),
-
120
),
0
);
remrssi
=
qMin
(
qMax
(
qRound
(
static_cast
<
qreal
>
(
remrssi
)
/
1.9
-
127.0
),
-
120
),
0
);
}
else
{
rssi
=
(
int8_t
)
rstatus
.
rssi
;
remrssi
=
(
int8_t
)
rstatus
.
remrssi
;
noise
=
(
int8_t
)
rstatus
.
noise
;
remnoise
=
(
int8_t
)
rstatus
.
remnoise
;
}
emit
radioStatusChanged
(
link
,
rstatus
.
rxerrors
,
rstatus
.
fixed
,
rssi
,
remrssi
,
rstatus
.
txbuf
,
noise
,
remnoise
);
}
#ifndef __mobile__
// Log data
...
...
src/ui/toolbar/TelemetryRSSIIndicator.qml
View file @
22f6b1a4
...
...
@@ -20,16 +20,14 @@ import QGroundControl.Palette 1.0
//-------------------------------------------------------------------------
//-- Telemetry RSSI
QGCColoredImage
{
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
sourceSize.height
:
height
source
:
"
/qmlimages/TelemRSSI.svg
"
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
buttonText
visible
:
_activeVehicle
?
(
_activeVehicle
.
telemetryLRSSI
<
0
)
:
false
Item
{
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
width
:
_hasTelemetry
?
telemIcon
.
width
*
1.1
:
0
visible
:
_hasTelemetry
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
bool
_hasTelemetry
:
_activeVehicle
?
_activeVehicle
.
telemetryLRSSI
!==
0
:
false
Component
{
id
:
telemRSSIInfo
...
...
@@ -58,9 +56,9 @@ QGCColoredImage {
columns
:
2
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCLabel
{
text
:
qsTr
(
"
Local RSSI:
"
)
}
QGCLabel
{
text
:
_activeVehicle
.
telemetryLRSSI
+
"
dBm
"
}
QGCLabel
{
text
:
_activeVehicle
.
telemetryLRSSI
+
"
dBm
"
}
QGCLabel
{
text
:
qsTr
(
"
Remote RSSI:
"
)
}
QGCLabel
{
text
:
_activeVehicle
.
telemetryRRSSI
+
"
dBm
"
}
QGCLabel
{
text
:
_activeVehicle
.
telemetryRRSSI
+
"
dBm
"
}
QGCLabel
{
text
:
qsTr
(
"
RX Errors:
"
)
}
QGCLabel
{
text
:
_activeVehicle
.
telemetryRXErrors
}
QGCLabel
{
text
:
qsTr
(
"
Errors Fixed:
"
)
}
...
...
@@ -80,6 +78,16 @@ QGCColoredImage {
}
}
}
QGCColoredImage
{
id
:
telemIcon
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
width
:
height
sourceSize.height
:
height
source
:
"
/qmlimages/TelemRSSI.svg
"
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
buttonText
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment