From e852d6300fa61553bebff588528c2ec083351d8b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 16 Jan 2013 14:19:43 +1100 Subject: [PATCH] AP_HAL_AVR: fixed multi-channel RC output --- libraries/AP_HAL_AVR/RCOutput_APM1.cpp | 2 +- libraries/AP_HAL_AVR/RCOutput_APM2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_AVR/RCOutput_APM1.cpp b/libraries/AP_HAL_AVR/RCOutput_APM1.cpp index ddec469ec8..c2f1b109f9 100644 --- a/libraries/AP_HAL_AVR/RCOutput_APM1.cpp +++ b/libraries/AP_HAL_AVR/RCOutput_APM1.cpp @@ -191,7 +191,7 @@ void APM1RCOutput::write(uint8_t ch, uint16_t period_us) { } void APM1RCOutput::write(uint8_t ch, uint16_t* period_us, uint8_t len) { - for (int i = 0; i < ch; i++) { + for (int i = 0; i < len; i++) { write(i + ch, period_us[i]); } } diff --git a/libraries/AP_HAL_AVR/RCOutput_APM2.cpp b/libraries/AP_HAL_AVR/RCOutput_APM2.cpp index 69f5e4c8d6..1125baeff3 100644 --- a/libraries/AP_HAL_AVR/RCOutput_APM2.cpp +++ b/libraries/AP_HAL_AVR/RCOutput_APM2.cpp @@ -183,7 +183,7 @@ void APM2RCOutput::write(uint8_t ch, uint16_t period_us) { } void APM2RCOutput::write(uint8_t ch, uint16_t* period_us, uint8_t len) { - for (int i = 0; i < ch; i++) { + for (int i = 0; i < len; i++) { write(i + ch, period_us[i]); } }