Skip to content

Commit

Permalink
[OANS] fix flight phase check
Browse files Browse the repository at this point in the history
  • Loading branch information
flogross89 committed Aug 22, 2024
1 parent b0e555e commit d95e46e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class BrakeToVacateUtils<T extends number> {
this.liveStoppingDistance.setConsumer(sub.on('stopBarDistance').whenChanged());
this.radioAltitude1.setConsumer(sub.on('radioAltitude_1').whenChanged());
this.radioAltitude2.setConsumer(sub.on('radioAltitude_2').whenChanged());
this.fmgcFlightPhase.setConsumer(sub.on('fmgcFlightPhase').whenChanged());
this.fwsFlightPhase.setConsumer(sub.on('fwcFlightPhase').whenChanged());
sub
.on('groundSpeed')
.atFrequency(2)
Expand Down Expand Up @@ -162,7 +162,7 @@ export class BrakeToVacateUtils<T extends number> {

private readonly radioAltitude2 = ConsumerSubject.create(null, 0);

private readonly fmgcFlightPhase = ConsumerSubject.create(null, 0);
private readonly fwsFlightPhase = ConsumerSubject.create(null, 0);

selectRunwayFromOans(
runway: string,
Expand All @@ -185,7 +185,6 @@ export class BrakeToVacateUtils<T extends number> {
} else {
this.btvOppositeThresholdPosition = lastEl;
}
console.log('threshold positions:', this.btvThresholdPosition, this.btvOppositeThresholdPosition);

// Derive LDA from geometry (if we take the LDA database value, there might be drawing errors)
const lda = dist1 > dist2 ? dist1 : dist2;
Expand All @@ -207,6 +206,10 @@ export class BrakeToVacateUtils<T extends number> {
}

selectExitFromOans(exit: string, feature: Feature<Geometry, AmdbProperties>) {
if (this.btvRunway.get() == null) {
return;
}

const thrLoc = this.btvThresholdPosition;
const exitLastIndex = feature.geometry.coordinates.length - 1;
const exitLoc1 = feature.geometry.coordinates[0] as Position;
Expand Down Expand Up @@ -270,8 +273,6 @@ export class BrakeToVacateUtils<T extends number> {
this.btvPathGeometry.push(thrLoc);
}

console.log('btv exit position: ', this.btvExitPosition);

this.btvExitDistance.set(exitDistance);
this.btvExit.set(exit);

Expand Down Expand Up @@ -357,8 +358,9 @@ export class BrakeToVacateUtils<T extends number> {

if (
(!ra1.isNormalOperation() && !ra2.isNormalOperation()) ||
(ra1.isNormalOperation() ? ra1.value : ra2.value > 600) ||
this.fmgcFlightPhase.get() !== 5
(ra1.isNormalOperation() ? ra1.value : ra2.value) > 600 ||
this.fwsFlightPhase.get() < 6 ||
this.fwsFlightPhase.get() > 9
) {
this.remaininingDistToRwyEnd.set(-1);
this.remaininingDistToExit.set(-1);
Expand Down
6 changes: 3 additions & 3 deletions fbw-common/src/systems/instruments/src/OANC/BtvPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface BtvData {

radioAltitude_1: number;
radioAltitude_2: number;
fmgcFlightPhase: number;
fwcFlightPhase: number;
}

export enum BtvSimVars {
Expand All @@ -33,7 +33,7 @@ export enum BtvSimVars {
stopBarDistance = 'L:A32NX_OANS_BTV_STOP_BAR_DISTANCE_ESTIMATED',
radioAltitude_1 = 'L:A32NX_RA_1_RADIO_ALTITUDE',
radioAltitude_2 = 'L:A32NX_RA_2_RADIO_ALTITUDE',
fmgcFlightPhase = 'L:A32NX_FMGC_FLIGHT_PHASE',
fwcFlightPhase = 'L:A32NX_FWC_FLIGHT_PHASE',
}

export class BtvSimvarPublisher extends SimVarPublisher<BtvData> {
Expand All @@ -46,7 +46,7 @@ export class BtvSimvarPublisher extends SimVarPublisher<BtvData> {
['stopBarDistance', { name: BtvSimVars.stopBarDistance, type: SimVarValueType.Number }],
['radioAltitude_1', { name: BtvSimVars.radioAltitude_1, type: SimVarValueType.Number }],
['radioAltitude_2', { name: BtvSimVars.radioAltitude_2, type: SimVarValueType.Number }],
['fmgcFlightPhase', { name: BtvSimVars.fmgcFlightPhase, type: SimVarValueType.Enum }],
['fwcFlightPhase', { name: BtvSimVars.fwcFlightPhase, type: SimVarValueType.Enum }],
]);

public constructor(bus: ArincEventBus) {
Expand Down

0 comments on commit d95e46e

Please sign in to comment.