From 32c0057ab0963074dc885c670457736f616e7464 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 3 Sep 2024 14:49:42 -0700 Subject: finish --- app.mjs | 34 ++++++++++++++++++++++++---------- package-lock.json | 4 ++-- package.json | 2 +- profile.yaml | 2 +- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app.mjs b/app.mjs index d6842cc..6daa65a 100755 --- a/app.mjs +++ b/app.mjs @@ -763,7 +763,6 @@ const renderHSI = (c, display, values) => { } const crs = src ? deg2Rad(values[src.crs]) : null; const fromto = src ? values[src.fromto] : null; - console.log(fromto); let def = src ? Math.min(Math.max(values[src.def], -3), 3) : null; if (!isNumber(def)) { def = 0; @@ -798,11 +797,10 @@ const renderHSI = (c, display, values) => { c.rotate(crs); for (let i = -2; i <= 2; i++) { - if (i != 0) { - const x = 13 * i; - c.moveTo(x + vdefR, 0); - c.arc(x, 0, vdefR, 0, pi2); - } + const r = i == 0 ? 1 : vdefR; + const x = 13 * i; + c.moveTo(x + r, 0); + c.arc(x, 0, r, 0, pi2); } c.stroke(); @@ -819,16 +817,32 @@ const renderHSI = (c, display, values) => { c.moveTo(0, -r); c.lineTo(0, -(cdiR + 1)); - c.moveTo(0, -r); // crs arrowhead - c.lineTo(-5, -0.8 * r); - c.lineTo(5, -0.8 * r); - c.lineTo(0, -r); + let y0 = -f1 * r; + let y1 = 0.8 * y0; + c.moveTo(0, y0); + c.lineTo(-5, y1); + c.lineTo(5, y1); + c.lineTo(0, y0); c.moveTo(0, r); c.lineTo(0, cdiR + 1); + // from/to arrowhead + if (fromto) { + let y0 = -cdiR; + let y1 = 0.4 * y0; + if (fromto != 1) { + y0 = -y0; + y1 = -y1; + } + c.moveTo(0, y0); + c.lineTo(-5, y1); + c.lineTo(5, y1); + c.lineTo(0, y0); + } + c.rotate(-crs); } diff --git a/package-lock.json b/package-lock.json index a8193cd..d06de21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "loupe-flightdeck", - "version": "0.0.6", + "version": "0.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "loupe-flightdeck", - "version": "0.0.6", + "version": "0.0.7", "dependencies": { "async": "^3.2.6", "canvas": "^2.11.2", diff --git a/package.json b/package.json index 0a89f67..00141c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loupe-flightdeck", - "version": "0.0.6", + "version": "0.0.7", "description": "Turn your stream deck into a flight deck!", "repository": { "type": "git", diff --git a/profile.yaml b/profile.yaml index 9fa369c..3cfd1f0 100644 --- a/profile.yaml +++ b/profile.yaml @@ -187,7 +187,7 @@ - xplane_dataref: sim/cockpit2/radios/actuators/HSI_source_select_pilot # navigation source for HSI - xplane_dataref: sim/cockpit2/radios/indicators/hsi_hdef_dots_pilot - xplane_dataref: sim/cockpit2/radios/indicators/hsi_display_horizontal_pilot - - xplane_dataref: sim/cockpit/radios/hsi_obs_deg_mag_pilot + - xplane_dataref: sim/cockpit/radios/gps_course_degtm - xplane_dataref: sim/cockpit/radios/gps_fromto - xplane_dataref: sim/cockpit2/radios/actuators/nav1_obs_deg_mag_pilot - xplane_dataref: sim/cockpit/radios/nav1_fromto -- cgit v1.2.3-70-g09d2