From 33379aacc98511795f7bd16c1406d58bbcb41c26 Mon Sep 17 00:00:00 2001 From: pdr0663 Date: Mon, 2 Sep 2024 16:54:05 +1000 Subject: [PATCH] Update Test_Sighting.html Updated bearing calcs from phone experiment to get portrait/landscape correct --- Test_Sighting.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Test_Sighting.html b/Test_Sighting.html index 1eae396..58682ad 100644 --- a/Test_Sighting.html +++ b/Test_Sighting.html @@ -36,20 +36,23 @@

Compass Bearing

// Function to update the bearing function updateBearing(event) { let alpha = event.alpha; - /* + // Adjust for different screen orientations - if (window.orientation === 90) { // Landscape left + if (window.orientation === 0) { // Portrait alpha -= 90; } else if (window.orientation === -90) { // Landscape right - alpha += 90; + alpha -= 180; + } else if (window.orientation === -90) { // Landscape left + // alpha += 0; } else if (window.orientation === 180) { // Portrait upside-down - alpha += 180; + // Chrome doesn't seem to allow this orientation + // alpha += 180; } // Invert the alpha to correct the direction alpha = 360 - alpha; - // Add declination for Sydney + // Add declination for Sydney to yield true bearing alpha += 13 // Normalize the alpha value to be between 0 and 360