Saturday, December 12, 2009

Cheap Chinese GPS Freezing

I bought a cheap chinese GPS thinking I'd get some exposure to Windows CE 5. TomTom runs great but it freezes after a couple of minutes if not touched. Touch it, and it comes back to life. Not a safe thing to be doing while driving!

The timing seemed too predictable for it to be a hardware failure. So I investigated further and found forums talking about modifying the registry and eliminating idle power saving values. So I tried doing just that, using a copy of RegEdit.exe for WinCE. No luck. Then reading through more forums I learn the power settings control panel needs to be launched and the OK button pressed to make the settings take affect. And this needs to be done on every boot.

All the registry hacking can be scripted with MortScript (PNA version inside the zip). And MortScript can even run the control panel and push the OK button. Except the control panel title is in Chinese so how do I focus on this window? More forum searching I find it's possible to sleep for a second and then just focus on the active window. So tying this all together I just configure the Autorun.exe of MortScript to be my 'GPS Software', this runs Autorun.mscr (see below) in the same directory, which fixes power settings and launches the actual GPS software.

I wanted to get some WinCE exposure but I didn't realise I'd be hacking registries and learning a new scripting language on day one!

RegWriteString("HKLM", "\System\Explorer\Shell Folders", "My Documents", "\StorageCard")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\Timeouts", "BattUserIdle", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\ActivityTimers\UserActivity", "Timeout", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\Timeouts", "ACUserIdle", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\Timeouts", "BattSystemIdle", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\ActivityTimers\SystemActivity", "Timeout", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power\Timeouts", "ACSystemIdle", "0")
RegWriteDWord("HKLM", "\System\CurrentControlSet\Control\Power", "DisableGwesPowerOff", "0")
Run( "ctlpnl.exe", "cplmain.cpl,5,1" )
#WaitFor( "Power Properties", 5 )
#SendOK( "Power Properties" )
Sleep(1000)
WindowName = ActiveWindow()
WaitFor(WindowName, 3)
SendOK(WindowName)
RunWait ("\StorageCard\TomTom\TomTomNavigator.exe")

5 comments:

澳客 said...

hi
I got same GPS today & try to install Tomtom 7, but not working, it keep showing "no map found" ( I use australia 840 map). (But it work on my mio168 PDA )

what tomtom version you use? where did you find it?
how do you make it work on this GPS ?
Thank you
Regards
Jason

澳客 said...

hi
problem fix ! change to the tomtom for pna & vevrything is fine now, Thanks
Jason

Carl said...

Matt.. Can you pont me in the right direction..
i downloaded the mort-script from your link ..
Copied the contents of mortscript-4.2\bin\PNA to my sd card..(In foder called PNA)
I then copied the script you wrote to a text file and renamed it autorun.mscr..
I then pointed working directory to storagecard\PNA\autorun exe..
A Chinese menu pops up and disappears.
I made sure tomtom is at -StorageCard\TomTom\TomTomNavigator.exe

.What have i missed..

CJ123

澳客 said...

hi Carl
copied all the mortscript contents to storagecard don't put in any foder.

Regards
Jason

Carl said...

Worked thanks for that :)