aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2024-09-07 16:54:27 -0700
committerDeterminant <[email protected]>2024-09-07 16:54:27 -0700
commit7135e9af4926e5086419edb8c6d6e3864be5edd2 (patch)
tree5af30b9643c7fb20860a7a5be0763dd4691d960b
parent292fcb4a80618c35f862151fc85fe4e006362ab2 (diff)
now supports pressable display (e.g., press HSI to switch among GPS/NAV1/NAV2)
-rwxr-xr-xapp.mjs9
-rw-r--r--profile.yaml4
2 files changed, 7 insertions, 6 deletions
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();
diff --git a/profile.yaml b/profile.yaml
index 3b36642..bcf9780 100644
--- a/profile.yaml
+++ b/profile.yaml
@@ -202,14 +202,14 @@
def: 3
received: 4
color: magenta
- next: sim/autopilot/hsi_select_nav1
+ next: sim/autopilot/hsi_select_nav_1
0:
crs: 7
fromto: 8
def: 3
received: 4
color: '#2dfe54'
- next: sim/autopilot/hsi_select_nav2
+ next: sim/autopilot/hsi_select_nav_2
1:
crs: 9
fromto: 10