84,7 → 84,7 |
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 = 0; |
if (lastICR1 == ICR1) RC_Quality /= 2; |
lastICR1 = ICR1; // store last ICR1 |
} |
|
125,12 → 125,6 |
signal = (uint16_t) ICR1 - oldICR1; |
oldICR1 = ICR1; |
|
// lost frame? |
if(signal > 8000) |
{ |
RC_Quality /= 2; |
} |
else |
//sync gap? (3.52 ms < signal < 25.6 ms) |
if((signal > 1100) && (signal < 8000)) |
{ |
164,10 → 158,6 |
else PPM_diff[index] = 0; |
PPM_in[index] = tmp; // update channel value |
} |
else |
{ // invalid PPM time |
RC_Quality /= 2; |
} |
index++; // next channel |
// demux sum signal for channels 5 to 7 to J3, J4, J5 |
if(index == 5) PORTD |= (1<<PORTD5); else PORTD &= ~(1<<PORTD5); |