From d49c2f3472a08962e28f7421f3bedccc3d7244fb Mon Sep 17 00:00:00 2001 From: James Pattinson Date: Fri, 21 Feb 2025 15:34:50 +0000 Subject: [PATCH] Big cleanup --- agcs-dev.html | 397 -------------------------------------- agcs.html | 128 +++++++++++-- agcs_old.html | 391 ------------------------------------- agcs_old2.html | 400 -------------------------------------- agcsdiag.html | 508 ------------------------------------------------- diag.html | 127 ------------- egfh.html | 84 -------- index.php | 2 - wind.html | 241 ----------------------- wind2.html | 349 --------------------------------- 10 files changed, 117 insertions(+), 2510 deletions(-) delete mode 100644 agcs-dev.html delete mode 100644 agcs_old.html delete mode 100644 agcs_old2.html delete mode 100644 agcsdiag.html delete mode 100644 diag.html delete mode 100644 egfh.html delete mode 100644 index.php delete mode 100644 wind.html delete mode 100644 wind2.html diff --git a/agcs-dev.html b/agcs-dev.html deleted file mode 100644 index c612a9c..0000000 --- a/agcs-dev.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - - EGFH Tower - - - - - - - - - - -
-
-
QNH
-
QFE
-
-
-
XXXX
-
XXXX
-
-
-
-
Surface Wind
-
Instant Wind
-
- -
-
2
-
1
-
-
-
-
2min Gust
-
OAT
-
- -
-
XXX
-
XXX
-
-
- -
-
QNH: XXX
-
- -

- -

-

Connection Status: Not Connected
- - - - diff --git a/agcs.html b/agcs.html index 63bdcc4..28b126d 100644 --- a/agcs.html +++ b/agcs.html @@ -71,8 +71,8 @@ line-height:140%; } #windSpeed { - background-color: #f1f1f1; - border-radius: 15px; + # background-color: #f1f1f1; + # border-radius: 15px; font-family: 'andale mono', monospace; font-size: 48pt; width: 300px; @@ -82,8 +82,8 @@ line-height:140%; } #avgWindSpeed { - background-color: #f1f1f1; - border-radius: 15px; + # background-color: #f1f1f1; + # border-radius: 15px; font-family: 'andale mono', monospace; font-size: 48pt; width: 300px; @@ -139,7 +139,7 @@ line-height:140%; //var audio = new Audio('BPCBeep.mp3'); //audio.play(); lastAvgWind = Date.now(); - windAvgValid = 1; + avgWindValid = 1; avgWindSpeed = Number(loopObj.windSpeed_knot).toFixed(0); roundedWind = (Math.round(loopObj.windDir / 10) * 10).toFixed(0); avgWindDir = ('000' + roundedWind).substr(-3); @@ -169,11 +169,19 @@ line-height:140%; } + function updateStatus() { + if (avgWindValid == 1 && windValid == 1) { + document.getElementById("status").style.backgroundColor = '#00AA00'; + document.getElementById("status").innerHTML = "OK"; + } + } + function updateWind() { document.getElementById("windSpeed").innerHTML = zeroFilledDir + "/" + instantWindSpeed; } function updateAvgWind() { + updateWindDirection(avgWindDir); document.getElementById("avgWindSpeed").innerHTML = avgWindDir + "/" + avgWindSpeed; document.getElementById("avgWindGust").innerHTML = avgWindGustDir + "/" + avgWindGustSpeed; } @@ -322,8 +330,97 @@ line-height:140%; } setTimeout( updateClock.bind( this, "zuluTime" ), 500 ); + updateStatus(); } + function drawCompass() { + ctx.clearRect(0, 0, canvas.width, canvas.height); + + // Draw runways + drawRunway(220, 120, 12, -20); // 22/04 runway moved to the left + drawRunway(280, 90, 8, 0, 40); // 10/28 runway moved down + + // Draw wind direction arrow + if (avgWindValid == 1) { + drawArrow(windDirection); + } + } + + function drawRunway(angle, length, width, xShift, yShift = 0) { + const radian = (angle - 90) * (Math.PI / 180); // Convert to radians + + // Calculate runway endpoints with xShift (left/right) and yShift (up/down) + const xStart = centerX - length * Math.cos(radian) + xShift; + const yStart = centerY - length * Math.sin(radian) + yShift; + const xEnd = centerX + length * Math.cos(radian) + xShift; + const yEnd = centerY + length * Math.sin(radian) + yShift; + + // Draw runway as a thick line + ctx.strokeStyle = "#333"; + ctx.lineWidth = width; + ctx.beginPath(); + ctx.moveTo(xStart, yStart); + ctx.lineTo(xEnd, yEnd); + ctx.stroke(); + + // Correctly assign runway numbers at each end + drawRunwayNumber(angle, xStart, yStart, radian, -20); + drawRunwayNumber(angle + 180, xEnd, yEnd, radian, 20); + } + + function drawRunwayNumber(angle, x, y, radian, extension) { + const runwayNumber = Math.round(angle / 10) % 36; // Convert heading to runway number + + // Move the number along the extended centerline + const xOffset = x + extension * Math.cos(radian); + const yOffset = y + extension * Math.sin(radian); + + ctx.font = "18px Arial"; + ctx.fillStyle = "black"; + ctx.textAlign = "center"; + ctx.textBaseline = "middle"; + ctx.fillText(runwayNumber.toString().padStart(2, "0"), xOffset, yOffset); + } + + function drawArrow(angle) { + const arrowLength = 80; // Extended to pass through center + const radian = (angle + 90) * (Math.PI / 180); // Adjusted for correct direction + + // Compute start and end points for the arrow + const xStart = centerX - arrowLength * Math.cos(radian); + const yStart = centerY - arrowLength * Math.sin(radian); + const xEnd = centerX + arrowLength * Math.cos(radian); + const yEnd = centerY + arrowLength * Math.sin(radian); + + // Draw main arrow line + ctx.strokeStyle = "red"; + ctx.lineWidth = 3; + ctx.beginPath(); + ctx.moveTo(xStart, yStart); + ctx.lineTo(xEnd, yEnd); + ctx.stroke(); + + // Draw arrowhead at the end + ctx.fillStyle = "red"; + ctx.beginPath(); + ctx.moveTo(xEnd, yEnd); + ctx.lineTo( + xEnd - 12 * Math.cos(radian - Math.PI / 6), + yEnd - 12 * Math.sin(radian - Math.PI / 6) + ); + ctx.lineTo( + xEnd - 12 * Math.cos(radian + Math.PI / 6), + yEnd - 12 * Math.sin(radian + Math.PI / 6) + ); + ctx.closePath(); + ctx.fill(); + } + + function updateWindDirection(degrees) { + windDirection = degrees % 360; + drawCompass(); + } + @@ -344,14 +441,10 @@ line-height:140%;
-
Surface Wind
-
Instant Wind
+
Surface Wind
1
Instant Wind
1
+
-
-
2
-
1
-

