dsm rctest fix num_values return

This commit is contained in:
Daniel Agar 2017-01-29 17:51:33 -05:00 committed by Lorenz Meier
parent 93b0f07b43
commit de128aaa6e
3 changed files with 4 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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);