Fixed invalid speed being reported to telemetry system

This commit is contained in:
Mark Qvist 2024-11-15 17:06:33 +01:00
parent 2221629315
commit 91883a0510
2 changed files with 3 additions and 2 deletions

View File

@ -67,7 +67,7 @@ class GpsdLocationPlugin(SidebandTelemetryPlugin):
self.latitude = gpsd_latitude self.latitude = gpsd_latitude
self.longitude = gpsd_longitude self.longitude = gpsd_longitude
self.altitude = gpsd_altitude self.altitude = gpsd_altitude
self.speed = gpsd_speed self.speed = gpsd_speed*3.6 # Convert from m/s to km/h
self.bearing = gpsd_bearing self.bearing = gpsd_bearing
epx = result.get("epx", None); epy = result.get("epy", None) epx = result.get("epx", None); epy = result.get("epy", None)

View File

@ -744,7 +744,8 @@ class Location(Sensor):
if "altitude" in self._raw: if "altitude" in self._raw:
self.altitude = self._raw["altitude"] self.altitude = self._raw["altitude"]
if "speed" in self._raw: if "speed" in self._raw:
self.speed = self._raw["speed"] # Android GPS reports speed in m/s, convert to km/h
self.speed = self._raw["speed"]*3.6
if self.speed < 0: if self.speed < 0:
self.speed = 0 self.speed = 0
if "bearing" in self._raw: if "bearing" in self._raw: