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("LAT", msg.latitude)
|
||||||
boatdata.setValue("LON", msg.longitude)
|
boatdata.setValue("LON", msg.longitude)
|
||||||
|
|
||||||
|
def GSA(boatdata, msg):
|
||||||
|
print("-> GSA")
|
||||||
|
print(msg.fields)
|
||||||
|
print(msg.data)
|
||||||
|
|
||||||
def GSV(boatdata, msg):
|
def GSV(boatdata, msg):
|
||||||
# Satellites in view
|
# 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):
|
def HDG(boatdata, msg):
|
||||||
# UNUSED: Heading - Deviation & Variation
|
# UNUSED: Heading - Deviation & Variation
|
||||||
|
@ -133,7 +165,9 @@ def VPW(boatdata, msg):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def VTG(boatdata, msg):
|
def VTG(boatdata, msg):
|
||||||
|
# Track made good and speed over ground
|
||||||
print("-> VTG")
|
print("-> VTG")
|
||||||
|
print(msg.fields)
|
||||||
boatdata.setValue("COG", int(msg.true_track))
|
boatdata.setValue("COG", int(msg.true_track))
|
||||||
#TODO klären was für Typen hier ankommen können
|
#TODO klären was für Typen hier ankommen können
|
||||||
# bytearray, str, decimal.Decimal?
|
# bytearray, str, decimal.Decimal?
|
||||||
|
@ -196,6 +230,7 @@ decoder = {
|
||||||
"DBT": DBT,
|
"DBT": DBT,
|
||||||
"GGA": GGA,
|
"GGA": GGA,
|
||||||
"GLL": GLL,
|
"GLL": GLL,
|
||||||
|
"GSA": GSA,
|
||||||
"GSV": GSV,
|
"GSV": GSV,
|
||||||
"HDG": HDG,
|
"HDG": HDG,
|
||||||
"HDM": HDM,
|
"HDM": HDM,
|
||||||
|
|
|
@ -252,6 +252,10 @@ def rxd_gps(devname, devspeed):
|
||||||
if msg.sentence_type == 'GLL':
|
if msg.sentence_type == 'GLL':
|
||||||
boatdata.setValue("LAT", msg.latitude)
|
boatdata.setValue("LAT", msg.latitude)
|
||||||
boatdata.setValue("LON", msg.longitude)
|
boatdata.setValue("LON", msg.longitude)
|
||||||
|
if msg.sentence_type == 'GSV':
|
||||||
|
# Satellites in view
|
||||||
|
# TODO
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
print(msg)
|
print(msg)
|
||||||
print(msg.fields)
|
print(msg.fields)
|
||||||
|
@ -731,8 +735,10 @@ if __name__ == "__main__":
|
||||||
t_rxd_0183.join()
|
t_rxd_0183.join()
|
||||||
if cfg['gps']:
|
if cfg['gps']:
|
||||||
t_rxd_gps.join()
|
t_rxd_gps.join()
|
||||||
if cfg['net']:
|
if cfg['network']:
|
||||||
t_rxd_net.join()
|
t_rxd_net.join()
|
||||||
if not cfg['simulation'] and cfg['bme280']:
|
if not cfg['simulation'] and cfg['bme280']:
|
||||||
t_data.join()
|
t_data.join()
|
||||||
print("Another fine product of the Sirius Cybernetics Corporation.")
|
print("Another fine product of the Sirius Cybernetics Corporation.")
|
||||||
|
|
||||||
|
print(boatdata)
|
||||||
|
|
Loading…
Reference in New Issue