2global
bool runEverySample =
true;
3global int32 loopCounterDelta = 0;
4global int32 currentSampleCounter;
8 int32 lastSampleCounter = ControllerSampleCounterGet();
12 currentSampleCounter = ControllerSampleCounterGet();
13 loopCounterDelta = currentSampleCounter - lastSampleCounter;
15 YourFastCyclicCodeGoesHere();
17 RMPSampleWait(1, currentSampleCounter);
19 lastSampleCounter = currentSampleCounter;
25global
bool runEvery50Samples =
true;
26global int32 loopCounterDelta50;
27global int32 currentSampleCounter50;
29void RunEvery50Samples()
31 int32 lastSampleCounter = ControllerSampleCounterGet();
33 while(runEvery50Samples)
35 currentSampleCounter50 = ControllerSampleCounterGet();
36 loopCounterDelta50 = currentSampleCounter50 - lastSampleCounter;
38 YourSlowCyclicCodeGoesHere();
40 RMPSampleWait(50, currentSampleCounter50);
42 lastSampleCounter = currentSampleCounter50;
48void RMPSampleWait(int32 samplesToWait, int32 startingSampleCounter)
50 while(ControllerSampleCounterGet() < (startingSampleCounter + samplesToWait))
56void YourFastCyclicCodeGoesHere()
61void YourSlowCyclicCodeGoesHere()
63 ControllerSampleWait(25);