From 3d578db91712a3db8d38c4c1c5ba6e37e0879e0b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Dec 2025 03:56:50 +0000 Subject: [PATCH 1/4] Initial plan From 65050d64e3aabebf631469f7423ed76160b640ad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Dec 2025 04:00:01 +0000 Subject: [PATCH 2/4] Fix haversineDistance reference to calculateHaversineDistance in checkAndRefreshMap Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com> --- content/wardrive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/wardrive.js b/content/wardrive.js index 723ce67..9c5bf3e 100644 --- a/content/wardrive.js +++ b/content/wardrive.js @@ -879,7 +879,7 @@ function checkAndRefreshMap(trigger) { // For GPS trigger, check distance if (trigger === 'gps' && mapRefreshService.lastRefreshLocation) { - const distance = haversineDistance( + const distance = calculateHaversineDistance( mapRefreshService.lastRefreshLocation.lat, mapRefreshService.lastRefreshLocation.lon, lat, From ed0c0bb1d04e28b4d785cdd0d5ec9303f89aa04e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Dec 2025 04:04:45 +0000 Subject: [PATCH 3/4] Remove hardcoded [GEOFENCE] debug tags from calculateHaversineDistance Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com> --- content/wardrive.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/content/wardrive.js b/content/wardrive.js index 9c5bf3e..4bd3b8e 100644 --- a/content/wardrive.js +++ b/content/wardrive.js @@ -1086,8 +1086,6 @@ async function releaseWakeLock() { * @returns {number} Distance in meters */ function calculateHaversineDistance(lat1, lon1, lat2, lon2) { - debugLog(`[GEOFENCE] Calculating Haversine distance: (${lat1.toFixed(5)}, ${lon1.toFixed(5)}) to (${lat2.toFixed(5)}, ${lon2.toFixed(5)})`); - const R = 6371000; // Earth's radius in meters const toRad = (deg) => (deg * Math.PI) / 180; @@ -1102,7 +1100,6 @@ function calculateHaversineDistance(lat1, lon1, lat2, lon2) { const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); const distance = R * c; - debugLog(`[GEOFENCE] Haversine distance calculated: ${distance.toFixed(2)}m`); return distance; } From 925a0690589398d0c29bd5bdb070d53f54549484 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Dec 2025 04:06:32 +0000 Subject: [PATCH 4/4] Rename debug tag from [GEOFENCE] to [HAVERSINE] in calculateHaversineDistance Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com> --- content/wardrive.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/wardrive.js b/content/wardrive.js index 4bd3b8e..b570e89 100644 --- a/content/wardrive.js +++ b/content/wardrive.js @@ -1086,6 +1086,8 @@ async function releaseWakeLock() { * @returns {number} Distance in meters */ function calculateHaversineDistance(lat1, lon1, lat2, lon2) { + debugLog(`[HAVERSINE] Calculating distance: (${lat1.toFixed(5)}, ${lon1.toFixed(5)}) to (${lat2.toFixed(5)}, ${lon2.toFixed(5)})`); + const R = 6371000; // Earth's radius in meters const toRad = (deg) => (deg * Math.PI) / 180; @@ -1100,6 +1102,7 @@ function calculateHaversineDistance(lat1, lon1, lat2, lon2) { const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); const distance = R * c; + debugLog(`[HAVERSINE] Distance calculated: ${distance.toFixed(2)}m`); return distance; }