Fixed bugs
check_last_update now uses time instead of nmea. The time update now updates at first run. Map is now initiated correctly
This commit is contained in:
parent
88754840f2
commit
1fda91253b
|
@ -3,13 +3,13 @@ import pynmea2
|
|||
import serial
|
||||
import io
|
||||
|
||||
ser = serial.Serial('/dev/ttyS1', 9600, timeout=5.0)
|
||||
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=5.0)
|
||||
sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser))
|
||||
last_time=00
|
||||
|
||||
|
||||
def check_last_update(time,last_time):
|
||||
if nmea==last_nmea:
|
||||
if time==last_time:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
@ -27,10 +27,12 @@ while 1:
|
|||
else:
|
||||
if check_last_update(time=msg.timestamp,last_time=last_time)==True:
|
||||
if last_time==00:
|
||||
m = Map(center=msg.latitude, msg.longitude, zoom=15)
|
||||
center = (msg.latitude, msg.longitude,)
|
||||
m = Map(center=center, zoom=15)
|
||||
marker = Marker(location=center, draggable=False)
|
||||
m.add_layer(marker);
|
||||
display(m)
|
||||
last_time=msg.timestamp
|
||||
else:
|
||||
marker.location=(msg.latitude, msg.longitude)
|
||||
last_time=msg.timestamp
|
||||
|
|
Loading…
Reference in a new issue