| Versions |
 |
|
| Author |
Topic  |
|
StormyKnight
147 Posts |
Posted - 31 janv. 2009 : 06:45:40
|
I written a script that when run will scan the NMEA codes from the GPS, work out the date & time & then set the PNA to that date & Time.
Current Limitations (If you can remove any of these please post your updates) *The script doesn't get the GPS to lock on its own, but if we use a port splitter it will - this is a limitation with mortscript, the ReadFile function closes the port after each read which resets the GPS.
A very good free port splitter that works can be found here... http://www.gpspassion.com/forumsen/topic.asp?TOPIC_ID=60900&whichpage=1
*NMEA communication only, sorry no Sirf - Most GPS's can be switched to NMEA *TimeZone must be a whole hour *FIXED* Thanks to Osprey - Leap Years are not taken into account on the conversion *The current year is assumed to be between 2000 & 2099 - This can be avoided if we read the $GPZDA sentence, but it is not outputed by default on every device
V1.3 http://www.savefile.com/files/1994188 basically the same as V1.2 but Com Port changed to Com3 (rather than Com2) by default. This version works as designed if a port splitter is used as an intermedary. V1.2 http://www.savefile.com/files/1990020 This version will continously try to get a time lock. It doesn't work unless the GPS has already been locked by another program. (Same as V1.0, V1.1) V1.1 http://www.megaupload.com/?d=M0VVDAF4 Thanks Osprey - This version will request the time once & then exit. If the time is not valid it will advise you of that. V1.0 http://www.savefile.com/files/1988754
Please test & provide feedback/suggestions for improvement
Thanks |
Mio Moov 300 AU (Cobia_400_64_AU) Mio Pocket V3.0 R51 SD Install
|
Edited by - StormyKnight on 07 févr. 2009 02:00:13
|
|
|
Ads
|
|
|
Osprey
USA
2764 Posts |
Posted - 01 févr. 2009 : 03:32:01
|
StormyKnight, awesome script! I love it! I wish that I had thought of it, myself, a long time ago. I'd love to include it in MioPocket, if you don't mind.
Also, I hope that you don't mind that I modified it some. I... ...fixed a bug with decreasing the month for negative time zones. It was pretty coincidental and fortunate, actually, since I tested the script a few hours before midnight on Jan 31st while it was just after midnight on Feb 1st UTC. It gave me Feb 1st before; now, it gives me Jan 31st. ...added leap year support. ...added detection for an invalid (pre-2009) date. ...cleaned up the syntax a little so that it's easier to read and looks more like the rest of MioPocket's scripting. ...added a silent mode, so that the script can be called without displaying the status window. ...added automatic time zone detection when using MioPocket. ...added a call, when using MioPocket, to MoovGPSModeToggle.mscr in R39 to switch the GPS mode to NMEA.
Finally, I hope that you don't mind that I've called this version 1.1.
Here are the files: http://www.megaupload.com/?d=M0VVDAF4
It contains GPSTimeSync2.mscr and GPSTimeSync2Auto.mscr. The latter simply launches GPSTimeSync2.mscr silently. Also, if you wish to enable the MioPocket features, you will need to open up the main script and un-comment the MioPocket variables at the top, then run the script from the MioPocket's MioAutoRun\Scripts folder. |
Mio C320 (US), R40 firmware, WinCE 5.0 Core, MioPocket 4.0 Release 68 Latest MioPocket: MioPocket 4.0 (Release 68) - Dec 6, 2010 & ReadMe |
Edited by - Osprey on 01 févr. 2009 04:03:16 |
 |
|
|
StormyKnight
147 Posts |
Posted - 01 févr. 2009 : 05:02:28
|
@Osprey, mate I don't mind at all! My programing skills are a little rusty, although I have programmed in virtualy everything from machine languge thru basic, turbo pascal, C++ javascript etc etc, but only as a hobby!
Cheers & Thanks, I knew it needed a little work to fine tune it.
& yes please add it to MioPocket as you see fit.
Cheers
I had a look at the code & I made an additonal mod to handle leap years on the subtraction of a day as well...
So for case 2...
Replace
DateDayZone = 28 with
If (DateYearZone Mod 4=0)
DateDayZone = 29
Else
DateDayZone = 28
EndIf Also should we set all varibles as local for the script so that we don't effect any global varibles that may be active?
Local() & Lastly for asthetic reasons really the 2nd last line should be replaced from
SetTime(TimeHourZone, TimeMinuteZone, TimeSecondUTC) to
SetTime(TimeHourZone, TimeMinuteZone, TimeSecondZone)
Cheers |
Mio Moov 300 AU (Cobia_400_64_AU) Mio Pocket V3.0 R51 SD Install
|
Edited by - StormyKnight on 01 févr. 2009 05:37:12 |
 |
