Skip to content

Commit

Permalink
Merge branch 'newGpuLogic' of https://github.com/Maximilian-Reuter/a32nx
Browse files Browse the repository at this point in the history
 into newGpuLogic
  • Loading branch information
Maximilian-Reuter committed Nov 12, 2024
2 parents 65d7994 + 352b1ee commit e004364
Show file tree
Hide file tree
Showing 92 changed files with 1,515 additions and 641 deletions.
10 changes: 10 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
1. [A380X/EWD] QoL: Add soft keys to EWD checklists, can be enabled via EFB - @flogross89 (floridude)
1. [A380X/LIGHTS] Implemented LOGO LT switch funcionality - @ImenesFBW (Imenes)
1. [A380X/SD] Added correct ECP ALL button SD page cycling to the A380X - @frankkopp (Frank Kopp)
1. [A380X/SURV] Fixed BTV setup from F/O side, and ROW issues at G/A with early THR RED - @flogross89 (floridude)
1. [A380/MFD] Limit keyboard inputs to keys present in the KCCU and remap comma to decimal dot - @beheh (Benedict Etzel)
1. [GENERAL] Mitigated issue with pop-ups (i.e. pause on TOD notification) being unable to be dismissed while camera is in freelook + ALT-TAB - @2hwk (2cas)
1. [A380X/AP] Improved support of simulation rate 4x - @aguther (Andreas Guther)
Expand All @@ -31,6 +32,15 @@
1. [A380X/MFD] Fixed DIRECT TO selection of active waypoint does nothing - @sognodelx (Sven Gross)
1. [A380X/MODEL] Optimized 4K textures - @Repsol
1. [A380X/EFB] Moved cabin lighting from ambient light knob to EFB Quick Settings - @2hwk (2cas)
1. [A380X/AFS] Fixed CP V/S knob push levelling off the aircraft when it should have no action - @tracernz (Mike)
1. [A380X/MFD] MFD/SURV: Fixed TCAS not switching status when using DEFAULT SETTINGS button - @flogross89 (floridude)
1. [A380/FUEL] Recalibrated inital fuel settings - @sschiphorst (Yahtzee94)
1. [A380X/ENGINES] Another adjustment to taxi thrust - @donstim (donbikes)
1. [A380/ANIM] Animation of flaps now from FPPU position. Interim fix for spoiler low end animation - @Crocket63 (crocket)
1. [A380X/ENG] Improve oil pressure lookup table - @tracernz (Mike)
1. [A380/WING_FLEX] Reduced stiffness of wings for more tip up bend - @Crocket63 (crocket)
1. [A380X/FWS] Add V1 callout - @flogross89 (floridude)
1. [FMS] Fix existing T-P moving when inserting temporary flight plan - @Benjozork (Benjamin Dupont)
1. [GPU] Improved handling of ground power for more immersive use @Maximilian-Reuter (\_chaoz_)

## 0.12.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2555,11 +2555,16 @@ class FMCMainDisplay extends BaseAirliners {
insertTemporaryFlightPlan(callback = EmptyCallback.Void) {
if (this.flightPlanService.hasTemporary) {
const oldCostIndex = this.costIndex;
const oldDestination = this.currFlightPlanService.active.destinationAirport.ident;
const oldDestination = this.currFlightPlanService.active.destinationAirport
? this.currFlightPlanService.active.destinationAirport.ident
: undefined;
const oldCruiseLevel = this.cruiseLevel;
this.flightPlanService.temporaryInsert();
this.checkCostIndex(oldCostIndex);
this.checkDestination(oldDestination);
// FIXME I don't know if it is actually possible to insert TMPY with no FROM/TO, but we should not crash here, so check this for now
if (oldDestination !== undefined) {
this.checkDestination(oldDestination);
}
this.checkCruiseLevel(oldCruiseLevel);

SimVar.SetSimVarValue("L:FMC_FLIGHT_PLAN_IS_TEMPORARY", "number", 0);
Expand Down
35 changes: 29 additions & 6 deletions fbw-a32nx/src/systems/fmgc/src/flightplanning/FlightPlanService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FlightPlanLeg, FlightPlanLegFlags } from '@fmgc/flightplanning/legs/Fli
import { Fix, NXDataStore, Waypoint } from '@flybywiresim/fbw-sdk';
import { NavigationDatabase } from '@fmgc/NavigationDatabase';
import { Coordinates, Degrees } from 'msfs-geo';
import { EventBus } from '@microsoft/msfs-sdk';
import { BitFlags, EventBus } from '@microsoft/msfs-sdk';
import { FixInfoEntry } from '@fmgc/flightplanning/plans/FixInfo';
import { HoldData } from '@fmgc/flightplanning/data/flightplan';
import { FlightPlanLegDefinition } from '@fmgc/flightplanning/legs/FlightPlanLegDefinition';
Expand Down Expand Up @@ -121,13 +121,36 @@ export class FlightPlanService<P extends FlightPlanPerformanceData = FlightPlanP
temporaryPlan.alternateFlightPlan.pendingAirways.finalize();
}

