mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 00:43:33 +08:00
px4io: fixed array reference bug
This commit is contained in:
@@ -290,7 +290,7 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value)
|
|||||||
case PX4IO_PAGE_RC_CONFIG: {
|
case PX4IO_PAGE_RC_CONFIG: {
|
||||||
unsigned channel = offset / PX4IO_P_RC_CONFIG_STRIDE;
|
unsigned channel = offset / PX4IO_P_RC_CONFIG_STRIDE;
|
||||||
unsigned index = offset % PX4IO_P_RC_CONFIG_STRIDE;
|
unsigned index = offset % PX4IO_P_RC_CONFIG_STRIDE;
|
||||||
uint16_t *conf = &r_page_rc_input_config[offset * PX4IO_P_RC_CONFIG_STRIDE];
|
uint16_t *conf = &r_page_rc_input_config[channel * PX4IO_P_RC_CONFIG_STRIDE];
|
||||||
|
|
||||||
if (channel >= MAX_CONTROL_CHANNELS)
|
if (channel >= MAX_CONTROL_CHANNELS)
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user