Hi!
I've read your code ^^ and now it 's working!
In first i have do a mistake, interrupt pin (AtMega32u4) for timer 1 is not in pin 5 but in pin 22 ^^
In Seconde, i see in your code :
Line 99
if (CPPM.sync3 < (610 - 16) || CPPM.sync3 > (643 + 16))
I think it's with pulse for a Spektrum (300us) but for FRSKY D4RII it's 400us !
I modified a little your code and i have add in CPPM.h:
#ifndef FRSKY_D4RII
#define WITH_SYNC_PULSE 800 //400us for 0.5us tick timer (16MHz/2)
#define MAX_GAP_PULSE 5088 // 2544 usĀ
#else
#define WITH_SYNC_PULSE 300 //300us
#define MAX_GAP_PULSE 5088 // 2544us for 0.5us tick timer (16MHz/2)
#endif
I have modified the line 99:
if (CPPM.sync3 < WITH_SYNC_PULSE - 30 || CPPM.sync3 > WITH_SYNC_PULSE + 30)
And the line 113:
if(CPPM.sync2 > MAX_GAP_PULSE) // gap pulse ?
note:
I live in france in Haute Savoie not far from Annemasse, i think you are from geneva ^^