Closed Dukat-Gul closed 2 years ago
GPShandler now caches all GPS sentences so you can get SKY and TPV data and use it how you wish rather than adding more instance variables to GPShandler. e.g.
# create a Dragino object and join to TTN
D = Dragino("dragino.toml", logging_level=logLevel)
D.join()
def checkGPS():
global gps,D
tpv=D.get_msg_class("TPV")
if tpv is not None:
gps["lat"]=round(tpv['lat'],5)
gps["lon"]=round(tpv['lon'],6)
print("got gps TPV sentence")
else:
print("waiting for TPV")
return False
sky=D.get_msg_class("SKY")
if sky is not None:
gps["hdop"]=round(sky["hdop"],2)
gps["sats"]=len(sky['satellites'])
print("got gps SKY sentence")
else:
print("waiting for SKY")
return False
return True # TPV and SKY ok
Included are a reference python CayenneLLP and TTNMapper compliant GPS tracker/transmitter.
CayenneLLP just sends Latitude, Longitude and Altitude - which is acceptable to TTNMapper however they ideally like to have a HDOP (Horizontal Dilution of Precision) reference for positional accuracy. To achieve this the GPShandler.py has been modified to include SKY objects as well as the TPV (Time Position Velocity) Object.