2min Gust
@@ -375,6 +468,8 @@ line-height:140%;

+ + diff --git a/agcs_old.html b/agcs_old.html deleted file mode 100644 index 6662f42..0000000 --- a/agcs_old.html +++ /dev/null @@ -1,391 +0,0 @@ - - - - - - EGFH Tower - - - - - - - - -

UNDER TEST Swansea Tower Live

-
- - - -
-
-
QNH
-
QFE
-
-
-
XXXX
-
XXXX
-
-
-
-
Surface Wind
-
Instant Wind
-
- -
-
2
-
1
-
-
-
-
2min Gust
-
-
- -
-
XXX
-
XXX
-
-
- -
-
QNH: XXX
-
- - -

- - - - - -
-
- - -
-
-

-

Connection Status: Not Connected
- - - - diff --git a/agcs_old2.html b/agcs_old2.html deleted file mode 100644 index 26a5467..0000000 --- a/agcs_old2.html +++ /dev/null @@ -1,400 +0,0 @@ - - - - - - EGFH Tower - - - - - - - -

UNDER TEST Swansea Tower Live

-
- - - -
-
-
QNH
-
QFE
-
-
-
XXXX
-
XXXX
-
-
-
-
Surface Wind
-
Instant Wind
-
- -
-
2
-
1
-
-
-
-
2min Gust
-
OAT
-
- -
-
XXX
-
XXX
-
-
- -
-
QNH: XXX
-
- -

- - - - - -
-
- - -
-
-

-

Connection Status: Not Connected
- - - - diff --git a/agcsdiag.html b/agcsdiag.html deleted file mode 100644 index 28b126d..0000000 --- a/agcsdiag.html +++ /dev/null @@ -1,508 +0,0 @@ - - - - - - EGFH Tower - - - - - - - - - - -
-
-
QNH
-
QFE
-
-
-
XXXX
-
XXXX
-
-
-
-
Surface Wind
1
Instant Wind
1
-
-
- -
-
-
2min Gust
-
OAT
-
- -
-
XXX
-
XXX
-
-
- -
-
QNH: XXX
-
-
- -
-
-
- -

- - - - - - diff --git a/diag.html b/diag.html deleted file mode 100644 index 5774459..0000000 --- a/diag.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - Runway Diagram with Wind Arrow - - - - - - - - - - diff --git a/egfh.html b/egfh.html deleted file mode 100644 index 5b8f81f..0000000 --- a/egfh.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - Swansea Weather - - - - - -

Swansea Weather Info

- -

Displaying both Raw and manipulated values. Wind speed is converted to kts and rounded to nearest kt. Direction padded with Zero and rounded to nearest 5 degrees

-

Note that this is obtaining data from the Davis servers in the cloud where the weather console uploads to. Currently this updates every 15(!) minutes - lets look at changing this

-
-

-

-

-

-

-

-

- -
- - - - diff --git a/index.php b/index.php deleted file mode 100644 index 33da5b2..0000000 --- a/index.php +++ /dev/null @@ -1,2 +0,0 @@ - - - - - - EGFH Tower - - - - - - - - -

UNDER TEST Swansea Tower Live

- Instant wind data is received from the sensor by the Raspberry Pi via radio reciever and updates in real time. - -

- The Barometric data actually comes from the Davis console device indirectly via the Internet and has a 15 minute delay. There will soon be a barometric sensor connected locally to fix this. -

- - - -

-
-
-
-
-
-
-
-

QNH: XXX

-
-
-
-

QFE: XXX

-
- - - - - -
-
- - - -
-
-

-

Connection Status: Not Connected
- - - - - diff --git a/wind2.html b/wind2.html deleted file mode 100644 index 340ff5c..0000000 --- a/wind2.html +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - EGFH Tower - - - - - - - - -

UNDER TEST Swansea Tower Live

- Instant wind data is received from the sensor by the Raspberry Pi via radio reciever and updates in real time. - -

- The Barometric data actually comes from the Davis console device indirectly via the Internet and has a 15 minute delay. There will soon be a barometric sensor connected locally to fix this. -

- - - -
-
-
QNH
-
QFE
-
-
-
XXXX
-
XXXX
-
-
-
-
2min Wind
-
Instant Wind
-
- -
-
2
-
1
-
- -
- -
-
QNH: XXX
-
- - -

- - - - - -
-
- - -
-
-

-

Connection Status: Not Connected
- - - -