From 3431064d0991c9586c5625ed07a4ad361546a22a Mon Sep 17 00:00:00 2001 From: John Arne Birkeland Date: Mon, 4 Jun 2012 22:55:15 +0200 Subject: [PATCH] ArduPPM V2.2.68 - Fixed possible logic flaw in throttle failsafe reset if _JITTER_FILTER_ is enabled --- Tools/ArduPPM/Libraries/PPM_Encoder.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Tools/ArduPPM/Libraries/PPM_Encoder.h b/Tools/ArduPPM/Libraries/PPM_Encoder.h index 2a8f82cc7e..8b82e89ae9 100644 --- a/Tools/ArduPPM/Libraries/PPM_Encoder.h +++ b/Tools/ArduPPM/Libraries/PPM_Encoder.h @@ -1,5 +1,5 @@ // ------------------------------------------------------------- -// PPM ENCODER V2.2.67 (03-06-2012) +// PPM ENCODER V2.2.68 (04-06-2012) // ------------------------------------------------------------- // Improved servo to ppm for ArduPilot MEGA v1.x (ATmega328p), // PhoneDrone and APM2 (ATmega32u2) @@ -57,6 +57,9 @@ // 03-06-2012 // V2.2.67 - Implemented detection and failsafe (throttle = 900us) for missing throttle signal. +// 04-06-2012 +// V2.2.68 - Fixed possible logic flaw in throttle failsafe reset if _JITTER_FILTER_ is enabled + // ------------------------------------------------------------- #ifndef _PPM_ENCODER_H_ @@ -537,6 +540,9 @@ CHECK_PINS_LOOP: // Input servo pin check loop // Calculate servo channel position in ppm[..] uint8_t _ppm_channel = ( servo_channel << 1 ) + 1; + //Reset throttle failsafe timeout + if( _ppm_channel == 5 ) throttle_timeout = 0; + #ifdef _AVERAGE_FILTER_ // Average filter to smooth input jitter servo_width += ppm[ _ppm_channel ]; @@ -552,9 +558,6 @@ CHECK_PINS_LOOP: // Input servo pin check loop // Update ppm[..] ppm[ _ppm_channel ] = servo_width; - - //Reset throttle failsafe timeout - if( _ppm_channel == 5 ) throttle_timeout = 0; } }