Skip to content
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

feat: remote flyPad and displays #8598

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

Conversation

Benjozork
Copy link
Member

@Benjozork Benjozork commented Mar 31, 2024

Fixes #6712
Fixes #6978

Depends on flybywiresim/simbridge#114

Summary of Changes

This PR adds the first implementation of the remote display bridge protocol, and enables it for certain instruments, including the flyPad.

Testing instructions

TBD

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, click on the bottom PR tab
  4. Click on either flybywire-aircraft-a320-neo or flybywire-aircraft-a380-842 download link at the bottom of the page

# Conflicts:
#	fbw-a380x/src/systems/instruments/src/PFD/instrument.tsx
#	pnpm-lock.yaml
# Conflicts:
#	fbw-a380x/mach.config.js
#	fbw-a380x/src/systems/extras-host/index.ts
#	fbw-a380x/src/systems/extras-host/modules/common/AircraftPresetsList.ts
#	fbw-a380x/src/systems/extras-host/modules/key_interceptor/KeyInterceptor.ts
#	fbw-a380x/src/systems/extras-host/modules/version_check/VersionCheck.ts
#	fbw-common/src/systems/instruments/src/EFB/Efb.tsx
#	fbw-common/src/systems/instruments/src/EFB/ToolBar/ToolBar.tsx
#	fbw-common/src/systems/instruments/src/ND/pages/rose/RoseVorPage.tsx
@Benjozork Benjozork marked this pull request as ready for review March 31, 2024 16:33
Comment on lines 69 to 70
airframeName: 'A320-251N',
clientName: 'A32NX',
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
airframeName: 'A320-251N',
clientName: 'A32NX',
airframeName: 'A320-251N',
clientName: 'A32NX',

This maybe should use an existing configuration (or the new VFS-based solution currently in the planning stages in #8599)

Copy link
Member

Choose a reason for hiding this comment

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

Ok to put a TODO: here as well for this to be covered later.

@@ -23,7 +23,7 @@ import { VerticalSpeedIndicator } from './VerticalSpeedIndicator';
import { PFDSimvars } from './shared/PFDSimvarPublisher';

export const getDisplayIndex = () => {
const url = document.getElementsByTagName('a32nx-pfd')[0].getAttribute('url');
const url = document.querySelector('vcockpit-panel > *').getAttribute('url');
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
const url = document.querySelector('vcockpit-panel > *').getAttribute('url');
const url = document.querySelector('vcockpit-panel > *').getAttribute('url');

May be a use case for xmlConfig via panel.xml in the future, for now this is ok.

Comment on lines 88 to 91
export const getAirframeType = () => {
if (window.FBW_REMOTE) {
return 'A320_251N';
}
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
export const getAirframeType = () => {
if (window.FBW_REMOTE) {
return 'A320_251N';
}
export const getAirframeType = () => {
if (window.FBW_REMOTE) {
return 'A320_251N';
}

Note for self: I'll need to take note of this in #8599 as well as potentially #8500

In the future, if we have remote instruments in multiple AC and variants, this might also need some thought.

Copy link
Member

Choose a reason for hiding this comment

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

We are also deprecating the function getAirframeType() from usage in the EFB (PR 8500), may be better to switch to the new aircraft type L:Var for this and merge 8500 first? (Or again, long term solution, is the VFS based unified config)

@@ -85,9 +85,15 @@ interface BatteryStatus {
export const usePower = () => React.useContext(PowerContext);

// this returns either `A380_842` or `A320_251N` depending on the aircraft
export const getAirframeType = () => new URL(
export const getAirframeType = () => {
if (window.FBW_REMOTE) {
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
if (window.FBW_REMOTE) {
if (window.FBW_REMOTE) {

May want to abstract this into its own util or function so that its easier to manage, for a potential future use case if one day we also have to have bespoke remote EFB code in future in the EFB (Unlikely, but better to push this out into a dedicated function)

@@ -58,7 +59,7 @@ export const ToolBar = () => (
<ToolBarButton to="/atc" tooltipText={t('AirTrafficControl.Title')}>
<BroadcastPin size={35} />
</ToolBarButton>
<ToolBarButton to="/failures" tooltipText={t('Failures.Title')}>
<ToolBarButton to="/failures" tooltipText={t('Failures.Title')} disabled={window.FBW_REMOTE}>
Copy link
Member

Choose a reason for hiding this comment

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

See above point about having an abstracted util function (that reads from window.FBW_REMOTE). We don't need awareness of window at this level.


constructor(options: RemoteClientOptions) {
this.url = options.websocketUrl();
this.airframeName = options.airframeName;
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
this.airframeName = options.airframeName;
this.airframeName = options.airframeName;

Maybe this should be aircraft instead of airframe (a bit pendatic but sure)

Comment on lines +69 to +70
airframeName: 'A380-842',
clientName: 'A380X',
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
airframeName: 'A380-842',
clientName: 'A380X',
airframeName: 'A380-842',
clientName: 'A380X',

See point about using either an existing config, or (plan) to implement the new VFS based solution with a TODO:

msfsAvionicsInstrument,
reactInstrument,
} = getMachInstrumentBuilders({
templateIDPrefix: 'A32NX',
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
templateIDPrefix: 'A32NX',
templateIDPrefix: 'A32NX',

I'd actually like to read from .env, or some kind of markup here, but I'm not sure if its actually possible.

@2hwk 2hwk added this to the v0.12.0 milestone Apr 10, 2024
@2hwk
Copy link
Member

2hwk commented May 3, 2024

Looks like merge conflicts from lint changes (You probably already know, this is for the do not merge tag)

# Conflicts:
#	fbw-a32nx/mach.config.js
#	fbw-a32nx/src/systems/extras-host/index.ts
#	fbw-a32nx/src/systems/instruments/src/Clock/instrument.tsx
#	fbw-a32nx/src/systems/instruments/src/EWD/instrument.tsx
#	fbw-a32nx/src/systems/instruments/src/ND/instrument.tsx
#	fbw-a32nx/src/systems/instruments/src/PFD/PFD.tsx
#	fbw-a32nx/src/systems/instruments/src/PFD/instrument.tsx
#	fbw-a32nx/src/systems/simbridge-client/src/common.ts
#	fbw-a380x/src/systems/extras-host/index.ts
#	fbw-common/src/systems/instruments/src/EFB/Efb.tsx
#	fbw-common/src/systems/instruments/src/EFB/ToolBar/ToolBar.tsx
#	fbw-common/src/systems/instruments/src/ND/pages/rose/RoseVorPage.tsx
#	fbw-common/src/systems/instruments/src/ND/shared/utils/MapParameters.ts
#	fbw-common/src/systems/shared/src/simbridge/components/ClientState.ts
#	package.json
#	pnpm-lock.yaml
@MStallen
Copy link

Still my biggest wish!!!

@flogross89 flogross89 removed this from the v0.12.0 milestone Oct 26, 2024
@MStallen
Copy link

Why was this one removed from V0.12? The issue is opened more then two and halve years ago and had then already demo-pictures where it was working. Is it still possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔴 Code Review: In progress
Development

Successfully merging this pull request may close these issues.

flyPad Web Server Remote Displays (PFD, ND, ECAM)
4 participants