What I want to do is to schedule the packet relay only to work at fixed intervals, but iterate x number of times each interval (if a valid packet is received during the x interations, it should be processed immediatly) to compensate for timing drifts.
My understanding of the following is that if either nothing is received or the CRC is not equal to zero it returns back to the beginning if in the loop, but returns after one try if used as a scheduled task:
if (!rf12_receiveDone()|| rf12_crc !=0) return;
How do I change this to re-try x times, unless a valid packet is received during the x times so it will work as a scheduled task?
I've been looking at this for ages and can't work it out.
At the moment I have the scheduler iterating x times over the static void statment that contains the relay script, but this iterates the full x times regardless of whether a valid packet is received during the x times or not. This mostly works, but is (I think) causing me other issues.
Any ideas greatfully received.