Skip to content

feat(fms): MSFS 2024 route sync support #10005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

Benjozork
Copy link
Member

@Benjozork Benjozork commented Apr 12, 2025

Fixes #10004

Summary of Changes

Introduces route sync capabilities for MSFS2024.

The following features are supported:

  • (MSFS EFB) Send route to avionics
  • (MSFS EFB) Request route from avionics
  • (A32NX/A380X) Auto-import of route from sim (disabled by default, replaces "MSFS Flight Plan Sync" option in 2024)

The following elements are synced between the simulator and FMS:

  • Procedures and their transitions
  • Enroute waypoints
  • Pilot-defined waypoints
  • Cruise Level

Limitations:

  • At the moment, airways are not preserved when sending the flight plan back to the simulator. Every waypoint along the airway will be sent separately.
  • Any changes made inside procedures are not preserved when sending the flight plan back to the simulator. This is due to the inherent differences in how various flight planning systems handle procedures, which makes it difficult to support this use case.
  • At the moment, step climbs are not imported from the simulator flight plan.
  • Place-bearing/Place-bearing and Place-distance waypoints are converted to coordinate waypoints when sending the flight plan back to the simulator

Testing instructions

MSFS 2020

On both aircraft:

  • Ensure flight plan sync (all three settings) still works like it does in the dev version
  • Ensure the new "Automatically Load MSFS Route" option does not appear in the EFB sim options page

MSFS 2024 (recommended to use SU2 beta)

On both aircraft:

  • Ensure that pressing "send route to avionics" correctly sends the route to the FMS in various cases (please test many flight plans and kinds of procedures)
  • Ensure that pressing "request route to avionics" correctly imports the route to the MSFS EFB in various cases (please test many flight plans and kinds of procedures)
  • Ensure that "Automatically Load MSFS Route" option in the EFB sim options page works correctly (both on and off)

On both sims

  • Make sure that all flight plan entry features in the FMS still work correctly

How to download the PR for QA

Every new commit to this PR will cause new A32NX and A380X artifacts to be created, built, and uploaded.

  1. Make sure you are signed in to GitHub
  2. Click on the Checks tab on the PR
  3. On the left side, find and click on the PR Build tab
  4. Click on either flybywire-aircraft-a320-neo, flybywire-aircraft-a380-842 (4K) or flybywire-aircraft-a380-842 (8K) download link at the bottom of the page

@Benjozork Benjozork force-pushed the feat/msfs-2024-route-sync branch from c902799 to 824a623 Compare April 12, 2025 21:54
@Benjozork Benjozork force-pushed the feat/msfs-2024-route-sync branch from 824a623 to f065c75 Compare April 12, 2025 21:57
@Benjozork Benjozork marked this pull request as ready for review April 19, 2025 15:43
@Benjozork Benjozork added QA Tier 1 A32NX Related to the A32NX aircraft A380X Related to the A380X aircraft MSFS2024 PRs Fixing FS2024 Issues labels Apr 19, 2025
@Benjozork Benjozork added this to the v0.14.0 milestone Apr 19, 2025
@github-project-automation github-project-automation bot moved this to 🟡 Code Review: Ready for Review in Quality Assurance Apr 19, 2025

export class FlightPlanService<P extends FlightPlanPerformanceData = FlightPlanPerformanceData>
implements FlightPlanInterface<P>
{
private readonly flightPlanManager: FlightPlanManager<P>;

navigationDatabase: NavigationDatabase;
public syncClientID = Math.round(Math.random() * 10_000_000);
Copy link
Member

Choose a reason for hiding this comment

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

While incredibly unlikely, multiple instances could potentially get the same syncClientID here. Could this lead to issues?

Copy link
Member Author

Choose a reason for hiding this comment

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

It would cause issues yes. I can bump up the constant for now - could be a UUID, but I feel that allocation would be more expensive when deserializing sync messages.

@@ -74,19 +124,54 @@ export class FlightPlanRpcClient<P extends FlightPlanPerformanceData> implements
funcName: T,
...args: Parameters<FunctionsOnlyAndUnwrapPromises<FlightPlanInterface<P>>[T]>
): Promise<ReturnType<FunctionsOnlyAndUnwrapPromises<FlightPlanInterface<P>>[T]>> {
const id = v4();
const batchState = { batch: null, state: false };
Copy link
Member

Choose a reason for hiding this comment

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

What does state mean here? It's not clear to me what this boolean signifies. Maybe we can choose a more descriptive name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Clarified. Also fixed a subscription leak 😄

const gameStateSub = GameStateProvider.get().sub((state) => {
if (state === GameState.ingame) {
this.handleSendHeartbeat();
setInterval(() => this.handleSendHeartbeat(), 2_500);
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to clean up this setInterval when we destroy the RPC server?

Copy link
Member Author

Choose a reason for hiding this comment

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

At the moment the server basically always exists, because it exists as long as the FMC does, and IIRC we don't have FMC failures yet. If you want, I can add a destroy() method

Copy link
Member

Choose a reason for hiding this comment

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

I'm not too bothered about cleaning up to be honest if it's expected to exist for the entire session. It's fine to keep it as it is.

@@ -674,6 +674,7 @@
"SimBridgeIp": "External SimBridge Host Address",
"SimBridgePort": "External SimBridge Port",
"SyncMsfsFlightPlan": "Sync MSFS Flight Plan",
"AutoLoadMsfsRoute":"Automatically Load MSFS Route",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"AutoLoadMsfsRoute":"Automatically Load MSFS Route",
"AutoLoadMsfsRoute": "Automatically Load MSFS Route",

@github-project-automation github-project-automation bot moved this from 🟡 Code Review: Ready for Review to 🔴 Code Review: In progress in Quality Assurance Apr 27, 2025
@Benjozork Benjozork force-pushed the feat/msfs-2024-route-sync branch from d6bef28 to 5eba3a6 Compare April 27, 2025 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A32NX Related to the A32NX aircraft A380X Related to the A380X aircraft MSFS2024 PRs Fixing FS2024 Issues QA Tier 2
Projects
Status: 🔴 Code Review: In progress
Development

Successfully merging this pull request may close these issues.

MSFS 2024 Route Sync Support
2 participants