Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 831 → Rev 832

/branches/V0.68d Code Redesign killagreg/rc.c
20,7 → 20,9
volatile uint8_t NewPpmData = 1;
volatile int16_t RC_Quality = 0;
 
volatile uint8_t NewRCFrames = 0;
 
 
/***************************************************************/
/* 16bit timer 1 is used to decode the PPM-Signal */
/***************************************************************/
78,14 → 80,11
 
 
// happens every 0.209712 s.
// check for at least one input capture event per timer overflow (timeout)
// check for at least one new frame per timer overflow (timeout)
ISR(TIMER1_OVF_vect)
{
static uint16_t lastICR1 = 0;
// if ICR1 has not changed
// then no new input capture event has occured since last timer overflow
if (lastICR1 == ICR1) RC_Quality /= 2;
lastICR1 = ICR1; // store last ICR1
if (NewRCFrames == 0) RC_Quality /= 2;
NewRCFrames = 0;
}
 
 
130,7 → 129,11
{
// if a sync gap happens and there where at least 4 channels decoded before
// then the NewPpmData flag is reset indicating valid data in the PPM_in[] array.
if(index >= 4) NewPpmData = 0; // Null means NewData for the first 4 channels
if(index >= 4)
{
NewPpmData = 0; // Null means NewData for the first 4 channels
NewRCFrames++;
}
// synchronize channel index
index = 1;
}
/branches/V0.68d Code Redesign killagreg/timer2.c
59,7 → 59,7
/*****************************************************/
/* Control Servo Position */
/*****************************************************/
ISR(TIMER2_COMPA_vect) // every OCR2A * 12.8s (compare match)
ISR(TIMER2_COMPA_vect) // every OCR2A * 12.8 us (compare match)
{
static uint8_t timer = 10;