Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
On-Board Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
On-Board Software
Commits
4bb36914
Commit
4bb36914
authored
2 years ago
by
Davide Mor
Browse files
Options
Downloads
Patches
Plain Diff
[Groundstation] Added receiver telemetries
parent
9e096085
Branches
Branches containing commit
Tags
Tags containing commit
Loading
Checking pipeline status
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
skyward-boardcore
+1
-1
1 addition, 1 deletion
skyward-boardcore
src/entrypoints/Groundstation/GUI/GUI.h
+3
-3
3 additions, 3 deletions
src/entrypoints/Groundstation/GUI/GUI.h
src/entrypoints/Groundstation/groundstation-entry.cpp
+61
-15
61 additions, 15 deletions
src/entrypoints/Groundstation/groundstation-entry.cpp
with
65 additions
and
19 deletions
skyward-boardcore
@
77bbf515
Compare
3776cbed
...
77bbf515
Subproject commit
3
77
6cbeddfb40bad90ee0e1c3de118f9398dae9f
Subproject commit 77
bbf515fe7eeac550db458279e4490e2a9f7115
This diff is collapsed.
Click to expand it.
src/entrypoints/Groundstation/GUI/GUI.h
+
3
−
3
View file @
4bb36914
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include
<utils/gui/ScreenManager.h>
#include
<utils/gui/ScreenManager.h>
#include
<utils/gui/VerticalLayout.h>
#include
<utils/gui/VerticalLayout.h>
std
::
string
format_link_speed
(
size
_t
value
)
std
::
string
format_link_speed
(
uint64
_t
value
)
{
{
if
(
value
>
1000000
)
if
(
value
>
1000000
)
return
fmt
::
format
(
"{:.2f} Mb/s"
,
static_cast
<
float
>
(
value
)
/
1000000
);
return
fmt
::
format
(
"{:.2f} Mb/s"
,
static_cast
<
float
>
(
value
)
/
1000000
);
...
@@ -54,8 +54,8 @@ class StatsScreen
...
@@ -54,8 +54,8 @@ class StatsScreen
public:
public:
struct
Data
struct
Data
{
{
size
_t
tx_bitrate
;
uint64
_t
tx_bitrate
;
size
_t
rx_bitrate
;
uint64
_t
rx_bitrate
;
int
sent_count
;
int
sent_count
;
int
recv_count
;
int
recv_count
;
float
rssi
;
float
rssi
;
...
...
This diff is collapsed.
Click to expand it.
src/entrypoints/Groundstation/groundstation-entry.cpp
+
61
−
15
View file @
4bb36914
...
@@ -20,8 +20,10 @@
...
@@ -20,8 +20,10 @@
* THE SOFTWARE.
* THE SOFTWARE.
*/
*/
#include
<common/Mavlink.h>
#include
<common/SX1278Config.h>
#include
<common/SX1278Config.h>
#include
<drivers/interrupt/external_interrupts.h>
#include
<drivers/interrupt/external_interrupts.h>
#include
<drivers/timer/TimestampTimer.h>
#include
<drivers/usart/USART.h>
#include
<drivers/usart/USART.h>
#include
<filesystem/console/console_device.h>
#include
<filesystem/console/console_device.h>
#include
<interfaces-impl/hwmapping.h>
#include
<interfaces-impl/hwmapping.h>
...
@@ -56,33 +58,77 @@ constexpr size_t DELTA_T = 100;
...
@@ -56,33 +58,77 @@ constexpr size_t DELTA_T = 100;
struct
Stats
struct
Stats
{
{
MovingAverage
<
size
_t
,
10
>
tx
;
MovingAverage
<
uint64
_t
,
10
>
tx
;
MovingAverage
<
size
_t
,
10
>
rx
;
MovingAverage
<
uint64
_t
,
10
>
rx
;
size
_t
cur_tx
=
0
;
uint64
_t
cur_tx
=
0
;
size
_t
cur_rx
=
0
;
uint64
_t
cur_rx
=
0
;
int
sent_count
=
0
;
int
sent_count
=
0
;
int
recv_count
=
0
;
int
recv_count
=
0
;
float
rssi
=
0.0
f
;
float
rssi
=
0.0
f
;
float
fei
=
0.0
f
;
float
fei
=
0.0
f
;
size_t
txBitrate
()
{
return
(
tx
.
getAverage
()
*
1000
)
/
DELTA_T
;
}
uint64_t
txBitrate
()
{
return
(
tx
.
getAverage
()
*
1000
)
/
DELTA_T
;
}
size_t
rxBitrate
()
{
return
(
rx
.
getAverage
()
*
1000
)
/
DELTA_T
;
}
uint64_t
rxBitrate
()
{
return
(
rx
.
getAverage
()
*
1000
)
/
DELTA_T
;
}
mavlink_receiver_tm_t
toMavlink
()
{
mavlink_receiver_tm_t
tm
=
{};
tm
.
rssi
=
rssi
;
tm
.
fei
=
fei
;
tm
.
tx_bitrate
=
txBitrate
();
tm
.
rx_bitrate
=
rxBitrate
();
return
tm
;
}
}
stats
;
}
stats
;
void
usartWriteMavlink
(
const
mavlink_message_t
&
msg
)
{
uint8_t
temp_buf
[
MAVLINK_NUM_NON_PAYLOAD_BYTES
+
MAVLINK_MAX_DIALECT_PAYLOAD_SIZE
];
int
len
=
mavlink_msg_to_send_buffer
(
temp_buf
,
&
msg
);
usart
->
write
(
temp_buf
,
len
);
}
void
sendStats
()
{
mavlink_receiver_tm_t
tm
=
stats
.
toMavlink
();
tm
.
timestamp
=
TimestampTimer
::
getTimestamp
();
mavlink_message_t
msg
;
mavlink_msg_receiver_tm_encode
(
0
,
0
,
&
msg
,
&
tm
);
usartWriteMavlink
(
msg
);
}
void
recvLoop
()
void
recvLoop
()
{
{
uint8_t
msg
[
256
];
uint8_t
buf
[
63
];
mavlink_message_t
msg
;
mavlink_status_t
status
;
while
(
true
)
while
(
true
)
{
{
int
len
=
sx1278
->
receive
(
msg
,
sizeof
(
msg
));
int
len
=
sx1278
->
receive
(
buf
,
sizeof
(
msg
));
stats
.
rssi
=
sx1278
->
getLastRxRssi
();
stats
.
rssi
=
sx1278
->
getLastRxRssi
();
stats
.
fei
=
sx1278
->
getLastRxFei
();
stats
.
fei
=
sx1278
->
getLastRxFei
();
stats
.
recv_count
++
;
stats
.
recv_count
++
;
stats
.
cur_rx
+=
len
;
stats
.
cur_rx
+=
len
;
usart
->
write
(
msg
,
len
);
sendStats
();
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
uint8_t
result
=
mavlink_parse_char
(
MAVLINK_COMM_0
,
buf
[
i
],
&
msg
,
&
status
);
if
(
result
==
1
)
usartWriteMavlink
(
msg
);
}
// usart->write(msg, len);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment