Skip to content

Commit

Permalink
Move transmission to JS
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueberryKing committed Sep 27, 2023
1 parent dbba927 commit 4a00840
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ class FMCMainDisplay extends BaseAirliners {
this.arincMissedThrustReductionAltitude = FmArinc429OutputWord.empty("MISSED_THR_RED_ALT");
this.arincMissedAccelerationAltitude = FmArinc429OutputWord.empty("MISSED_ACC_ALT");
this.arincMissedEoAccelerationAltitude = FmArinc429OutputWord.empty("MISSED_EO_ACC_ALT");
this.arincTransitionAltitude = FmArinc429OutputWord.empty("TRANS_ALT");
this.arincTransitionLevel = FmArinc429OutputWord.empty("TRANS_LVL");
/** contains fm messages (not yet implemented) and nodh bit */
this.arincEisWord2 = FmArinc429OutputWord.empty("EIS_DISCRETE_WORD_2");

Expand All @@ -204,6 +206,8 @@ class FMCMainDisplay extends BaseAirliners {
this.arincMissedThrustReductionAltitude,
this.arincMissedAccelerationAltitude,
this.arincMissedEoAccelerationAltitude,
this.arincTransitionAltitude,
this.arincTransitionLevel,
this.arincEisWord2,
];
}
Expand Down Expand Up @@ -598,6 +602,7 @@ class FMCMainDisplay extends BaseAirliners {
this.toSpeedsChecks();
this.thrustReductionAccelerationChecks();
this.updateThrustReductionAcceleration();
this.updateTransitionAltitudeLevel();
this.updateMinimums();
this.updateIlsCourse();
}
Expand Down Expand Up @@ -2926,6 +2931,7 @@ class FMCMainDisplay extends BaseAirliners {
if (s === FMCMainDisplay.clrValue) {
// TODO when possible fetch default from database
this.flightPlanManager.setOriginTransitionAltitude();
this.updateTransitionAltitudeLevel();
return true;
}

Expand All @@ -2942,6 +2948,7 @@ class FMCMainDisplay extends BaseAirliners {
}

this.flightPlanManager.setOriginTransitionAltitude(value);
this.updateTransitionAltitudeLevel();
return true;
}

Expand Down Expand Up @@ -3202,6 +3209,22 @@ class FMCMainDisplay extends BaseAirliners {
);
}

updateTransitionAltitudeLevel() {
const originTransitionAltitude = this.flightPlanManager.originTransitionAltitude;
this.arincTransitionAltitude.setBnrValue(
originTransitionAltitude !== undefined ? originTransitionAltitude : 0,
originTransitionAltitude !== undefined ? Arinc429Word.SignStatusMatrix.NormalOperation : Arinc429Word.SignStatusMatrix.NoComputedData,
17, 131072, 0,
)

const destinationTansitionLevel = this.flightPlanManager.destinationTransitionLevel;
this.arincTransitionLevel.setBnrValue(
destinationTansitionLevel !== undefined ? destinationTansitionLevel : 0,
destinationTansitionLevel !== undefined ? Arinc429Word.SignStatusMatrix.NormalOperation : Arinc429Word.SignStatusMatrix.NoComputedData,
9, 512, 0,
)
}

//Needs PR Merge #3082
//TODO: with FADEC no longer needed
setPerfTOFlexTemp(s) {
Expand Down Expand Up @@ -3830,6 +3853,7 @@ class FMCMainDisplay extends BaseAirliners {
setPerfApprTransAlt(s) {
if (s === FMCMainDisplay.clrValue) {
this.flightPlanManager.setDestinationTransitionLevel();
this.updateTransitionAltitudeLevel();
return true;
}

Expand All @@ -3844,6 +3868,7 @@ class FMCMainDisplay extends BaseAirliners {
}

this.flightPlanManager.setDestinationTransitionLevel(Math.round(value / 100));
this.updateTransitionAltitudeLevel();
return true;
}

Expand Down
42 changes: 0 additions & 42 deletions fbw-a32nx/src/systems/fmgc/src/components/EfisLabels.ts

This file was deleted.

2 changes: 0 additions & 2 deletions fbw-a32nx/src/systems/fmgc/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { FcuSync } from '@fmgc/components/FcuSync';
import { ReadySignal } from '@fmgc/components/ReadySignal';
import { FlightPlanManager } from '@fmgc/wtsdk';
import { EfisLabels } from './EfisLabels';
import { FmgcComponent } from './FmgcComponent';
import { FmsMessages } from './fms-messages';

const fmsMessages = new FmsMessages();

const components: FmgcComponent[] = [
fmsMessages,
new EfisLabels(),
new ReadySignal(),
new FcuSync(),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ export class FlightPlanManager {
* The transition altitude for the origin in the *active* flight plan
*/
get originTransitionAltitude(): number | undefined {
return this.getOriginTransitionAltitude(0);
return this.getOriginTransitionAltitude(FlightPlans.Active);
}

public getOriginTransitionAltitudeIsFromDb(flightPlanIndex: number = 0): boolean {
Expand All @@ -1865,7 +1865,7 @@ export class FlightPlanManager {
* Is the transition altitude for the origin in the *active* flight plan from the database?
*/
get originTransitionAltitudeIsFromDb(): boolean {
return this.getOriginTransitionAltitudeIsFromDb(0);
return this.getOriginTransitionAltitudeIsFromDb(FlightPlans.Active);
}

/**
Expand Down Expand Up @@ -1893,7 +1893,7 @@ export class FlightPlanManager {
* The transition level for the destination in the *active* flight plan
*/
get destinationTransitionLevel(): FlightLevel | undefined {
return this.getDestinationTransitionLevel(0);
return this.getDestinationTransitionLevel(FlightPlans.Active);
}

public getDestinationTransitionLevelIsFromDb(flightPlanIndex: number = this._currentFlightPlanIndex): boolean {
Expand Down
10 changes: 5 additions & 5 deletions fbw-a32nx/src/systems/instruments/src/PFD/AltitudeIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: GPL-3.0

import { ClockEvents, DisplayComponent, FSComponent, Subject, Subscribable, VNode } from '@microsoft/msfs-sdk';
import { Arinc429Word, Arinc429WordData } from '@flybywiresim/fbw-sdk';
import { Arinc429Register, Arinc429Word, Arinc429WordData } from '@flybywiresim/fbw-sdk';
import { VerticalMode } from '@shared/autopilot';
import { Arinc429RegisterSubject } from 'instruments/src/MsfsAvionicsCommon/Arinc429RegisterSubject';
import { PFDSimvars } from './shared/PFDSimvarPublisher';
Expand Down Expand Up @@ -541,9 +541,9 @@ class AltimeterIndicator extends DisplayComponent<AltimeterIndicatorProps> {

private unit = '';

private transAltAr = Arinc429Word.empty();
private transAltAr = Arinc429Register.empty();

private transLvlAr = Arinc429Word.empty();
private transLvlAr = Arinc429Register.empty();

private flightPhase = 0;

Expand Down Expand Up @@ -590,14 +590,14 @@ class AltimeterIndicator extends DisplayComponent<AltimeterIndicatorProps> {
});

sub.on('fmTransAltRaw').whenChanged().handle((ta) => {
this.transAltAr = new Arinc429Word(ta);
this.transAltAr.set(ta);

this.handleBlink();
this.getText();
});

sub.on('fmTransLvlRaw').whenChanged().handle((tl) => {
this.transLvlAr = new Arinc429Word(tl);
this.transLvlAr.set(tl);

this.handleBlink();
this.getText();
Expand Down

0 comments on commit 4a00840

Please sign in to comment.