Deal more gracefully with the case where the incoming PPM stream has more than 8 channels encoded.

This makes it possible to move one resistor on the APM board and feed it PPM directly from a receiver emitting a PPM stream.



git-svn-id: https://arducopter.googlecode.com/svn/trunk@1498 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
DrZiplok 2011-01-15 19:32:04 +00:00
parent dc9c29e8f3
commit 5113a12144

View File

@ -50,11 +50,12 @@ ISR(TIMER4_CAPT_vect)
PPM_Counter=0;
else
{
PPM_Counter &= 0x07; // For safety only (limit PPM_Counter to 7)
if (PPM_Counter < (sizeof(PWM_RAW) / sizeof(PWM_RAW[0]))) {
PWM_RAW[PPM_Counter++]=Pulse_Width; //Saving pulse.
if (PPM_Counter >= NUM_CHANNELS)
radio_status = 1;
}
}
ICR4_old = Pulse;
}