mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 15:23:34 +08:00
DSM: Report frame drops
Frame drops were measured but not reported on PX4IO.
This commit is contained in:
+8
-3
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2020 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2012-2021 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -705,10 +705,12 @@ bool dsm_decode(hrt_abstime frame_time, uint16_t *values, uint16_t *num_values,
|
|||||||
* @param[out] n_butes number of bytes read
|
* @param[out] n_butes number of bytes read
|
||||||
* @param[out] bytes pointer to the buffer of read bytes
|
* @param[out] bytes pointer to the buffer of read bytes
|
||||||
* @param[out] rssi value in percent, if supported, or 127
|
* @param[out] rssi value in percent, if supported, or 127
|
||||||
|
* @param[out] frame_drops dropped frames (indication of an unstable link)
|
||||||
|
* @param[in] max_values maximum number of channels the receiver can process
|
||||||
* @return true=decoded raw channel values updated, false=no update
|
* @return true=decoded raw channel values updated, false=no update
|
||||||
*/
|
*/
|
||||||
bool dsm_input(int fd, uint16_t *values, uint16_t *num_values, bool *dsm_11_bit, uint8_t *n_bytes, uint8_t **bytes,
|
bool dsm_input(int fd, uint16_t *values, uint16_t *num_values, bool *dsm_11_bit, uint8_t *n_bytes, uint8_t **bytes,
|
||||||
int8_t *rssi, unsigned max_values)
|
int8_t *rssi, unsigned *frame_drops, unsigned max_values)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The S.BUS protocol doesn't provide reliable framing,
|
* The S.BUS protocol doesn't provide reliable framing,
|
||||||
@@ -848,8 +850,11 @@ bool dsm_parse(const uint64_t now, const uint8_t *frame, const unsigned len, uin
|
|||||||
memcpy(&values[0], &dsm_chan_buf[0], dsm_chan_count * sizeof(dsm_chan_buf[0]));
|
memcpy(&values[0], &dsm_chan_buf[0], dsm_chan_count * sizeof(dsm_chan_buf[0]));
|
||||||
#ifdef DSM_DEBUG
|
#ifdef DSM_DEBUG
|
||||||
|
|
||||||
|
printf("PACKET ---------\n");
|
||||||
|
printf("frame drops: %u, chan #: %u\n", dsm_frame_drops, dsm_chan_count);
|
||||||
|
|
||||||
for (unsigned i = 0; i < dsm_chan_count; i++) {
|
for (unsigned i = 0; i < dsm_chan_count; i++) {
|
||||||
printf("dsm_decode: %u: %u\n", i, values[i]);
|
printf("dsm_decode: #CH %02u: %u\n", i + 1, values[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2012-2021 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -70,7 +70,7 @@ __EXPORT void dsm_deinit(void);
|
|||||||
__EXPORT void dsm_proto_init(void);
|
__EXPORT void dsm_proto_init(void);
|
||||||
__EXPORT int dsm_config(int dsm_fd);
|
__EXPORT int dsm_config(int dsm_fd);
|
||||||
__EXPORT bool dsm_input(int dsm_fd, uint16_t *values, uint16_t *num_values, bool *dsm_11_bit, uint8_t *n_bytes,
|
__EXPORT bool dsm_input(int dsm_fd, uint16_t *values, uint16_t *num_values, bool *dsm_11_bit, uint8_t *n_bytes,
|
||||||
uint8_t **bytes, int8_t *rssi, unsigned max_values);
|
uint8_t **bytes, int8_t *rssi, unsigned *frame_drops, unsigned max_values);
|
||||||
|
|
||||||
__EXPORT bool dsm_parse(const uint64_t now, const uint8_t *frame, const unsigned len, uint16_t *values,
|
__EXPORT bool dsm_parse(const uint64_t now, const uint8_t *frame, const unsigned len, uint16_t *values,
|
||||||
uint16_t *num_values, bool *dsm_11_bit, unsigned *frame_drops, int8_t *rssi_percent, uint16_t max_channels);
|
uint16_t *num_values, bool *dsm_11_bit, unsigned *frame_drops, int8_t *rssi_percent, uint16_t max_channels);
|
||||||
|
|||||||
Reference in New Issue
Block a user