diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-05-05 23:14:34 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-05-05 23:14:34 +0100 |
| commit | b7e28404a9962cf220c51e1b83b81b6a2b6a3d87 (patch) | |
| tree | 1927bb4892d4132f779e525ca0f59e922d406d04 /wim.py | |
| parent | 93c4c39a7f0493c786e4bd3f58ab795e8bbb97f2 (diff) | |
fix test gps status
Diffstat (limited to 'wim.py')
| -rwxr-xr-x | wim.py | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -70,7 +70,7 @@ GUI_IP="0.0.0.0" GUI_PORT=5400 insock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) insock.bind( (GUI_IP,GUI_PORT) ) -insock.settimeout(0.01) #non blocking +insock.settimeout(0.05) #non blocking, this sets the frame rate of checking PD_IP="127.0.0.1" PD_PORT=5401 outsock = socket.socket( socket.AF_INET,socket.SOCK_DGRAM ) @@ -78,17 +78,27 @@ outsock = socket.socket( socket.AF_INET,socket.SOCK_DGRAM ) pos=latLng() posChanged=False +gpsfix=False + while True: data="" try: data, addr = insock.recvfrom(128) pos.parse(data) - if (debug): + if debug: print "received:",data posChanged=True except: nothing=None - if gpsp!="": + if gpsp!="": #gps available + if not gpsfix: + if gpsp.fix>1: + gpsfix=True + outsock.sendto( "gpsstatus 1\n", (PD_IP, PD_PORT) ) + if gpsfix: + if gpsp.fix<2: + gpsfix=False + outsock.sendto( "gpsstatus 0\n", (PD_IP, PD_PORT) ) check=gpsp.check() if check!=False: if debug: |
