From e7dacaa04575c5ec9c7425b3800e4410e7f522fc Mon Sep 17 00:00:00 2001 From: DennisEisold <de@eisold-edv.de> Date: Mon, 19 Jan 2015 21:16:30 +0100 Subject: [PATCH] added Reverse Flap --- libraries/AP_HAL_AVR/RCOutput_APM2.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_AVR/RCOutput_APM2.cpp b/libraries/AP_HAL_AVR/RCOutput_APM2.cpp index fdf5106f2..ab25eba61 100644 --- a/libraries/AP_HAL_AVR/RCOutput_APM2.cpp +++ b/libraries/AP_HAL_AVR/RCOutput_APM2.cpp @@ -153,8 +153,20 @@ void APM2RCOutput::write(uint8_t ch, uint16_t period_us) { switch(ch) { case 0: OCR1B=pwm; break; // out1 - case 1: OCR1A=pwm; break; // out2 - case 2: OCR4C=pwm; break; // out3 + case 1: { + //OCR1A=pwm; + break; // out2 + } + case 2: { + if (period_us > 1500) { + OCR4C=constrain_period((uint16_t)(period_us)) << 1; + OCR1A=constrain_period((uint16_t)(1000)) << 1; + } else { + OCR4C=constrain_period((uint16_t)(1500 - period_us + 1500)) << 1; + OCR1A=constrain_period((uint16_t)(2000)) << 1; + } + break; // out3 + } case 3: OCR4B=pwm; break; // out4 case 4: OCR4A=pwm; break; // out5 case 5: OCR3C=pwm; break; // out6 -- GitLab