Skip to content

Issue #274 solved: send from a flight loop, not the window's draw callback - #275

Merged
jmacd867 merged 3 commits into
mainfrom
274-send-from-flight-loop
Nov 13, 2026
Merged

jmacd867 merged 3 commits into
mainfrom
274-send-from-flight-loop

Conversation

@jmacd867

Copy link
Copy Markdown
Collaborator

Summary

Closes #274. On Windows and Linux the plugin sent only from the "Positional Flight Data" window's draw callback, so a window X-Plane never drew sent nothing. Sending now runs in a flight loop, as the macOS build already does. The window only displays values.

 XPluginEnable
   baton->start()
+  XPLMRegisterFlightLoopCallback(send_flight_loop, every 50ms)

+send_flight_loop                  # runs whether or not the window is drawn
+  send_sample
+    read_sample                   # the 16 values, unchanged from #184
+    log "[PDS PLUGIN] Send ->" to Log.txt
+    baton->send

 draw_pilotdatasync_plugin         # display only now
   draw values
-  every 50ms
-    build sample, log "Draw send", baton->send

 mouse_handler (Send Packet button)
-  build sample, baton->send
+  send_sample

 XPluginStart
   create window
+  log the window's position, then every monitor (X-Plane and OS coordinates)

The README, inference/README.md, AGENTS.md and docs/telemetry_schema.md no longer say that data needs the window open. The Log.txt guidance is limited to Windows and Linux, because the macOS build writes nothing there.

Evidence

  • Before: On the lab X-Plane PC (Windows) on 2026-11-12, the plugin was loaded and ticked and baton finished its handshake, but the window was never drawn. Log.txt had no [PDS PLUGIN] Draw send lines, baton_debug.log had no Attempted to send lines, and the logger's CSV stayed empty.
    After: On the same PC with 2cfa261, telemetry reached the relay and data_logger wrote rows to the CSV.
  • 7b3230f and 100a022 (shared send_sample(), the monitor logging and the docs) build and pass meson test but have not been run in X-Plane yet. meson test only covers test_threading_tools (gtest target tests a locally redefined function, not production code #191). The plugin calls the X-Plane SDK directly, so no automated test exercises it.
  • The payload is the same 16 values, in the same order and with the same unit conversions, as main's draw-callback send. Both yaw halves and both G-force halves still carry the flightmodel value.

Merge Danger

Door: two-way

Reverting restores the draw-callback send. The payload, the relay, the CSV columns and the config are unchanged.

Blast Radius: plugin

  • Lab PCs on Windows or Linux only get the fix after rebuilding the plugin and reinstalling PilotDataSync.xpl. The relay and inference need no change.
  • Samples are now sent whenever the plugin is enabled, including on menus and with the window closed. Before, sending stopped with the window.
  • Log.txt gets one line per sample (up to 20 a second), which was already the case while the window was drawn.
  • The macOS build is unchanged.
  • During the lab test the hardware throttles stopped responding. This was not reproduced, or tried with the plugin unticked. The plugin only reads DataRefs (no writes, commands or input hooks), so it is believed to be unrelated. Untick the plugin at the next lab session to confirm.

…lback

On Windows and Linux the 20 Hz send lived in the "Positional Flight Data"
window's draw callback, so a window X-Plane never drew sent nothing, even
with baton connected. Send from a flight loop instead, registered while the
plugin is enabled, as the macOS build already does. The window now only
displays values.

Reading a sample moves into read_sample(), shared by the flight loop and the
window's Send Packet button, which had its own copy.

At start-up, write the window's position and each monitor's bounds to
Log.txt, so a window that does not appear can be found.
Send from one place: send_sample() reads, logs and sends, and both the
flight loop and the window's Send Packet button call it, so every sample
gets its Log.txt line as the README says.

Log the window's position as X-Plane placed it, rather than the bounds the
plugin asked for, and list the monitors from XPLMGetAllMonitorBoundsOS as
well. XPLMGetAllMonitorBoundsGlobal lists only full-screen X-Plane monitors,
so in windowed mode it gave nothing to compare the window against.

Correct the telemetry schema, which still described the removed draw
callback throttle, and a comment that still spoke of two send sites.
The macOS build writes nothing to Log.txt, so the new guidance and the
troubleshooting row now say which platforms they cover. The (OS) monitor
lines are in the operating system's pixels, not Windows', since Linux builds
the same file. A connected baton with no Send lines points at an old plugin
build still installed, not an unticked plugin: baton and the flight loop
start together.
@sonarqubecloud

Copy link
Copy Markdown

@Phlabry Phlabry left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The flight loop makes baton's per-sample log unconditional, so a window that never draws writes 20 lines a second to baton_debug.log all session instead of none. #262.

@jmacd867
jmacd867 merged commit e6865bb into main Nov 13, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin sends nothing on Windows unless the Positional Flight Data window is drawn

2 participants