mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 06:23:33 +08:00
dsm rctest fix num_values return
This commit is contained in:
committed by
Lorenz Meier
parent
93b0f07b43
commit
de128aaa6e
+2
-5
@@ -594,7 +594,7 @@ dsm_input(int fd, uint16_t *values, uint16_t *num_values, bool *dsm_11_bit, uint
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
dsm_parse(uint64_t now, uint8_t *frame, unsigned len, uint16_t *values,
|
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, uint16_t max_channels)
|
uint16_t *num_values, bool *dsm_11_bit, unsigned *frame_drops, uint16_t max_channels)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -691,10 +691,7 @@ dsm_parse(uint64_t now, uint8_t *frame, unsigned len, uint16_t *values,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (decode_ret) {
|
if (decode_ret) {
|
||||||
/* num values should not decrease, only increase */
|
*num_values = dsm_chan_count;
|
||||||
if (dsm_chan_count > *num_values) {
|
|
||||||
*num_values = dsm_chan_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ __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, unsigned max_values);
|
uint8_t **bytes, unsigned max_values);
|
||||||
|
|
||||||
__EXPORT bool dsm_parse(uint64_t now, uint8_t *frame, 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, uint16_t max_channels);
|
uint16_t *num_values, bool *dsm_11_bit, unsigned *frame_drops, uint16_t max_channels);
|
||||||
|
|
||||||
#ifdef GPIO_SPEKTRUM_PWR_EN
|
#ifdef GPIO_SPEKTRUM_PWR_EN
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ bool RCTest::dsmTest(const char *filepath, unsigned expected_chancount, unsigned
|
|||||||
&dsm_11_bit, &dsm_frame_drops, max_channels);
|
&dsm_11_bit, &dsm_frame_drops, max_channels);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
ut_test(num_values == expected_chancount);
|
ut_compare("num_values == expected_chancount", num_values, expected_chancount);
|
||||||
|
|
||||||
ut_test(abs((int)chan0 - (int)rc_values[0]) < 30);
|
ut_test(abs((int)chan0 - (int)rc_values[0]) < 30);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user