From 7135e9af4926e5086419edb8c6d6e3864be5edd2 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sat, 7 Sep 2024 16:54:27 -0700 Subject: now supports pressable display (e.g., press HSI to switch among GPS/NAV1/NAV2) --- app.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app.mjs') diff --git a/app.mjs b/app.mjs index 9904e79..a558885 100755 --- a/app.mjs +++ b/app.mjs @@ -221,9 +221,9 @@ const renderMultiLineText = (c, x0, y0, w, h, text, styles, conf) => { }; const drawKey = async (id, conf, pressed) => { - if (conf && conf.display != null) { + if (conf && isObject(conf.display)) { // not an input, but a display gauge - conf.isPressed = pressed; + conf.display.pressed = pressed; return; } @@ -763,7 +763,8 @@ const renderHSI = (c, display, values) => { if (!isObject(src)) { src = null; } - if (src) { + if (display.pressed && src) { + display.pressed = false; xplane.sendCommand(src.next.toString()); } const crs = src ? deg2Rad(values[src.crs]) : null; @@ -1008,7 +1009,7 @@ device.on("connect", async () => { : 1; const msPerFrame = 1000 / freq; - conf.isPressed = false; + conf.display.pressed = false; conf.renderStart = () => { let enabled = true; let startTime = new Date(); -- cgit v1.2.3-70-g09d2