-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: master
Are you sure you want to change the base?
feat(fms): MSFS 2024 route sync support #10005
Conversation
c902799
to
824a623
Compare
824a623
to
f065c75
Compare
fbw-a32nx/src/systems/fmgc/src/flightplanning/FlightPlanManager.ts
Outdated
Show resolved
Hide resolved
|
||
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
fbw-a32nx/src/systems/fmgc/src/flightplanning/FlightPlanService.ts
Outdated
Show resolved
Hide resolved
fbw-a32nx/src/systems/fmgc/src/flightplanning/FlightPlanService.ts
Outdated
Show resolved
Hide resolved
fbw-a32nx/src/systems/fmgc/src/flightplanning/MsfsFlightPlanSync.ts
Outdated
Show resolved
Hide resolved
@@ -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 }; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
fbw-a32nx/src/systems/fmgc/src/flightplanning/test/FlightPlan.ts
Outdated
Show resolved
Hide resolved
fbw-a32nx/src/systems/fmgc/src/flightplanning/test/FlightPlan.ts
Outdated
Show resolved
Hide resolved
@@ -674,6 +674,7 @@ | |||
"SimBridgeIp": "External SimBridge Host Address", | |||
"SimBridgePort": "External SimBridge Port", | |||
"SyncMsfsFlightPlan": "Sync MSFS Flight Plan", | |||
"AutoLoadMsfsRoute":"Automatically Load MSFS Route", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"AutoLoadMsfsRoute":"Automatically Load MSFS Route", | |
"AutoLoadMsfsRoute": "Automatically Load MSFS Route", |
d6bef28
to
5eba3a6
Compare
Fixes #10004
Summary of Changes
Introduces route sync capabilities for MSFS2024.
The following features are supported:
The following elements are synced between the simulator and FMS:
Limitations:
Testing instructions
MSFS 2020
On both aircraft:
MSFS 2024 (recommended to use SU2 beta)
On both aircraft:
On both sims
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.