Sub Calculate
Sum = Sum + SomeValue
Draw 'Call this routine when Calculate is done
End Sub
Sub Draw
Plot(X,45) 'I know is fake but...you get my point
Update 'Call this routine when Draw is done
End Sub
Sub Update
Open something, update, process
Calculate 'Restart the process
End Sub
Before the processor enters another sub it will store all local variables to the stack, so that it can reload them when it exits the sub. This looks like infinite recursion. I dont think it is suitable for your problem.I am sure that the method quoted will always result in recursion.
I therefore return to my original question, how to 'synchronise' a timer in the above example so that it runs out at the correct time and also allows screen touches to be immediately detected. If that is a stupid question please point me to an explanation of how such a system should work.
Many thanks.
This depends on what you are trying to do, and how.I could not see how to measure the time taken (max) for my subs.
Sub Process_Globals
Dim timer1 As Timer
timer1.Interval(10)
End Sub
Sub Globals
Dim processFinished As Boolean
End Sub
Sub Activity_Create(FirstTime As Boolean)
processFinished=True ' set true first time so it will run
timer1.enabled=True
End Sub
Sub timer1_tick
If processFinished=True
processFinished=False
runMyCode
End If
End Sub
Sub runMyCode
your calculation
...
processFinished=True
End Sub
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?