AP_HAL_AVR: fixed bounds check for rc input

This commit is contained in:
Andrew Tridgell 2012-12-07 08:38:04 +11:00
parent a79adcb7f4
commit 31bb300f81
2 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ static inline uint16_t constrain_pulse(uint16_t p) {
uint16_t APM1RCInput::read(uint8_t ch) {
/* constrain ch */
if (ch < AVR_RC_INPUT_NUM_CHANNELS) return 0;
if (ch >= AVR_RC_INPUT_NUM_CHANNELS) return 0;
/* grab channel from isr's memory in critical section*/
cli();
uint16_t capt = _pulse_capt[ch];

View File

@ -84,7 +84,7 @@ static inline uint16_t constrain_pulse(uint16_t p) {
uint16_t APM2RCInput::read(uint8_t ch) {
/* constrain ch */
if (ch < AVR_RC_INPUT_NUM_CHANNELS) return 0;
if (ch >= AVR_RC_INPUT_NUM_CHANNELS) return 0;
/* grab channel from isr's memory in critical section*/
cli();
uint16_t capt = _pulse_capt[ch];