Skip to content

Commit

Permalink
Update Test_Sighting.html
Browse files Browse the repository at this point in the history
Updated bearing calcs from phone experiment to get portrait/landscape correct
  • Loading branch information
pdr0663 authored Sep 2, 2024
1 parent 03d327a commit 33379aa
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Test_Sighting.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,23 @@ <h1>Compass Bearing</h1>
// 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
Expand Down

0 comments on commit 33379aa

Please sign in to comment.