Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2117 → Rev 2164

/branches/dongfang_FC_rewrite/timer2.c
151,6 → 151,8
recalculateServoTimes = 0;
}
 
uint8_t servoMap[] = {2,3,0,1,4,5,6,7};
 
ISR(TIMER2_COMPA_vect) {
static uint16_t remainingPulseTime;
static uint8_t servoIndex = 0;
160,7 → 162,7
// Pulse is over, and the next pulse has already just started. Calculate length of next pulse.
if (servoIndex < staticParams.servoCount) {
// There are more signals to output.
sumOfPulseTimes += (remainingPulseTime = servoValues[servoIndex]);
sumOfPulseTimes += (remainingPulseTime = servoValues[servoMap[servoIndex]]);
servoIndex++;
} else {
// There are no more signals. Reset the counter and make this pulse cover the missing frame time.