Need help. Can't see
It must be something stupid...
I've been playing around. This is the little part that is giving me problems.
This is running inside a timer _tick sub that checks for GPS, saves coordinates to a DB, compare distances, etc.
distok is a variable that carries zero when there is no movement.
nomove is a controler. It stops the chrono when it reaches 7
Now..The first time when there is no movement, the chrono stops...When movment starts, the chrono resumes continuing properly. NO PROBLEM IN THE FIRST TIME.
The second time when there is no movement, the chrono stops, but when it resumes...it jumps to the future...(adding the time while there was no movement)
I've tryed several diferent ways of coding...and always get the same result and I'm starting to get lost. So I must be doing someting really stupid.
' please note that this part is inside a _thick sub that runs every 10 secs.
If distok=0.0 Then ' no move
nomove=nomove+1
End If
If nomove=7 Then
flag_movimento=False
LastTime=Chrono.GetElapsedRealTime
Timex=LastTime-ChronoBase
Chrono.Stop
End If
If distok<>0 Then ' movement exists
If flag_movimento=False Then
Time2=Chrono.GetElapsedRealTime - Timex
Chrono.BaseTime=Time2
End If
Chrono.Start
nomove=0
flag_movimento=True
End If
Any help will be welcomed.
:BangHead: