Skip to content

Commit

Permalink
keep AUTOPILOT_OFF event
Browse files Browse the repository at this point in the history
  • Loading branch information
flogross89 committed Jan 3, 2025
1 parent 6bf113d commit ed8aaa4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 27 deletions.
1 change: 1 addition & 0 deletions fbw-a32nx/src/behavior/src/A32NX_Interior_Misc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@
<UseTemplate Name="ASOBO_GT_Push_Button_Held">
<TOOLTIPID>%((L:A32NX_AUTOPILOT_ACTIVE, Bool))%{if}Disc. Autopilot%{else}Take priority%{end}</TOOLTIPID>
<LEFT_SINGLE_CODE>
(&gt;K:AUTOPILOT_OFF)
1 (&gt;L:A32NX_PRIORITY_TAKEOVER:#ID#)
</LEFT_SINGLE_CODE>
<LEFT_LEAVE_CODE>
Expand Down
14 changes: 1 addition & 13 deletions fbw-a32nx/src/systems/systems-host/systems/FWC/PseudoFWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export class PseudoFWC {
public readonly recallButtonInputBuffer = new NXLogicMemoryNode(false);
public readonly aThrDiscInputBuffer = new NXLogicMemoryNode(false);
public readonly apDiscInputBuffer = new NXLogicMemoryNode(false);
public readonly takeoverPbInputBuffer = new NXLogicMemoryNode(false);

/* PSEUDO FWC VARIABLES */
private readonly startupTimer = new DebounceTimer();
Expand Down Expand Up @@ -1264,13 +1263,6 @@ export class PseudoFWC {
this.recallButtonInputBuffer.write(true, false);
}

if (
SimVar.GetSimVarValue('L:A32NX_PRIORITY_TAKEOVER:1', SimVarValueType.Bool) ||
SimVar.GetSimVarValue('L:A32NX_PRIORITY_TAKEOVER:2', SimVarValueType.Bool)
) {
this.takeoverPbInputBuffer.write(true, false);
}

// Enforce cycle time for the logic computation (otherwise pulse nodes would be broken)
if (deltaTime === -1 || _deltaTime === 0) {
return;
Expand All @@ -1285,10 +1277,7 @@ export class PseudoFWC {
this.clr2PulseNode.write(this.clearButtonInputBuffer.read(), deltaTime);
this.rclUpPulseNode.write(this.recallButtonInputBuffer.read(), deltaTime);
this.autoThrustInstinctiveDiscPressed.write(this.aThrDiscInputBuffer.read(), deltaTime);
this.autoPilotInstinctiveDiscPressedPulse.write(
this.apDiscInputBuffer.read() || this.takeoverPbInputBuffer.read(),
deltaTime,
);
this.autoPilotInstinctiveDiscPressedPulse.write(this.apDiscInputBuffer.read(), deltaTime);

// Inputs update
this.flightPhaseEndedPulseNode.write(false, deltaTime);
Expand Down Expand Up @@ -2915,7 +2904,6 @@ export class PseudoFWC {
this.recallButtonInputBuffer.write(false, true);
this.aThrDiscInputBuffer.write(false, true);
this.apDiscInputBuffer.write(false, true);
this.takeoverPbInputBuffer.write(false, true);
this.autoPilotInstinctiveDiscCountSinceLastFwsCycle = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,7 @@ bool FlyByWireInterface::updateFmgc(double sampleTime, int fmgcIndex) {
fmgcs[fmgcIndex].modelInputs.in.sim_data.tailstrike_protection_on = tailstrikeProtectionEnabled;

bool athr_instinctive_disc = simConnectInterface.getSimInputThrottles().ATHR_disconnect || idAutothrustDisconnect->get() == 1;
bool ap_instinctive_disc = simInputAutopilot.AP_disconnect || idCaptPriorityButtonPressed->get() || idFoPriorityButtonPressed->get();
bool ap_instinctive_disc = simInputAutopilot.AP_disconnect;

fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.is_unit_1 = fmgcIndex == 0;
fmgcs[fmgcIndex].modelInputs.in.discrete_inputs.athr_opp_engaged = fmgcsDiscreteOutputs[oppFmgcIndex].athr_own_engaged;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@
<UseTemplate Name="ASOBO_GT_Push_Button_Held">
<TOOLTIPID>%((L:A32NX_AUTOPILOT_ACTIVE, Bool))%{if}Disc. Autopilot%{else}Take priority%{end}</TOOLTIPID>
<LEFT_SINGLE_CODE>
(&gt;K:AUTOPILOT_OFF)
1 (&gt;L:A32NX_PRIORITY_TAKEOVER:#ID#)
</LEFT_SINGLE_CODE>
<LEFT_LEAVE_CODE>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ export class FwsCore {
public readonly clDownInputBuffer = new NXLogicMemoryNode(false);
public readonly aThrDiscInputBuffer = new NXLogicMemoryNode(false);
public readonly apDiscInputBuffer = new NXLogicMemoryNode(false);
public readonly takeoverPbInputBuffer = new NXLogicMemoryNode(false);

/* PSEUDO FWC VARIABLES */

Expand Down Expand Up @@ -1817,13 +1816,6 @@ export class FwsCore {
this.clDownInputBuffer.write(true, false);
}

if (
SimVar.GetSimVarValue('L:A32NX_PRIORITY_TAKEOVER:1', SimVarValueType.Bool) ||
SimVar.GetSimVarValue('L:A32NX_PRIORITY_TAKEOVER:2', SimVarValueType.Bool)
) {
this.takeoverPbInputBuffer.write(true, false);
}

// Enforce cycle time for the logic computation (otherwise pulse nodes would be broken)
if (deltaTime === -1 || _deltaTime === 0) {
return;
Expand All @@ -1847,10 +1839,7 @@ export class FwsCore {
this.clUpPulseNode.write(this.clUpInputBuffer.read(), deltaTime);
this.clDownPulseNode.write(this.clDownInputBuffer.read(), deltaTime);
this.autoThrustInstinctiveDiscPressed.write(this.aThrDiscInputBuffer.read(), deltaTime);
this.autoPilotInstinctiveDiscPressedPulse.write(
this.apDiscInputBuffer.read() || this.takeoverPbInputBuffer.read(),
deltaTime,
);
this.autoPilotInstinctiveDiscPressedPulse.write(this.apDiscInputBuffer.read(), deltaTime);

// Inputs update
this.flightPhaseEndedPulseNode.write(false, deltaTime);
Expand Down Expand Up @@ -4154,7 +4143,6 @@ export class FwsCore {
this.clDownInputBuffer.write(false, true);
this.aThrDiscInputBuffer.write(false, true);
this.apDiscInputBuffer.write(false, true);
this.takeoverPbInputBuffer.write(false, true);
this.autoPilotInstinctiveDiscCountSinceLastFwsCycle = 0;
}

Expand Down

0 comments on commit ed8aaa4

Please sign in to comment.