Some buf fixes and small enhancements
This commit is contained in:
parent
be20826ab5
commit
7d8ce221fd
87
nmea0183.py
87
nmea0183.py
|
@ -2,7 +2,8 @@
|
||||||
NMEA0183 verarbeiten
|
NMEA0183 verarbeiten
|
||||||
|
|
||||||
TODO Multi-Sentence verarbeiten
|
TODO Multi-Sentence verarbeiten
|
||||||
TXT
|
TXT Textmeldungen (Alarm)
|
||||||
|
RTE Routendaten
|
||||||
AIS-Sentences mit Binärdaten
|
AIS-Sentences mit Binärdaten
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -160,7 +161,33 @@ def RMB(boatdata, msg):
|
||||||
# Recommended Minimum Navigation Information
|
# Recommended Minimum Navigation Information
|
||||||
# Informationen bzgl. Erreichen des nächsten Wegepunkts
|
# Informationen bzgl. Erreichen des nächsten Wegepunkts
|
||||||
#
|
#
|
||||||
|
# (('Status', 'status'),
|
||||||
|
# ('Cross Track Error', 'cross_track_error'),
|
||||||
|
#('Cross Track Error, direction to corrent', 'cte_correction_dir'),
|
||||||
|
#('Origin Waypoint ID', 'origin_waypoint_id'),
|
||||||
|
# ('Destination Waypoint ID', 'dest_waypoint_id'),
|
||||||
|
#('Destination Waypoint Latitude', 'dest_lat'),
|
||||||
|
#('Destination Waypoint Lat Direction', 'dest_lat_dir'),
|
||||||
|
# ('Destination Waypoint Longitude', 'dest_lon'),
|
||||||
|
#('Destination Waypoint Lon Direction', 'dest_lon_dir'),
|
||||||
|
#('Range to Destination', 'dest_range'),
|
||||||
|
#('True Bearing to Destination', 'dest_true_bearing'),
|
||||||
|
#('Velocity Towards Destination', 'dest_velocity'),
|
||||||
|
#('Arrival Alarm', 'arrival_alarm'))
|
||||||
print("-> RMB")
|
print("-> RMB")
|
||||||
|
if not msg.status == 'A':
|
||||||
|
return
|
||||||
|
lat_fac = 1 if msg.dest_lat_dir == 'N' else -1
|
||||||
|
lat_deg = int(msg.dest_lat[0:2])
|
||||||
|
lat_min = float(msg.dest_lat[2:])
|
||||||
|
lon_fac = 1 if msg.dest_lon_dir == 'E' else -1
|
||||||
|
lon_deg = int(msg.dest_lon[0:3])
|
||||||
|
lon_min = float(msg.dest_lon[3:])
|
||||||
|
boatdata.setValue("WPLat", lat_fac * lat_deg + lat_min / 60)
|
||||||
|
boatdata.setValue("WPLon", lon_fac * lon_deg + lon_min / 60)
|
||||||
|
boatdata.setValue("WPname", msg.dest_waypoint_id)
|
||||||
|
boatdata.setValue("DTW", float(msg.dest_range))
|
||||||
|
boatdata.setValue("BTW", float(msg.dest_true_bearing))
|
||||||
|
|
||||||
def RMC(boatdata, msg):
|
def RMC(boatdata, msg):
|
||||||
# Recommended Minimum Navigation Information
|
# Recommended Minimum Navigation Information
|
||||||
|
@ -200,10 +227,28 @@ def RSA(boatdata, msg):
|
||||||
if msg.rsa_port_status == 'A':
|
if msg.rsa_port_status == 'A':
|
||||||
boatdata.setValue("PRPOS", msg.rsa_port)
|
boatdata.setValue("PRPOS", msg.rsa_port)
|
||||||
|
|
||||||
|
rte_curr = 0
|
||||||
|
rte_max = 0
|
||||||
|
rte_wpl = []
|
||||||
|
|
||||||
def RTE(boatdata, msg):
|
def RTE(boatdata, msg):
|
||||||
# Route
|
# Route: List of Waypoints
|
||||||
|
# num_in_seq, sen_num, start_type, active_route_id
|
||||||
|
global rte_curr, rte_max
|
||||||
|
nmax = int(msg.sen_num)
|
||||||
|
n = int(msg.num_in_seq)
|
||||||
|
if nmax > 1:
|
||||||
|
if rte_curr == 0 and n == 1:
|
||||||
|
# neue Nachricht
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
# Fortsetzung
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
pass
|
||||||
print("-> RTE")
|
print("-> RTE")
|
||||||
print(msg.fields)
|
print(msg.fields)
|
||||||
|
print(msg.waypoint_list)
|
||||||
|
|
||||||
txt_msg = ''
|
txt_msg = ''
|
||||||
txt_type = None
|
txt_type = None
|
||||||
|
@ -262,13 +307,14 @@ def VTG(boatdata, msg):
|
||||||
(('True Track made good', 'true_track', <class 'float'>),
|
(('True Track made good', 'true_track', <class 'float'>),
|
||||||
('True Track made good symbol', 'true_track_sym'),
|
('True Track made good symbol', 'true_track_sym'),
|
||||||
('Magnetic Track made good', 'mag_track', <class 'decimal.Decimal'>),
|
('Magnetic Track made good', 'mag_track', <class 'decimal.Decimal'>),
|
||||||
('Magnetic Track symbol', 'mag_track_sym'),
|
('Magnetic Track symbol', 'mag_track_sym'),
|
||||||
('Speed over ground knots', 'spd_over_grnd_kts', <class 'decimal.Decimal'>),
|
('Speed over ground knots', 'spd_over_grnd_kts', <class 'decimal.Decimal'>),
|
||||||
('Speed over ground symbol', 'spd_over_grnd_kts_sym'),
|
('Speed over ground symbol', 'spd_over_grnd_kts_sym'),
|
||||||
('Speed over ground kmph', 'spd_over_grnd_kmph', <class 'float'>),
|
('Speed over ground kmph', 'spd_over_grnd_kmph', <class 'float'>),
|
||||||
('Speed over ground kmph symbol', 'spd_over_grnd_kmph_sym'),
|
('Speed over ground kmph symbol', 'spd_over_grnd_kmph_sym'),
|
||||||
('FAA mode indicator', 'faa_mode'))
|
('FAA mode indicator', 'faa_mode'))
|
||||||
['', 'T', '', 'M', '0.117', 'N', '0.216', 'K', 'A'] """
|
['', 'T', '', 'M', '0.117', 'N', '0.216', 'K', 'A']
|
||||||
|
"""
|
||||||
print("-> VTG")
|
print("-> VTG")
|
||||||
# msg.true_track true_track_sym
|
# msg.true_track true_track_sym
|
||||||
# msg.mag_track mag_track_sym
|
# msg.mag_track mag_track_sym
|
||||||
|
@ -290,9 +336,32 @@ def VWR(boatdata, msg):
|
||||||
boatdata.setValue("AWS", msg.wind_speed_ms)
|
boatdata.setValue("AWS", msg.wind_speed_ms)
|
||||||
|
|
||||||
def WPL(boatdata, msg):
|
def WPL(boatdata, msg):
|
||||||
|
# Waypoint
|
||||||
|
# lat, lat_dir
|
||||||
|
# lon, lon_dir
|
||||||
|
# waypoint_id (name)
|
||||||
print("-> WPL")
|
print("-> WPL")
|
||||||
print(msg.fields)
|
print(msg.fields)
|
||||||
|
|
||||||
|
lat_fac = 1 if msg.lat_dir == 'N' else -1
|
||||||
|
lat_deg = int(msg.lat[0:2])
|
||||||
|
lat_min = float(msg.lat[2:])
|
||||||
|
#boatdata.setValue("LAT", lat_fac * lat_deg + lat_min / 60)
|
||||||
|
lon_fac = 1 if msg.lon_dir == 'E' else -1
|
||||||
|
lon_deg = int(msg.lon[0:3])
|
||||||
|
lon_min = float(msg.lon[3:])
|
||||||
|
#boatdata.setValue("LON", lon_fac * lon_deg + lon_min / 60)
|
||||||
|
|
||||||
|
# Prüfe, ob der Wegepunkt schon existiert
|
||||||
|
if msg.waypoint_id in boatdata.wps:
|
||||||
|
# Wegepunkt aktualisieren
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
# neuen Wegepunkt anlegen
|
||||||
|
# boatdata.wps[waypoint_id]
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def VWT(boatdata, msg):
|
def VWT(boatdata, msg):
|
||||||
# True Wind Speed and Angle
|
# True Wind Speed and Angle
|
||||||
if msg.direction == "R":
|
if msg.direction == "R":
|
||||||
|
|
|
@ -27,5 +27,6 @@ class OneValue(Page):
|
||||||
if self.ref1.value:
|
if self.ref1.value:
|
||||||
ctx.show_text(self.ref1.format())
|
ctx.show_text(self.ref1.format())
|
||||||
else:
|
else:
|
||||||
ctx.show_text(self.placeholder)
|
#print(dir(self.bd))
|
||||||
|
ctx.show_text("---") # self.bd.getPlaceholder())
|
||||||
ctx.stroke()
|
ctx.stroke()
|
||||||
|
|
|
@ -17,12 +17,12 @@ class SkyView(Page):
|
||||||
def __init__(self, pageno, cfg, boatdata):
|
def __init__(self, pageno, cfg, boatdata):
|
||||||
super().__init__(pageno, cfg, boatdata)
|
super().__init__(pageno, cfg, boatdata)
|
||||||
|
|
||||||
def pol2cart(azimuth, elevation):
|
def pol2cart(azimut, elevation):
|
||||||
'''
|
'''
|
||||||
Polar to Cartesian coordinates within the horizon circle.
|
Polar to Cartesian coordinates within the horizon circle.
|
||||||
azimuth in radians
|
azimuth in radians
|
||||||
x = math.sin(azimuth) * elevation * self.radius
|
x = math.sin(azimut) * elevation * self.radius
|
||||||
y = math.cos(azimuth) * elevation * self.radius
|
y = math.cos(azimut) * elevation * self.radius
|
||||||
'''
|
'''
|
||||||
pass
|
pass
|
||||||
# (x, y) = self.pol2cart(sat.az, sat.el)
|
# (x, y) = self.pol2cart(sat.az, sat.el)
|
||||||
|
|
Loading…
Reference in New Issue