NMEA0183 weiter programmiert
This commit is contained in:
parent
7f0a0f280b
commit
ae38d2b681
37
nmea0183.py
37
nmea0183.py
|
@ -35,9 +35,41 @@ def GLL(boatdata, msg):
|
|||
boatdata.setValue("LAT", msg.latitude)
|
||||
boatdata.setValue("LON", msg.longitude)
|
||||
|
||||
def GSA(boatdata, msg):
|
||||
print("-> GSA")
|
||||
print(msg.fields)
|
||||
print(msg.data)
|
||||
|
||||
def GSV(boatdata, msg):
|
||||
# Satellites in view
|
||||
print("-> GSV")
|
||||
# mgs_num msg.num_messages # Nachricht n von m
|
||||
# msg.num_sv_in_view # Anzahl sichtbarer Satelliten
|
||||
rres = None # range residuals
|
||||
status = 2 # lookup -> prnusage; 1=tracked 2=used
|
||||
if msg.sv_prn_num_1:
|
||||
print(msg.sv_prn_num_1, msg.elevation_deg_1, msg.azimuth_1, msg.snr_1)
|
||||
if msg.snr_1 == '':
|
||||
status = 1
|
||||
msg.snr_1 = 0
|
||||
boatdata.updateSatellite(int(msg.sv_prn_num_1), float(msg.elevation_deg_1), float(msg.azimuth_1), int(msg.snr_1), rres, status)
|
||||
if msg.sv_prn_num_2:
|
||||
print(msg.sv_prn_num_2, msg.elevation_deg_2, msg.azimuth_2, msg.snr_2)
|
||||
if msg.snr_2 == '':
|
||||
status = 1
|
||||
msg.snr_2 = 0
|
||||
boatdata.updateSatellite(int(msg.sv_prn_num_2), float(msg.elevation_deg_2), float(msg.azimuth_2), int(msg.snr_2), rres, status)
|
||||
if msg.sv_prn_num_3:
|
||||
print(msg.sv_prn_num_3, msg.elevation_deg_3, msg.azimuth_3, msg.snr_3)
|
||||
if msg.snr_3 == '':
|
||||
status = 1
|
||||
msg.snr_3 = 0
|
||||
boatdata.updateSatellite(int(msg.sv_prn_num_3), float(msg.elevation_deg_3), float(msg.azimuth_3), int(msg.snr_3), rres, status)
|
||||
if msg.sv_prn_num_4:
|
||||
if msg.snr_4 == '':
|
||||
status = 1
|
||||
msg.snr_4 = 0
|
||||
print(msg.sv_prn_num_4, msg.elevation_deg_4, msg.azimuth_4, msg.snr_4)
|
||||
boatdata.updateSatellite(int(msg.sv_prn_num_4), float(msg.elevation_deg_4), float(msg.azimuth_4), int(msg.snr_4), rres, status)
|
||||
|
||||
def HDG(boatdata, msg):
|
||||
# UNUSED: Heading - Deviation & Variation
|
||||
|
@ -133,7 +165,9 @@ def VPW(boatdata, msg):
|
|||
pass
|
||||
|
||||
def VTG(boatdata, msg):
|
||||
# Track made good and speed over ground
|
||||
print("-> VTG")
|
||||
print(msg.fields)
|
||||
boatdata.setValue("COG", int(msg.true_track))
|
||||
#TODO klären was für Typen hier ankommen können
|
||||
# bytearray, str, decimal.Decimal?
|
||||
|
@ -196,6 +230,7 @@ decoder = {
|
|||
"DBT": DBT,
|
||||
"GGA": GGA,
|
||||
"GLL": GLL,
|
||||
"GSA": GSA,
|
||||
"GSV": GSV,
|
||||
"HDG": HDG,
|
||||
"HDM": HDM,
|
||||
|
|
|
@ -252,6 +252,10 @@ def rxd_gps(devname, devspeed):
|
|||
if msg.sentence_type == 'GLL':
|
||||
boatdata.setValue("LAT", msg.latitude)
|
||||
boatdata.setValue("LON", msg.longitude)
|
||||
if msg.sentence_type == 'GSV':
|
||||
# Satellites in view
|
||||
# TODO
|
||||
pass
|
||||
else:
|
||||
print(msg)
|
||||
print(msg.fields)
|
||||
|
@ -731,8 +735,10 @@ if __name__ == "__main__":
|
|||
t_rxd_0183.join()
|
||||
if cfg['gps']:
|
||||
t_rxd_gps.join()
|
||||
if cfg['net']:
|
||||
if cfg['network']:
|
||||
t_rxd_net.join()
|
||||
if not cfg['simulation'] and cfg['bme280']:
|
||||
t_data.join()
|
||||
print("Another fine product of the Sirius Cybernetics Corporation.")
|
||||
|
||||
print(boatdata)
|
||||
|
|
Loading…
Reference in New Issue