@@ -879,7 +879,7 @@ function checkAndRefreshMap(trigger) {
879879
880880 // For GPS trigger, check distance
881881 if ( trigger === 'gps' && mapRefreshService . lastRefreshLocation ) {
882- const distance = haversineDistance (
882+ const distance = calculateHaversineDistance (
883883 mapRefreshService . lastRefreshLocation . lat ,
884884 mapRefreshService . lastRefreshLocation . lon ,
885885 lat ,
@@ -1086,7 +1086,7 @@ async function releaseWakeLock() {
10861086 * @returns {number } Distance in meters
10871087 */
10881088function calculateHaversineDistance ( lat1 , lon1 , lat2 , lon2 ) {
1089- debugLog ( `[GEOFENCE ] Calculating Haversine distance: (${ lat1 . toFixed ( 5 ) } , ${ lon1 . toFixed ( 5 ) } ) to (${ lat2 . toFixed ( 5 ) } , ${ lon2 . toFixed ( 5 ) } )` ) ;
1089+ debugLog ( `[HAVERSINE ] Calculating distance: (${ lat1 . toFixed ( 5 ) } , ${ lon1 . toFixed ( 5 ) } ) to (${ lat2 . toFixed ( 5 ) } , ${ lon2 . toFixed ( 5 ) } )` ) ;
10901090
10911091 const R = 6371000 ; // Earth's radius in meters
10921092 const toRad = ( deg ) => ( deg * Math . PI ) / 180 ;
@@ -1102,7 +1102,7 @@ function calculateHaversineDistance(lat1, lon1, lat2, lon2) {
11021102 const c = 2 * Math . atan2 ( Math . sqrt ( a ) , Math . sqrt ( 1 - a ) ) ;
11031103 const distance = R * c ;
11041104
1105- debugLog ( `[GEOFENCE] Haversine distance calculated: ${ distance . toFixed ( 2 ) } m` ) ;
1105+ debugLog ( `[HAVERSINE] Distance calculated: ${ distance . toFixed ( 2 ) } m` ) ;
11061106 return distance ;
11071107}
11081108
0 commit comments