mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
dsm rctest fix num_values return
This commit is contained in:
parent
93b0f07b43
commit
de128aaa6e
@ -594,7 +594,7 @@ dsm_input(int fd, uint16_t *values, uint16_t *num_values, bool *dsm_11_bit, uint
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@ -691,10 +691,7 @@ dsm_parse(uint64_t now, uint8_t *frame, unsigned len, uint16_t *values,
|
||||
}
|
||||
|
||||
if (decode_ret) {
|
||||
/* num values should not decrease, only increase */
|
||||
if (dsm_chan_count > *num_values) {
|
||||
*num_values = dsm_chan_count;
|
||||
}
|
||||
*num_values = dsm_chan_count;
|
||||
|
||||
memcpy(&values[0], &dsm_chan_buf[0], dsm_chan_count * sizeof(dsm_chan_buf[0]));
|
||||
#ifdef DSM_DEBUG
|
||||
|
||||
@ -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,
|
||||
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);
|
||||
|
||||
#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);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user