From 773a788835503182af3901d65471e0e53e0f5a5f Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 15 Aug 2024 17:57:27 -0700 Subject: ... --- xplane.mjs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'xplane.mjs') diff --git a/xplane.mjs b/xplane.mjs index 7b82817..688f85f 100644 --- a/xplane.mjs +++ b/xplane.mjs @@ -4,11 +4,11 @@ const xplaneAddr = "localhost"; const xplanePort = 49000; const socket = dgram.createSocket("udp4"); -//socket.on('message', (msg, rinfo) => { -// console.log(msg, rinfo) -//}); -// -//socket.bind(10080); +socket.on("message", (msg, rinfo) => { + console.log(msg, rinfo); +}); + +socket.bind(10080); export const subscribeDataRef = async (dataRef) => { //const dataRef = "sim/flightmodel/position/indicated_airspeed"; @@ -19,7 +19,7 @@ export const subscribeDataRef = async (dataRef) => { off = buffer.writeInt32LE(0, off); // xint client off += buffer.write(dataRef, off); // char[400] dataref off = buffer.writeUInt8(0, off); // null terminated - console.log(Array.from(buffer)); + console.info(`x-plane dataref: ${dataRef}`); await socket.send(buffer, 0, buffer.length, xplanePort, xplaneAddr); }; @@ -33,4 +33,4 @@ export const sendCommand = async (cmd) => { await socket.send(buffer, 0, buffer.length, xplanePort, xplaneAddr); }; -//command("sim/GPS/g1000n1_hdg_down"); +//sendCommand("sim/GPS/g1000n1_hdg_down"); -- cgit v1.2.3-70-g09d2