|
|
StormyKnight
147 Posts |
Posted - 01 févr. 2009 : 07:14:48
|
@Osprey, further testing today suggested a possible issue.... If the GPS has been off for a while & then turned back on, it can't find immediately the satelites it was listening to before & as such the time/date reported is incorrect.
However its not as bad as having to wait for a lock, we just need to test that the year is >2008...Once the signal from the first satelite is being recieved it will have a valid time & date.
So in light of that I have in addition to the changes above I mentioned, I have rewritten the looping function to test for a valid year before proceeding.
Now to keep the user aware of something is happening, on each test a "." will be printed on the screen as a form of progress bar.
Also, I added the cancel function to the script so that it can be cancelled by the user at any time.
Now this may effect the 'auto' version so you may need to make adjustments so that it can still be used but depending on what outcome is wanted.
V1.2 01/02/2009 http://www.savefile.com/files/1990020
Your quit welcome to edit/add as you see fit.... Cheers |
Mio Moov 300 AU (Cobia_400_64_AU) Mio Pocket V3.0 R51 SD Install
|
 |
|
|
StormyKnight
147 Posts |
Posted - 01 févr. 2009 : 11:08:34
|
Further.... It seems that if there has been no GPS lock in the past, the script will never get the date/Time...for some reason the GPS is not getting a lock. If I exit & Run OziCE, we have date & time info within the minute. I will need to investigate further but I can't work out why it doesn't work as intended.... |
Mio Moov 300 AU (Cobia_400_64_AU) Mio Pocket V3.0 R51 SD Install
|
Edited by - StormyKnight on 01 févr. 2009 12:07:34 |
 |
|
|
ste
712 Posts |
Posted - 01 févr. 2009 : 11:31:45
|
It was always the problem with internal GPS-clock being unable to supply correct time after HR - on Mio c520 it gave some date in 2006, even worse than default Apr, 2007. Pity it makes all thing unusable...
I wonder is there a way to make it in other direction - push system date to internal GPS clock. |
Mio C520 R48.3.9937.1026 MioPocket 4.0 SD Release 68 |
 |
|
|
StormyKnight
147 Posts |
Posted - 01 févr. 2009 : 13:16:48
|
| @ste, indeed my script reports the date as 01/04/07 unless another GPS program has been run for a while....the other GPS program doesn't have to get to a lock status though before I can exit & rerun this script which will then report the correct time...I just need to know what is different by running a GPS program over my script! |
Mio Moov 300 AU (Cobia_400_64_AU) Mio Pocket V3.0 R51 SD Install
|
 |
|
|
Osprey
USA
2764 Posts |
Posted - 01 févr. 2009 : 22:44:37
|
StormyKnight, The GPS chip does not communicate with the satellites on its own. It needs software to give it the commands to communicate with them and get a lock. You are not giving it those commands. All that you're doing is fetching the NMEA string that the GPS chip stored the last time that it did have GPS lock. That's why it is necessary to run a real GPS app (like MioMap) to communicate with the satellites. Your app is an "offline" app, so to speak, while something like MioMap is an "online" app.
BTW, I did include invalid date detection in the v1.1 that I uploaded. After fetching the date, if the year was less than 2009 (i.e. if an app like MioMap had not been run since the last hard reset), then the script was to throw up an error and exit. Did you find that that did not work? |
Mio C320 (US), R40 firmware, WinCE 5.0 Core, MioPocket 4.0 Release 68 Latest MioPocket: MioPocket 4.0 (Release 68) - Dec 6, 2010 & ReadMe |
Edited by - Osprey on 01 févr. 2009 23:12:40 |
 |
|
|
StormyKnight
147 Posts |
Posted - 01 févr. 2009 : 23:54:19
|
@Osprey, yep that worked.....
However I'm not convinced re the requirement of my script to talk to the GPS to get a lock....All the scripts I have read, none indicate that they need to do anything more than to read the port & extract the information. In fact you can send a waypoint to the GPS & it will tell you what heading & what distance it is from your current location, no software required on your part...
Anyway I will continue to persist...& hopefully something will come up :)
Cheers |
Mio Moov 300 AU (Cobia_400_64_AU) Mio Pocket V3.0 R51 SD Install
|
Edited by - StormyKnight on 02 févr. 2009 00:00:12 |
 |
