Skip to content

Commit

Permalink
fix: use main gear compression for some onground detections (#7134)
Browse files Browse the repository at this point in the history
Should avoid speedtape showing error state when the nose is being lifted
  • Loading branch information
Saschl authored and aguther committed May 1, 2022
1 parent 73b83c3 commit fcd51ec
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/instruments/src/PFD/AttitudeIndicatorFixed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class SidestickIndicator extends DisplayComponent<{ bus: EventBus }> {

private sideStickY = 0;

private onGround = 0;
private onGround = true;

private crossHairRef = FSComponent.createRef<SVGPathElement>();

Expand All @@ -411,7 +411,7 @@ class SidestickIndicator extends DisplayComponent<{ bus: EventBus }> {
private handleSideStickIndication() {
const oneEngineRunning = this.engOneRunning || this.engTwoRunning;

if (this.onGround === 0 || !oneEngineRunning) {
if (!this.onGround || !oneEngineRunning) {
this.onGroundForVisibility.set('hidden');
} else {
this.onGroundForVisibility.set('visible');
Expand All @@ -424,7 +424,7 @@ class SidestickIndicator extends DisplayComponent<{ bus: EventBus }> {

const sub = this.props.bus.getSubscriber<PFDSimvars>();

sub.on('onGround').whenChanged().handle((g) => {
sub.on('noseGearCompressed').whenChanged().handle((g) => {
this.onGround = g;
this.handleSideStickIndication();
});
Expand Down
17 changes: 14 additions & 3 deletions src/instruments/src/PFD/AttitudeIndicatorHorizon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,11 @@ class SideslipIndicator extends DisplayComponent<SideslipIndicatorProps> {

private slideSlip = FSComponent.createRef<SVGPathElement>();

private onGround = 1;
private onGround = true;

private leftMainGearCompressed = true;

private rightMainGearCompressed = true;

private roll = new Arinc429Word(0);

Expand All @@ -466,8 +470,15 @@ class SideslipIndicator extends DisplayComponent<SideslipIndicatorProps> {

const sub = this.props.bus.getSubscriber<PFDSimvars & Arinc429Values>();

sub.on('onGround').whenChanged().handle((og) => {
this.onGround = og;
sub.on('leftMainGearCompressed').whenChanged().handle((og) => {
this.leftMainGearCompressed = og;
this.onGround = this.rightMainGearCompressed || og;
this.determineSlideSlip();
});

sub.on('rightMainGearCompressed').whenChanged().handle((og) => {
this.rightMainGearCompressed = og;
this.onGround = this.leftMainGearCompressed || og;
this.determineSlideSlip();
});

Expand Down
53 changes: 43 additions & 10 deletions src/instruments/src/PFD/SpeedIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,16 @@ export class AirspeedIndicator extends DisplayComponent<AirspeedIndicatorProps>

private barTimeout= 0;

private onGround = 0;
private onGround = Subject.create(true);

private airSpeed = new Arinc429Word(0);

private vMax = 0;

private leftMainGearCompressed: boolean;

private rightMainGearCompressed: boolean;

private setOutline() {
let airspeedValue: number;
if (this.airSpeed.isFailureWarning() || (this.airSpeed.isNoComputedData() && !this.onGround)) {
Expand Down Expand Up @@ -248,10 +252,19 @@ export class AirspeedIndicator extends DisplayComponent<AirspeedIndicatorProps>
this.vMax = vMax;
});

pf.on('leftMainGearCompressed').whenChanged().handle((g) => {
this.leftMainGearCompressed = g;
this.onGround.set(this.rightMainGearCompressed || g);
});

pf.on('rightMainGearCompressed').whenChanged().handle((g) => {
this.rightMainGearCompressed = g;
this.onGround.set(this.leftMainGearCompressed || g);
});

// showBars replacement
pf.on('onGround').whenChanged().handle((g) => {
this.onGround = g;
if (g === 1) {
this.onGround.sub((g) => {
if (g) {
this.showBarsRef.instance.style.display = 'none';
this.barberPoleRef.instance.style.display = 'none';
clearTimeout(this.barTimeout);
Expand Down Expand Up @@ -423,15 +436,25 @@ export class AirspeedIndicatorOfftape extends DisplayComponent<{ bus: EventBus }

private decelRef = FSComponent.createRef<SVGTextElement>();

private onGround = 0;
private onGround = true;

private leftMainGearCompressed = true;

private rightMainGearCompressed = true;

onAfterRender(node: VNode): void {
super.onAfterRender(node);

const sub = this.props.bus.getSubscriber<PFDSimvars & Arinc429Values>();

sub.on('onGround').whenChanged().handle((g) => {
this.onGround = g;
sub.on('leftMainGearCompressed').whenChanged().handle((g) => {
this.leftMainGearCompressed = g;
this.onGround = this.rightMainGearCompressed || g;
});

sub.on('rightMainGearCompressed').whenChanged().handle((g) => {
this.rightMainGearCompressed = g;
this.onGround = this.leftMainGearCompressed || g;
});

sub.on('speedAr').handle((speed) => {
Expand Down Expand Up @@ -862,7 +885,11 @@ export class MachNumber extends DisplayComponent<{bus: EventBus}> {

private showMach = false;

private onGround = 0;
private onGround = false;

private leftMainGearCompressed = true;

private rightMainGearCompressed = true;

onAfterRender(node: VNode): void {
super.onAfterRender(node);
Expand All @@ -888,8 +915,14 @@ export class MachNumber extends DisplayComponent<{bus: EventBus}> {
}
});

sub.on('onGround').whenChanged().handle((g) => {
this.onGround = g;
sub.on('leftMainGearCompressed').whenChanged().handle((g) => {
this.leftMainGearCompressed = g;
this.onGround = this.rightMainGearCompressed || g;
});

sub.on('rightMainGearCompressed').whenChanged().handle((g) => {
this.rightMainGearCompressed = g;
this.onGround = this.leftMainGearCompressed || g;
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/instruments/src/PFD/instrument.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ class A32NX_PFD extends BaseInstrument {
this.simVarPublisher.subscribe('altitude');
this.simVarPublisher.subscribe('speed');
this.simVarPublisher.subscribe('alphaProt');
this.simVarPublisher.subscribe('onGround');
this.simVarPublisher.subscribe('noseGearCompressed');
this.simVarPublisher.subscribe('leftMainGearCompressed');
this.simVarPublisher.subscribe('rightMainGearCompressed');
this.simVarPublisher.subscribe('activeLateralMode');
this.simVarPublisher.subscribe('activeVerticalMode');
this.simVarPublisher.subscribe('fmaModeReversion');
Expand Down
12 changes: 9 additions & 3 deletions src/instruments/src/PFD/shared/PFDSimvarPublisher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export interface PFDSimvars {
altitude: number;
speed: number;
alphaProt: number;
onGround: number;
noseGearCompressed: boolean;
leftMainGearCompressed: boolean;
rightMainGearCompressed: boolean;
activeLateralMode: number;
activeVerticalMode: number;
fmaModeReversion: boolean;
Expand Down Expand Up @@ -124,7 +126,9 @@ export enum PFDVars {
altitude = 'L:A32NX_ADIRS_ADR_1_ALTITUDE',
speed = 'L:A32NX_ADIRS_ADR_1_COMPUTED_AIRSPEED',
alphaProt = 'L:A32NX_SPEEDS_ALPHA_PROTECTION',
onGround = 'L:A32NX_LGCIU_1_NOSE_GEAR_COMPRESSED',
noseGearCompressed = 'L:A32NX_LGCIU_1_NOSE_GEAR_COMPRESSED',
leftMainGearCompressed = 'L:A32NX_LGCIU_1_LEFT_GEAR_COMPRESSED',
rightMainGearCompressed = 'L:A32NX_LGCIU_1_RIGHT_GEAR_COMPRESSED',
activeLateralMode = 'L:A32NX_FMA_LATERAL_MODE',
activeVerticalMode = 'L:A32NX_FMA_VERTICAL_MODE',
fmaModeReversion = 'L:A32NX_FMA_MODE_REVERSION',
Expand Down Expand Up @@ -238,7 +242,9 @@ export class PFDSimvarPublisher extends SimVarPublisher<PFDSimvars> {
['altitude', { name: PFDVars.altitude, type: SimVarValueType.Number }],
['speed', { name: PFDVars.speed, type: SimVarValueType.Number }],
['alphaProt', { name: PFDVars.alphaProt, type: SimVarValueType.Number }],
['onGround', { name: PFDVars.onGround, type: SimVarValueType.Number }],
['noseGearCompressed', { name: PFDVars.noseGearCompressed, type: SimVarValueType.Bool }],
['leftMainGearCompressed', { name: PFDVars.leftMainGearCompressed, type: SimVarValueType.Bool }],
['rightMainGearCompressed', { name: PFDVars.rightMainGearCompressed, type: SimVarValueType.Bool }],
['activeLateralMode', { name: PFDVars.activeLateralMode, type: SimVarValueType.Number }],
['activeVerticalMode', { name: PFDVars.activeVerticalMode, type: SimVarValueType.Number }],
['fmaModeReversion', { name: PFDVars.fmaModeReversion, type: SimVarValueType.Bool }],
Expand Down

0 comments on commit fcd51ec

Please sign in to comment.