Thread
:
Python script for GPS location help appreciated
View Single Post
Hukka
2010-05-15 , 11:02
Posts: 13 | Thanked: 9 times | Joined on Dec 2009 @ Espoo, Finland
#
5
Well, the problem with hard timed reads is that the gps might not give you the data. What I mean is that you want to wait for 30 seconds for an update, but the gps gives you one after 25 seconds and 90 seconds (it happens if the device isn't moving at all).
So instead you might need to just save all the updates to a variable and then have a separate thread counting the timeouts and stopping the data loop, because after running loop.run() you are fully in asynchronous mode (that is, you couldn't say loop.run() then wait(30) and then data.stop()).
But if the possibly longer timeouts don't matter to you (or you are constantly on the move) you could just save the current time when your program starts and then in "if device.fix" do "if datetime.datetime.now() > savedtime + datetime.timedelta(seconds=30)".
Quote & Reply
|
The Following User Says Thank You to Hukka For This Useful Post:
jedi
Hukka
View Public Profile
Send a private message to Hukka
Find all posts by Hukka