const fromLeg = temporaryPlan.maybeElementAt(temporaryPlan.activeLegIndex - 1);
const tmpyFromLeg = temporaryPlan.maybeElementAt(temporaryPlan.activeLegIndex - 1);

const directToInTmpy =
tmpyFromLeg?.isDiscontinuity === false && tmpyFromLeg.flags & FlightPlanLegFlags.DirectToTurningPoint;

const directToBeingInserted =
directToInTmpy && BitFlags.isAny(tmpyFromLeg.flags, FlightPlanLegFlags.PendingDirectToTurningPoint);

// Update T-P
if (fromLeg?.isDiscontinuity === false && fromLeg.flags & FlightPlanLegFlags.DirectToTurningPoint) {
// TODO fm pos
fromLeg.definition.waypoint.location.lat = SimVar.GetSimVarValue('PLANE LATITUDE', 'Degrees');
fromLeg.definition.waypoint.location.long = SimVar.GetSimVarValue('PLANE LONGITUDE', 'Degrees');
if (directToBeingInserted) {
temporaryPlan.editLegFlags(
temporaryPlan.activeLegIndex - 1,
(tmpyFromLeg.flags &= ~FlightPlanLegFlags.PendingDirectToTurningPoint),
);

const magneticCourse: number = SimVar.GetSimVarValue('GPS GROUND MAGNETIC TRACK', 'Degrees');
const lat: number = SimVar.GetSimVarValue('PLANE LATITUDE', 'Degrees');
const long: number = SimVar.GetSimVarValue('PLANE LONGITUDE', 'Degrees');

temporaryPlan.editLegDefinition(temporaryPlan.activeLegIndex - 1, {
magneticCourse,
waypoint: {
...tmpyFromLeg.definition.waypoint,
location: {
// TODO fm pos
lat,
long,
},
},
});
}

this.flightPlanManager.copy(FlightPlanIndex.Temporary, FlightPlanIndex.Active, CopyOptions.IncludeFixInfos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { EnrouteSegment } from '@fmgc/flightplanning/segments/EnrouteSegment';
import { HoldData } from '@fmgc/flightplanning/data/flightplan';
import { CruiseStepEntry } from '@fmgc/flightplanning/CruiseStep';
import { WaypointConstraintType, AltitudeConstraint, SpeedConstraint } from '@fmgc/flightplanning/data/constraint';
import { MagVar } from '@microsoft/msfs-sdk';
import { HoldUtils } from '@fmgc/flightplanning/data/hold';
import { OriginSegment } from '@fmgc/flightplanning/segments/OriginSegment';
import { ReadonlyFlightPlanLeg } from '@fmgc/flightplanning/legs/ReadonlyFlightPlanLeg';
Expand All @@ -47,7 +46,8 @@ export interface SerializedFlightPlanLeg {

export enum FlightPlanLegFlags {
DirectToTurningPoint = 1 << 0,
Origin = 1 << 1,
PendingDirectToTurningPoint = 1 << 1,
Origin = 1 << 2,
}

export interface LegCalculations {
Expand Down Expand Up @@ -330,25 +330,6 @@ export class FlightPlanLeg implements ReadonlyFlightPlanLeg {
);
}

static directToTurnStart(segment: EnrouteSegment, location: Coordinates, bearing: DegreesTrue): FlightPlanLeg {
const magVar = MagVar.get(location.lat, location.long);

return new FlightPlanLeg(
segment,
{
procedureIdent: '',
type: LegType.FC,
overfly: false,
waypoint: WaypointFactory.fromPlaceBearingDistance('T-P', location, 0.1, bearing),
magneticCourse: A32NX_Util.trueToMagnetic(bearing, magVar),
length: 0.1,
},
'',
'',
undefined,
);
}

static directToTurnEnd(segment: EnrouteSegment, waypoint: Fix): FlightPlanLeg {
return new FlightPlanLeg(
segment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
PerformanceDataFlightPlanSyncEvents,
SyncFlightPlanEvents,
} from '@fmgc/flightplanning/sync/FlightPlanEvents';
import { EventBus, Publisher, Subscription } from '@microsoft/msfs-sdk';
import { BitFlags, EventBus, Publisher, Subscription } from '@microsoft/msfs-sdk';
import { FlightPlan } from '@fmgc/flightplanning/plans/FlightPlan';
import { AlternateFlightPlan } from '@fmgc/flightplanning/plans/AlternateFlightPlan';
import { FixInfoEntry } from '@fmgc/flightplanning/plans/FixInfo';
Expand Down Expand Up @@ -124,6 +124,24 @@ export abstract class BaseFlightPlan<P extends FlightPlanPerformanceData = Fligh
}),
);

this.subscriptions.push(
subs.on('SYNC_flightPlan.legFlagsEdit').handle((event) => {
if (!this.ignoreSync) {
if (event.planIndex !== this.index || isAlternatePlan !== event.forAlternate) {
return;
}

const element = this.legElementAt(event.atIndex);

element.flags = event.newFlags;

this.incrementVersion();

flightPlanEventsPub.pub('flightPlan.legFlagsEdit', event);
}
}),
);

this.subscriptions.push(
subs.on('SYNC_flightPlan.legDefinitionEdit').handle((event) => {
if (!this.ignoreSync) {
Expand Down Expand Up @@ -452,6 +470,19 @@ export abstract class BaseFlightPlan<P extends FlightPlanPerformanceData = Fligh
this.sendEvent('flightPlan.setSegmentLegs', { planIndex: this.index, forAlternate: false, segmentIndex, legs });
}

syncLegFlagsChange(atIndex: number) {
const leg = this.elementAt(atIndex);

if (leg.isDiscontinuity === false) {
this.sendEvent('flightPlan.legFlagsEdit', {
planIndex: this.index,
atIndex,
forAlternate: this instanceof AlternateFlightPlan,
newFlags: leg.flags,
});
}
}

syncLegDefinitionChange(atIndex: number) {
const leg = this.elementAt(atIndex);

Expand Down Expand Up @@ -1380,6 +1411,16 @@ export abstract class BaseFlightPlan<P extends FlightPlanPerformanceData = Fligh
this.incrementVersion();
}

editLegFlags(index: number, flags: number, notify = true): void {
const leg = this.legElementAt(index);

leg.flags = flags;

if (notify) {
this.syncLegFlagsChange(index);
}
}

editLegDefinition(index: number, changes: Partial<FlightPlanLegDefinition>, notify = true): void {
const leg = this.legElementAt(index);

Expand Down Expand Up @@ -2295,6 +2336,7 @@ export abstract class BaseFlightPlan<P extends FlightPlanPerformanceData = Fligh
continue;
}

// TODO sync
if (element.definition.type === LegType.IF && element.ident !== 'T-P') {
element.type = LegType.TF;
} else {
Expand All @@ -2304,7 +2346,11 @@ export abstract class BaseFlightPlan<P extends FlightPlanPerformanceData = Fligh

// XX -> IF if no element, or discontinuity before, or 0th leg
if (element && element.isDiscontinuity === false && element.type !== LegType.IF) {
if (!prevElement || (prevElement && prevElement.isDiscontinuity === true) || i === 0) {
// T-P legs need to always be CF so they can create a direct-to-fix transition outbound of them
const isLegTurningPoint = BitFlags.isAny(element.flags, FlightPlanLegFlags.DirectToTurningPoint);

// TODO sync
if (!isLegTurningPoint && (!prevElement || (prevElement && prevElement.isDiscontinuity === true) || i === 0)) {
element.type = LegType.IF;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
FlightPlanPerformanceDataProperties,
} from '@fmgc/flightplanning/plans/performance/FlightPlanPerformanceData';
import { BaseFlightPlan, FlightPlanQueuedOperation, SerializedFlightPlan } from './BaseFlightPlan';
import { FlightPlanIndex } from '@fmgc/flightplanning/FlightPlanManager';

export class FlightPlan<P extends FlightPlanPerformanceData = FlightPlanPerformanceData> extends BaseFlightPlan<P> {
static empty<P extends FlightPlanPerformanceData>(
Expand Down Expand Up @@ -148,6 +149,9 @@ export class FlightPlan<P extends FlightPlanPerformanceData = FlightPlanPerforma
const turnEnd = FlightPlanLeg.directToTurnEnd(this.enrouteSegment, targetLeg.terminationWaypoint());

turningPoint.flags |= FlightPlanLegFlags.DirectToTurningPoint;
if (this.index === FlightPlanIndex.Temporary) {
turningPoint.flags |= FlightPlanLegFlags.PendingDirectToTurningPoint;
}
turnEnd.withDefinitionFrom(targetLeg).withPilotEnteredDataFrom(targetLeg);
// If we don't do this, the turn end will have the termination waypoint's ident which may not be the leg ident (for runway legs for example)
turnEnd.ident = targetLeg.ident;
Expand Down Expand Up @@ -186,6 +190,9 @@ export class FlightPlan<P extends FlightPlanPerformanceData = FlightPlanPerforma
const turnEnd = FlightPlanLeg.directToTurnEnd(this.enrouteSegment, waypoint);

turningPoint.flags |= FlightPlanLegFlags.DirectToTurningPoint;
if (this.index === FlightPlanIndex.Temporary) {
turningPoint.flags |= FlightPlanLegFlags.PendingDirectToTurningPoint;
}

// Move all legs before active one to the enroute segment
let indexInEnrouteSegment = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class OriginSegment extends FlightPlanSegment {
}

private resetOriginLegFlag() {
// TODO this needs to be synced
this.allLegs.forEach((leg) => {
if (leg.isDiscontinuity === false) {
leg.flags &= ~FlightPlanLegFlags.Origin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export interface FlightPlanSetSegmentLegsEvent extends FlightPlanEditSyncEvent {
legs: (SerializedFlightPlanLeg | Discontinuity)[];
}

export interface FlightPlanLegFlagsEditEvent extends FlightPlanEditSyncEvent {
atIndex: number;
newFlags: number;
}

export interface FlightPlanLegDefinitionEditEvent extends FlightPlanEditSyncEvent {
atIndex: number;
newDefinition: FlightPlanLegDefinition;
Expand Down Expand Up @@ -81,6 +86,7 @@ export interface FlightPlanEvents {

'flightPlan.setActiveLegIndex': FlightPlanSetActiveLegIndexEvent;
'flightPlan.setSegmentLegs': FlightPlanSetSegmentLegsEvent;
'flightPlan.legFlagsEdit': FlightPlanLegFlagsEditEvent;
'flightPlan.legDefinitionEdit': FlightPlanLegDefinitionEditEvent;
'flightPlan.setLegCruiseStep': FlightPlanLegCruiseStepEditEvent;
'flightPlan.setFixInfoEntry': FlightPlanSetFixInfoEntryEvent;
Expand Down
1 change: 1 addition & 0 deletions fbw-a380x/mach.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = {
typecheckingPlugin(),
],
instruments: [
msfsAvionicsInstrument('AtcMailbox'),
msfsAvionicsInstrument('Clock'),
msfsAvionicsInstrument('EWD'),
msfsAvionicsInstrument('FCU', 'FcuBaseInstrument.ts'),
Expand Down
Loading

0 comments on commit e004364

Please sign in to comment.