|
|
Osprey
USA
2764 Posts |
Posted - 02 févr. 2009 : 03:05:44
|
That's because, I believe, the data string that the GPS chip stores also includes your last known GPS position.
Think about it: if the GPS chip could, on its own, connect to the satellites and maintain a lock, why is it that every single GPS app out there launches without a signal and needs 30+ seconds to acquire one? If it were as you think, they would all have GPS fixes the instant that they launched. You're thinking of the GPS chip as though it's a cable modem--always connected, all by itself--but it's more like the old dial-up modems--initiates a connection only when the software instructs it to. Each time that the connection is closed (i.e. when a GPS app is closed), it has to go through the whole, lengthy re-dialing operation again to re-establish it. |
Mio C320 (US), R40 firmware, WinCE 5.0 Core, MioPocket 4.0 Release 68 Latest MioPocket: MioPocket 4.0 (Release 68) - Dec 6, 2010 & ReadMe |
Edited by - Osprey on 02 févr. 2009 03:07:35 |
 |
|
|
ste
712 Posts |
Posted - 02 févr. 2009 : 08:23:23
|
StormyKnight,
I think I got what you mean: to find scripting command which would make GPS chip lock on sats and this way aquire correct time. I believe there should be such a command, so no MioMap or alike needed. |
Mio C520 R48.3.9937.1026 MioPocket 4.0 SD Release 68 |
 |
|
|
StormyKnight
147 Posts |
Posted - 02 févr. 2009 : 09:35:21
|
@Osprey, yes thats right but only because most internal GPS's are shut down to save power.
I have a USB 'mouse' GPS which has a light on it to indicate if it is locked or not. It will lock simply by pluging it into a USB port to provide power....no software required. In fact I plugged it into one of those car cigarette thingies that provide power to USB devices...that also worked!
I'll investigate further & see how I go...
@STE, Yep I think the command is related to these...
SiRF : $PSRFxxx RESETTING COLD START : $PSRF101,0,0,0,000,0,0,12,6*12
WARM START : $PSRF101,0,0,0,000,0,0,12,2*16
HOT START : $PSRF101,0,0,0,000,0,0,12,1*15
FACTORY RESET : $PSRF101,0,0,0,000,0,0,12,8*1C
Cheers
|
Mio Moov 300 AU (Cobia_400_64_AU) Mio Pocket V3.0 R51 SD Install
|
Edited by - StormyKnight on 03 févr. 2009 01:13:28 |
 |
|
|
Helen
Netherlands
34 Posts |
Posted - 02 févr. 2009 : 15:01:09
|
Hello,
StormyKnight: what a good idea!
Since I am also interested in this subject I have been searching the internet so now and then. Yesterday finally found something that was looking interesting on SourceForge, named Whiskers - see also http://forum.xda-developers.com/showthread.php?t=475005 I asked the developer for some docu and he mailed me that http://www.yesmobile.net/en/index.asp might be the solution (30 days trial ) See also the faq tab. I didn't get it working on my Falk yet. Hopefully this info is helpful......
Best regards, Helen
|
Device: Falk F8 --- Windows CE 5.0 --- Processor: Samsung ARM920 --- MP Release 38 |
Edited by - Helen on 02 févr. 2009 15:10:41 |
 |
|
|
Helen
Netherlands
34 Posts |
|
|
StormyKnight
147 Posts |
Posted - 03 févr. 2009 : 01:18:39
|
@Helen, Thanks I will have a look at these....I hoping to find something with the source code as well so i can have a look....but the only program I found with code also doesn't work! It runs but no NMEA data is shown!
http://www.geocities.com/cmathiaz/
Also I found this site to calculate the checksums for the NMEA sentences that you may want to send to the GPS... http://www.hhhh.org/wiml/proj/nmeaxor.html
I'm going to try & get a port splitter program running so I can intercept the codes sent to the gps & log them...perhaps that will shed some light!
I will set it up to that the GPS will be on the input (Com2) & say OziCE will point to Com 3. The splitter will redirect the commands for me but hopefully also be able to log the traffic.
Cheers
|
Mio Moov 300 AU (Cobia_400_64_AU) Mio Pocket V3.0 R51 SD Install
|
Edited by - StormyKnight on 03 févr. 2009 01:29:39 |
 |
|
|
Helen
Netherlands
34 Posts |
|
Topic  |
|
|
|
| This page was generated in 0,78 seconds. |
 |
|