diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index 0956b96..3d94701 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -172,10 +172,13 @@ class _MapScreenState extends State { // Compute guessed locations with caching final maxRangeKm = _estimateLoRaRangeKm(connector); final filteredKeys = filteredByKeyPrefix - .map((c) => c.publicKeyHex) + .map((c) => '${c.publicKeyHex}:${c.path.join("-")}') .join(','); final anchorKeys = allContactsWithLocation - .map((c) => c.publicKeyHex) + .map( + (c) => + '${c.publicKeyHex}:${c.latitude}:${c.longitude}:${c.path.isNotEmpty ? c.path.last : ""}', + ) .join(','); final cacheKey = '$filteredKeys|$anchorKeys|${pathHistory.version}:${connector.currentSf}:${connector.currentBwHz}:${connector.currentTxPower}:${settings.mapShowGuessedLocations}'; diff --git a/lib/screens/path_trace_map.dart b/lib/screens/path_trace_map.dart index df5b19a..c6d800e 100644 --- a/lib/screens/path_trace_map.dart +++ b/lib/screens/path_trace_map.dart @@ -289,7 +289,11 @@ class _PathTraceMapScreenState extends State { targetPos = LatLng(target.latitude!, target.longitude!); } else if (pathData.isNotEmpty) { // Infer from the last hop: average GPS contacts sharing that hop. - final lastHop = pathData.last; + // For a round-trip path (flipPathRound), the target-side hop sits + // in the middle of the symmetric sequence; .last is the local side. + final lastHop = (widget.flipPathRound && pathData.length > 1) + ? pathData[(pathData.length - 1) ~/ 2] + : pathData.last; final peers = connector.contacts .where( (c) =>