diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index e69ffe7a..8bef3fcc 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -784,10 +784,10 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject { positionPacket.timestamp = UInt32(LocationHelper.currentTimestamp.timeIntervalSince1970) positionPacket.altitude = Int32(LocationHelper.currentAltitude) positionPacket.satsInView = UInt32(LocationHelper.satsInView) - if !LocationHelper.currentSpeed.isNaN || !LocationHelper.currentSpeed.isInfinite { + if LocationHelper.currentSpeed > 0 && (!LocationHelper.currentSpeed.isNaN || !LocationHelper.currentSpeed.isInfinite) { positionPacket.groundSpeed = UInt32(LocationHelper.currentSpeed * 3.6) } - if (!LocationHelper.currentHeading.isNaN || !LocationHelper.currentHeading.isInfinite) { + if LocationHelper.currentHeading > 0 && (!LocationHelper.currentHeading.isNaN || !LocationHelper.currentHeading.isInfinite) { positionPacket.groundTrack = UInt32(LocationHelper.currentHeading) } diff --git a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift index 76a1a840..4a242f88 100644 --- a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift +++ b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift @@ -91,7 +91,7 @@ struct MapViewSwiftUI: UIViewRepresentable { #endif } - private func setMapLayer(mapView: MKMapView) { + private func setMapBaseLayer(mapView: MKMapView) { // Avoid refreshing UI if selectedLayer has not changed guard currentMapLayer != selectedMapLayer else { return } currentMapLayer = selectedMapLayer @@ -117,6 +117,10 @@ struct MapViewSwiftUI: UIViewRepresentable { default: mapView.mapType = .standard } + } + + private func setMapOverlays(mapView: MKMapView) { + // Weather radar if UserDefaults.enableOverlayServer { let locale = Locale.current @@ -165,8 +169,10 @@ struct MapViewSwiftUI: UIViewRepresentable { } } } - // Set selected map layer - setMapLayer(mapView: mapView) + // Set selected map base layer + setMapBaseLayer(mapView: mapView) + // Set map overlay layer + setMapOverlays(mapView: mapView) let latest = positions .filter { $0.latest == true }