Fixed relative telemetry display for negative AAMSL values

This commit is contained in:
Mark Qvist 2024-04-01 12:25:24 +02:00
parent f436a98fc2
commit d3a27f4121
2 changed files with 3 additions and 3 deletions

View File

@ -796,7 +796,7 @@ class Location(Sensor):
obj_rh = None obj_rh = None
aamsl = None aamsl = None
if self.data["altitude"] != None and self.data["latitude"] != None and self.data["longitude"] != None: if self.data["altitude"] != None and self.data["latitude"] != None and self.data["longitude"] != None:
aamsl = self.get_aamsl() aamsl = max(0, self.get_aamsl())
coords = (self.data["latitude"], self.data["longitude"], aamsl) coords = (self.data["latitude"], self.data["longitude"], aamsl)
obj_ath = angle_to_horizon(coords) obj_ath = angle_to_horizon(coords)
obj_rh = radio_horizon(aamsl) obj_rh = radio_horizon(aamsl)
@ -825,7 +825,7 @@ class Location(Sensor):
s = relative_to.sensors["location"] s = relative_to.sensors["location"]
d = s.data d = s.data
if d != None and "latitude" in d and "longitude" in d and "altitude" in d: if d != None and "latitude" in d and "longitude" in d and "altitude" in d:
lat = d["latitude"]; lon = d["longitude"]; alt = altitude_to_aamsl(d["altitude"], lat, lon) lat = d["latitude"]; lon = d["longitude"]; alt = max(0, altitude_to_aamsl(d["altitude"], lat, lon))
if lat != None and lon != None: if lat != None and lon != None:
if alt == None: alt = 0 if alt == None: alt = 0
cs = (slat, slon, salt); cr = (lat, lon, alt) cs = (slat, slon, salt); cr = (lat, lon, alt)

View File

@ -1275,7 +1275,7 @@ MDScreen:
MDTextField: MDTextField:
id: telemetry_s_fixed_altitude id: telemetry_s_fixed_altitude
size_hint: [0.382, None] size_hint: [0.382, None]
hint_text: "Altitude" hint_text: "Ellipsoid Height (GPS Altitude)"
text: "" text: ""
font_size: dp(24) font_size: dp(24)