Skip to content

Commit

Permalink
fix(autoflight): engage managed speed after v2 confirm (#8395)
Browse files Browse the repository at this point in the history
* fix(autoflight): engage managed speed after v2 confirm

* doc: remove erroneous v2 local var

* fix: avoid unit conversion
  • Loading branch information
tracernz authored Jan 10, 2024
1 parent 4221a22 commit 2420afb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
1. [FLIGHTMODEL/ICE PROT] - Interim fix for A/I system bug and quicker windscreen clearing of ice - @donstim (donbikes)
1. [ND] Worked around a font rendering bug with the ND chrono - @tracernz (Mike)
1. [TELEX] Decrease API poll rate to random number between 45-70 seconds - @auroraisluna (alepouna)
1. [AUTOFLIGHT] Fixed managed speed not engaging when V2 is confirmed after a departure runway change - @tracernz (Mike)

## 0.11.0

Expand Down
4 changes: 0 additions & 4 deletions fbw-a32nx/docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@
- Number
- Flaps config for TakeOff, 1, 2 or 3

- A32NX_SPEEDS_V2
- Number
- TakeOff V2 Speed calculated based on A32NX_VSPEEDS_TO_CONF config

- A32NX_SPEEDS_VLS_APP
- Number
- vls calculated for config full whether A32NX_VSPEEDS_LANDING_CONF3 or not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ class FMCMainDisplay extends BaseAirliners {
this.flightPlanManager.updateCurrentApproach();
const callback = () => {
this.flightPlanManager.createNewFlightPlan();
SimVar.SetSimVarValue("L:AIRLINER_V1_SPEED", "Knots", NaN);
SimVar.SetSimVarValue("L:AIRLINER_V2_SPEED", "Knots", NaN);
SimVar.SetSimVarValue("L:AIRLINER_VR_SPEED", "Knots", NaN);
this.v1Speed = undefined;
this.vRSpeed = undefined;
this.v2Speed = undefined;
const cruiseAlt = Math.floor(this.flightPlanManager.cruisingAltitude / 100);
console.log("FlightPlan Cruise Override. Cruising at FL" + cruiseAlt + " instead of default FL" + this.cruiseFlightLevel);
if (cruiseAlt > 0) {
Expand Down Expand Up @@ -582,10 +582,6 @@ class FMCMainDisplay extends BaseAirliners {
this.unconfirmedVRSpeed = undefined;
this.unconfirmedV2Speed = undefined;
this._toFlexChecked = true;
// Reset SimVars
SimVar.SetSimVarValue("L:AIRLINER_V1_SPEED", "Knots", NaN);
SimVar.SetSimVarValue("L:AIRLINER_V2_SPEED", "Knots", NaN);
SimVar.SetSimVarValue("L:AIRLINER_VR_SPEED", "Knots", NaN);
}

this.arincBusOutputs.forEach((word) => {
Expand Down Expand Up @@ -2920,6 +2916,33 @@ class FMCMainDisplay extends BaseAirliners {
this.arincDiscreteWord3.ssm = Arinc429Word.SignStatusMatrix.NormalOperation;
}

get v1Speed() {
return this._v1Speed;
}

set v1Speed(speed) {
this._v1Speed = speed;
SimVar.SetSimVarValue('L:AIRLINER_V1_SPEED', 'knots', speed ? speed : NaN);
}

get vRSpeed() {
return this._vRSpeed;
}

set vRSpeed(speed) {
this._vRSpeed = speed;
SimVar.SetSimVarValue('L:AIRLINER_VR_SPEED', 'knots', speed ? speed : NaN);
}

get v2Speed() {
return this._v2Speed;
}

set v2Speed(speed) {
this._v2Speed = speed;
SimVar.SetSimVarValue('L:AIRLINER_V2_SPEED', 'knots', speed ? speed : NaN);
}

//Needs PR Merge #3082
trySetV1Speed(s) {
if (s === FMCMainDisplay.clrValue) {
Expand All @@ -2938,7 +2961,6 @@ class FMCMainDisplay extends BaseAirliners {
this.removeMessageFromQueue(NXSystemMessages.checkToData.text);
this.unconfirmedV1Speed = undefined;
this.v1Speed = v;
SimVar.SetSimVarValue("L:AIRLINER_V1_SPEED", "Knots", this.v1Speed);
return true;
}

Expand All @@ -2960,7 +2982,6 @@ class FMCMainDisplay extends BaseAirliners {
this.removeMessageFromQueue(NXSystemMessages.checkToData.text);
this.unconfirmedVRSpeed = undefined;
this.vRSpeed = v;
SimVar.SetSimVarValue("L:AIRLINER_VR_SPEED", "Knots", this.vRSpeed);
return true;
}

Expand All @@ -2982,7 +3003,6 @@ class FMCMainDisplay extends BaseAirliners {
this.removeMessageFromQueue(NXSystemMessages.checkToData.text);
this.unconfirmedV2Speed = undefined;
this.v2Speed = v;
SimVar.SetSimVarValue("L:AIRLINER_V2_SPEED", "Knots", this.v2Speed);
return true;
}

Expand Down Expand Up @@ -4996,7 +5016,7 @@ class FMCMainDisplay extends BaseAirliners {
}

getV2Speed() {
return SimVar.GetSimVarValue("L:AIRLINER_V2_SPEED", "knots");
return this.v2Speed;
}

getTropoPause() {
Expand Down

0 comments on commit 2420afb

Please sign in to comment.