Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
uX-Pizza authored Oct 27, 2023
2 parents 75bdcc4 + 8f6f017 commit 9c66508
Show file tree
Hide file tree
Showing 13 changed files with 642 additions and 235 deletions.
3 changes: 2 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
1. [APU] Added APU start motor failure - @uX-Pizza (pizza187)
1. [EFB/ATSU] Added NOAA (aviationweather.gov) as a METAR source - @tracernz (Mike)
1. [EFB] Fixed the main page and landing calculator to use the selected METAR source - @tracernz (Mike)
1. [FMS] Improve layout of PERF CLB, PERF CRZ and PERF DES pages according to H3 - @BlueberryKing (BlueberryKing)
1. [FMS] Implement CHECK SPEED MODE message - @BlueberryKing (BlueberryKing)

## 0.11.0

Expand Down Expand Up @@ -190,7 +192,6 @@
1. [LIGHTS] Fixed trim decal emissive and floods - @FinalLightNL (FinalLight#2113)
1. [FLIGHTMODEL/FUEL] Fix outer tank transfer behaviour - @donstim (donbikes#4084)


## 0.9.0

1. [MODEL] Add Wheel Chocks and GSE Safety Cones - @bouveng (Johan Bouveng)
Expand Down
4 changes: 4 additions & 0 deletions fbw-a32nx/docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,10 @@ These variables are the interface between the 3D model and the systems/code.
- Bool
- Indicates if the T/D REACHED message is shown on the PFD

- A32NX_PFD_MSG_CHECK_SPEED_MODE
- Bool
- Indicates if the CHECK SPEED MODE message is shown on the PFD

- A32NX_PFD_LINEAR_DEVIATION_ACTIVE
- Bool
- Indicates if the linear deviation is shown on the PFD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const NXSystemMessages = {
awyWptMismatch: new TypeIMessage("AWY/WPT MISMATCH"),
cancelAtisUpdate: new TypeIMessage("CANCEL UPDATE BEFORE"),
checkMinDestFob: new TypeIIMessage("CHECK MIN DEST FOB"),
checkSpeedMode: new TypeIIMessage("CHECK SPEED MODE"),
checkToData: new TypeIIMessage("CHECK TAKE OFF DATA", true),
checkWeight: new TypeIIMessage("CHECK WEIGHT", true),
comUnavailable: new TypeIMessage("COM UNAVAILABLE"),
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export interface Fmgc {
getDescentSpeedLimit(): SpeedLimit,
getPreSelectedClbSpeed(): Knots,
getPreSelectedCruiseSpeed(): Knots,
getPreSelectedDescentSpeed(): Knots,
getTakeoffFlapsSetting(): FlapConf | undefined
getManagedDescentSpeed(): Knots,
getManagedDescentSpeedMach(): Mach,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export interface VerticalProfileComputationParameters {
flightPhase: FmgcFlightPhase,
preselectedClbSpeed: Knots,
preselectedCruiseSpeed: Knots,
preselectedDescentSpeed: Knots,
takeoffFlapsSetting?: FlapConf
estimatedDestinationFuel: Pounds,

Expand Down Expand Up @@ -106,7 +105,6 @@ export class VerticalProfileComputationParametersObserver {
flightPhase: this.fmgc.getFlightPhase(),
preselectedClbSpeed: this.fmgc.getPreSelectedClbSpeed(),
preselectedCruiseSpeed: this.fmgc.getPreSelectedCruiseSpeed(),
preselectedDescentSpeed: this.fmgc.getPreSelectedDescentSpeed(),
takeoffFlapsSetting: this.fmgc.getTakeoffFlapsSetting(),
estimatedDestinationFuel: UnitType.TONNE.convertTo(this.fmgc.getDestEFOB(false), UnitType.POUND),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,15 @@ export class McduSpeedProfile implements SpeedProfile {
}

getTarget(distanceFromStart: NauticalMiles, altitude: Feet, managedSpeedType: ManagedSpeedType): Knots {
const { fcuSpeed, flightPhase, preselectedClbSpeed, preselectedCruiseSpeed, preselectedDescentSpeed } = this.parameters.get();
const { fcuSpeed, flightPhase, preselectedClbSpeed, preselectedCruiseSpeed } = this.parameters.get();

let preselectedSpeed = -1;
if (flightPhase < FmgcFlightPhase.Climb && preselectedClbSpeed > 100) {
preselectedSpeed = preselectedClbSpeed;
} else if (flightPhase < FmgcFlightPhase.Cruise && preselectedCruiseSpeed > 100) {
preselectedSpeed = preselectedCruiseSpeed;
} else if (flightPhase < FmgcFlightPhase.Descent && preselectedDescentSpeed > 100) {
preselectedSpeed = preselectedDescentSpeed;
}

const hasPreselectedSpeed = preselectedSpeed > 0;

const isPredictingForCurrentPhase = managedSpeedType === ManagedSpeedType.Climb && flightPhase === FmgcFlightPhase.Climb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { MathUtils } from '@flybywiresim/fbw-sdk';
import { VnavConfig } from '@fmgc/guidance/vnav/VnavConfig';

export interface PerfClbToAltPrediction {
export interface PerfToAltPrediction {
altitude: Feet,
distanceFromStart: NauticalMiles,
secondsFromPresent: Seconds,
Expand Down Expand Up @@ -377,23 +377,50 @@ export abstract class BaseGeometryProfile {
this.isReadyToDisplay = true;
}

computePredictionToFcuAltitude(fcuAltitude: Feet): PerfClbToAltPrediction | undefined {
const maxAltitude = this.checkpoints.reduce((currentMax, checkpoint) => Math.max(currentMax, checkpoint.altitude), 0);
computeClimbPredictionToAltitude(altitude: Feet): PerfToAltPrediction | undefined {
const [minAlt, maxAlt] = this.checkpoints.reduce(
([currentMin, currentMax], checkpoint) => [Math.min(currentMin, checkpoint.altitude), Math.max(currentMax, checkpoint.altitude)], [Infinity, -Infinity],
);

if (fcuAltitude < this.checkpoints[0].altitude || fcuAltitude > maxAltitude) {
if (altitude < minAlt || altitude > maxAlt) {
return undefined;
}

const distanceToFcuAltitude = this.interpolateFromCheckpoints(fcuAltitude, (checkpoint) => checkpoint.altitude, (checkpoint) => checkpoint.distanceFromStart);
const distanceToFcuAltitude = this.interpolateFromCheckpoints(altitude, (checkpoint) => checkpoint.altitude, (checkpoint) => checkpoint.distanceFromStart);
const timeToFcuAltitude = this.interpolateTimeAtDistance(distanceToFcuAltitude);

return {
altitude: fcuAltitude,
altitude,
distanceFromStart: distanceToFcuAltitude,
secondsFromPresent: timeToFcuAltitude,
};
}

computeDescentPredictionToAltitude(altitude: Feet): PerfToAltPrediction | undefined {
const [minAlt, maxAlt] = this.checkpoints.reduce(
([currentMin, currentMax], checkpoint) => [Math.min(currentMin, checkpoint.altitude), Math.max(currentMax, checkpoint.altitude)], [Infinity, -Infinity],
);

if (altitude < minAlt || altitude > maxAlt) {
return undefined;
}

const ppos = this.findVerticalCheckpoint(VerticalCheckpointReason.PresentPosition);
if (!ppos) {
return undefined;
}

// TODO: Do this in one call
const distanceToFcuAltitude = this.interpolateFromCheckpointsBackwards(altitude, (checkpoint) => checkpoint.altitude, (checkpoint) => checkpoint.distanceFromStart, true);
const timeToFcuAltitude = this.interpolateFromCheckpointsBackwards(altitude, (checkpoint) => checkpoint.altitude, (checkpoint) => checkpoint.secondsFromPresent, true);

return {
altitude,
distanceFromStart: distanceToFcuAltitude - ppos.distanceFromStart,
secondsFromPresent: timeToFcuAltitude,
};
}

addPresentPositionCheckpoint(presentPosition: LatLongAlt, remainingFuelOnBoard: number, mach: Mach, vman: Knots) {
this.checkpoints.push({
reason: VerticalCheckpointReason.PresentPosition,
Expand Down
5 changes: 4 additions & 1 deletion fbw-a32nx/src/systems/instruments/src/EWD/PseudoFWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,9 @@ export class PseudoFWC {

this.computedAirSpeed.set(Arinc429Word.fromSimVarValue('L:A32NX_ADIRS_ADR_1_COMPUTED_AIRSPEED'));

// needs to happen before dual eng failure check
this.aircraftOnGround.set(SimVar.GetSimVarValue('SIM ON GROUND', 'Bool'));

/* ENGINE AND THROTTLE */

this.engine1State.set(SimVar.GetSimVarValue('L:A32NX_ENGINE_STATE:1', 'Enum'));
Expand Down Expand Up @@ -1021,7 +1024,7 @@ export class PseudoFWC {
// const [right1LandingGear] = useSimVar('L:A32NX_LGCIU_1_RIGHT_GEAR_COMPRESSED', 'bool', 500);
// const aircraftOnGround = left1LandingGear === 1 || right1LandingGear === 1;
// FIXME The landing gear triggers the dual engine failure on loading
this.aircraftOnGround.set(SimVar.GetSimVarValue('SIM ON GROUND', 'Bool'));

this.antiskidActive.set(SimVar.GetSimVarValue('ANTISKID BRAKES ACTIVE', 'bool'));
this.brakeFan.set(SimVar.GetSimVarValue('L:A32NX_BRAKE_FAN', 'bool'));
this.brakesHot.set(SimVar.GetSimVarValue('L:A32NX_BRAKES_HOT', 'bool'));
Expand Down
4 changes: 3 additions & 1 deletion fbw-a32nx/src/systems/instruments/src/ND/ND.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ export class NDComponent extends DisplayComponent<NDProps> {
trueTrackWord={this.trueTrackWord}
rangeValue={this.mapRangeRadius}
isUsingTrackUpMode={this.isUsingTrackUpMode}
index={this.props.side === 'L' ? 1 : 2}
/* Capt ND shows ILS2 */
index={this.props.side === 'L' ? 2 : 1}
/>
<RoseVorPage
bus={this.props.bus}
Expand All @@ -293,6 +294,7 @@ export class NDComponent extends DisplayComponent<NDProps> {
trueTrackWord={this.trueTrackWord}
rangeValue={this.mapRangeRadius}
isUsingTrackUpMode={this.isUsingTrackUpMode}
/* Capt ND shows VOR1 */
index={this.props.side === 'L' ? 1 : 2}
/>
<RoseNavPage
Expand Down
29 changes: 26 additions & 3 deletions fbw-a32nx/src/systems/instruments/src/PFD/FMA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export class FMA extends DisplayComponent<{ bus: ArincEventBus, isAttExcessive:

private tdReached = false;

private checkSpeedMode = false;

private tcasRaInhibited = Subject.create(false);

private trkFpaDeselected = Subject.create(false);
Expand All @@ -74,7 +76,7 @@ export class FMA extends DisplayComponent<{ bus: ArincEventBus, isAttExcessive:
const sharedModeActive = this.activeLateralMode === 32 || this.activeLateralMode === 33
|| this.activeLateralMode === 34 || (this.activeLateralMode === 20 && this.activeVerticalMode === 24);
const BC3Message = getBC3Message(this.props.isAttExcessive.get(), this.armedVerticalModeSub.get(),
this.setHoldSpeed, this.trkFpaDeselected.get(), this.tcasRaInhibited.get(), this.fcdcDiscreteWord1, this.fwcFlightPhase, this.tdReached)[0] !== null;
this.setHoldSpeed, this.trkFpaDeselected.get(), this.tcasRaInhibited.get(), this.fcdcDiscreteWord1, this.fwcFlightPhase, this.tdReached, this.checkSpeedMode)[0] !== null;

const engineMessage = this.athrModeMessage;
const AB3Message = (this.machPreselVal !== -1
Expand Down Expand Up @@ -162,6 +164,11 @@ export class FMA extends DisplayComponent<{ bus: ArincEventBus, isAttExcessive:
this.tdReached = tdr;
this.handleFMABorders();
});

sub.on('checkSpeedMode').whenChanged().handle((csm) => {
this.checkSpeedMode = csm;
this.handleFMABorders();
});
}

render(): VNode {
Expand Down Expand Up @@ -1192,6 +1199,7 @@ const getBC3Message = (
fcdcWord1: Arinc429Word,
fwcFlightPhase: number,
tdReached: boolean,
checkSpeedMode: boolean,
) => {
const armedVerticalBitmask = armedVerticalMode;
const TCASArmed = (armedVerticalBitmask >> 6) & 1;
Expand Down Expand Up @@ -1237,7 +1245,7 @@ const getBC3Message = (
} else if (false) {
text = 'MORE DRAG';
className = 'FontMedium White';
} else if (false) {
} else if (checkSpeedMode && !isAttExcessive) {
text = 'CHECK SPEED MODE';
className = 'FontMedium White';
} else if (false) {
Expand Down Expand Up @@ -1283,9 +1291,19 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable<boolean>,

private tdReached = false;

private checkSpeedMode = false;

private fillBC3Cell() {
const [text, className] = getBC3Message(
this.isAttExcessive, this.armedVerticalMode, this.setHoldSpeed, this.trkFpaDeselected, this.tcasRaInhibited, this.fcdcDiscreteWord1, this.fwcFlightPhase, this.tdReached,
this.isAttExcessive,
this.armedVerticalMode,
this.setHoldSpeed,
this.trkFpaDeselected,
this.tcasRaInhibited,
this.fcdcDiscreteWord1,
this.fwcFlightPhase,
this.tdReached,
this.checkSpeedMode,
);
this.classNameSub.set(`MiddleAlign ${className}`);
if (text !== null) {
Expand Down Expand Up @@ -1338,6 +1356,11 @@ class BC3Cell extends DisplayComponent<{ isAttExcessive: Subscribable<boolean>,
this.tdReached = tdr;
this.fillBC3Cell();
});

sub.on('checkSpeedMode').whenChanged().handle((csm) => {
this.checkSpeedMode = csm;
this.fillBC3Cell();
});
}

render(): VNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export type PFDSimvars = AdirsSimVars & SwitchingPanelVSimVars & {
tdReached: boolean;
trkFpaDeselectedTCAS: boolean;
tcasRaInhibited: boolean;
checkSpeedMode: boolean;
radioAltitude1: number;
radioAltitude2: number;
crzAltMode: boolean;
Expand Down Expand Up @@ -241,6 +242,7 @@ export enum PFDVars {
trkFpaDeselectedTCAS = 'L:A32NX_AUTOPILOT_TCAS_MESSAGE_TRK_FPA_DESELECTION',
tdReached = 'L:A32NX_PFD_MSG_TD_REACHED',
tcasRaInhibited = 'L:A32NX_AUTOPILOT_TCAS_MESSAGE_RA_INHIBITED',
checkSpeedMode = 'L:A32NX_PFD_MSG_CHECK_SPEED_MODE',
radioAltitude1 = 'L:A32NX_RA_1_RADIO_ALTITUDE',
radioAltitude2 = 'L:A32NX_RA_2_RADIO_ALTITUDE',
crzAltMode = 'L:A32NX_FMA_CRUISE_ALT_MODE',
Expand Down Expand Up @@ -400,6 +402,7 @@ export class PFDSimvarPublisher extends UpdatableSimVarPublisher<PFDSimvars> {
['tdReached', { name: PFDVars.tdReached, type: SimVarValueType.Bool }],
['trkFpaDeselectedTCAS', { name: PFDVars.trkFpaDeselectedTCAS, type: SimVarValueType.Bool }],
['tcasRaInhibited', { name: PFDVars.tcasRaInhibited, type: SimVarValueType.Bool }],
['checkSpeedMode', { name: PFDVars.checkSpeedMode, type: SimVarValueType.Bool }],
['radioAltitude1', { name: PFDVars.radioAltitude1, type: SimVarValueType.Number }],
['radioAltitude2', { name: PFDVars.radioAltitude2, type: SimVarValueType.Number }],
['crzAltMode', { name: PFDVars.crzAltMode, type: SimVarValueType.Bool }],
Expand Down

0 comments on commit 9c66508

Please sign in to comment.