NANO timer does not trigger interrupt as designed

Hello,guys,who has the experience on using timer (NANO,timer 1 & 2).

As attached file(I delete some code not related to this question) showed, I use timer2 to create PWM( Pin 3 eg.), and use timer1 to control interval.
In my case,
the HZ for PWM is 40K,
the “0” means output PWM for 600us and silent for 600us
the “1” means output PWM for 1200us and silent for 600us

at the beging , I use delay() & delayMicroseconds() to control the interval,and it works both on sender & receiver, but someday it get crazy,what received is not correct( but looks like sender works fine).
I wonder that the delay() function maybe is the reason.
So I changed to timer interrupt to control interval.

Now, the question is the actual interval is far bigger, and the first wave is unbelievable long.
Any comments?
Thanks !

gun.cpp (277 Bytes)

gun.h (180 Bytes)

IRsender.cpp (2.22 KB)

IRsender.h (915 Bytes)

myIRsender.ino (189 Bytes)

change a little , checked the output.

the interval is too big.

gun.cpp (305 Bytes)

gun.h (221 Bytes)

IRsender.cpp (2.41 KB)

IRsender.h (948 Bytes)

myIRsender.ino (232 Bytes)