diff options
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: |
