From 9c697341d482c5f96d0eb232483a73aeb6ad6cd2 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Mon, 1 Aug 2022 20:52:22 +0200
Subject: [PATCH 01/24] Changed gear lever mechanism
---
.github/CHANGELOG.md | 1 +
.../FlyByWire_A320_NEO/Checklist/Library.xml | 10 ++--
.../model/A320_NEO_INTERIOR.xml | 18 +++++++-
.../FlyByWire_A320_NEO/sound/sound.xml | 4 +-
.../html_ui/Pages/A32NX_Core/A32NX_FWC.js | 2 +-
.../NavSystems/A320_Neo/A32NX_NavSystem.js | 2 +-
src/behavior/src/A32NX_Interior_Misc.xml | 46 -------------------
.../src/EWD/elements/PseudoFWC.tsx | 2 +-
src/systems/a320_systems_wasm/src/gear.rs | 36 ++++++++++++---
9 files changed, 57 insertions(+), 64 deletions(-)
diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md
index 7e1e331234a..0883c8200fd 100644
--- a/.github/CHANGELOG.md
+++ b/.github/CHANGELOG.md
@@ -53,6 +53,7 @@
1. [FMGC] Fix inbound leg time for holds - @tracernz (Mike)
1. [MCDU] Improved visuals of Init-A and Init-B page - @derl30n (Leon)
1. [MODEL] Added new animated gear gravity extension handle- @tyler58546 (tyler58546), @MoreRightRudder (Mike), @Crocket63 (crocket), @Lantarius
+1. [HYD] Custom Lvar for gear lever to fix ground collision bug - @Crocket63 (crocket)
## 0.8.0
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/Checklist/Library.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/Checklist/Library.xml
index 0fcc7777f0a..fea5b3479fc 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/Checklist/Library.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/Checklist/Library.xml
@@ -65,7 +65,7 @@
-
+
@@ -1150,7 +1150,7 @@
-
+
@@ -1641,7 +1641,7 @@
-
+
@@ -1841,7 +1841,7 @@
-
+
@@ -2381,7 +2381,7 @@
-
+
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
index 6a446a23090..1b688fa8e76 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
@@ -805,12 +805,26 @@
%((L:A32NX_BRAKE_FAN_BTN_PRESSED, Bool))%{if}Turn OFF brake fan%{else}Turn ON brake fan%{end}
-
+
+
+
+ lever_landing_gear
+ LEVER_LANDINGGEAR
+ 3
+ 1
+ gearleverclick
+ (L:A32NX_GEAR_HANDLE_POSITION, Bool) ! (>L:A32NX_GEAR_LEVER_POSITION_REQUEST)
+
+ (L:A32NX_GEAR_HANDLE_POSITION, Bool)
+
+
+
PUSH_AUTOBKR_LDGGEAR_1
1
@@ -1745,7 +1759,7 @@
5
- (A:GEAR HANDLE POSITION, Bool) (A:GEAR POSITION, percent) 99.9 > and (>O:_ShouldBeConnectedToPowerGrid)
+ (L:A32NX_GEAR_HANDLE_POSITION, Bool) (A:GEAR POSITION, percent) 99.9 > and (>O:_ShouldBeConnectedToPowerGrid)
(O:_ShouldBeConnectedToPowerGrid) sp0
2 (>A:BUS LOOKUP INDEX, Number)
(A:CIRCUIT CONNECTION ON:17, Bool) l0 != if{ 17 2 (>K:2:ELECTRICAL_BUS_TO_CIRCUIT_CONNECTION_TOGGLE) }
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml
index 827ac6d1380..ee95ba78f82 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml
@@ -642,11 +642,11 @@
-
+
-
+
diff --git a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_FWC.js b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_FWC.js
index 975e444ac03..64d1fcbb8d2 100644
--- a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_FWC.js
+++ b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_FWC.js
@@ -367,7 +367,7 @@ class A32NX_FWC {
// - Glide slope captured
// - Landing locked down
- const landingGearIsDown = SimVar.GetSimVarValue("L:A32NX_FLAPS_HANDLE_INDEX", "Enum") >= 1 && SimVar.GetSimVarValue("GEAR HANDLE POSITION", "Boolean");
+ const landingGearIsDown = SimVar.GetSimVarValue("L:A32NX_FLAPS_HANDLE_INDEX", "Enum") >= 1 && SimVar.GetSimVarValue("L:A32NX_GEAR_HANDLE_POSITION", "Boolean");
const verticalMode = SimVar.GetSimVarValue("L:A32NX_FMA_VERTICAL_MODE", "Number");
const glideSlopeCaptured = verticalMode >= 30 && verticalMode <= 34;
const landingGearIsLockedDown = SimVar.GetSimVarValue("GEAR POSITION:0", "Enum") > 0.9;
diff --git a/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/NavSystems/A320_Neo/A32NX_NavSystem.js b/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/NavSystems/A320_Neo/A32NX_NavSystem.js
index 42526b8137c..bdce248615f 100644
--- a/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/NavSystems/A320_Neo/A32NX_NavSystem.js
+++ b/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/NavSystems/A320_Neo/A32NX_NavSystem.js
@@ -2823,7 +2823,7 @@ class Warnings extends NavSystemElement {
return this.linearMultiPointsEvaluation(this.pullUp_sinkRate_Points, descentRate, height) == 2;
}
landingGearCallback() {
- const gear = !SimVar.GetSimVarValue("IS GEAR RETRACTABLE", "Boolean") || SimVar.GetSimVarValue("GEAR HANDLE POSITION", "Boolean");
+ const gear = !SimVar.GetSimVarValue("IS GEAR RETRACTABLE", "Boolean") || SimVar.GetSimVarValue("L:A32NX_GEAR_HANDLE_POSITION", "Boolean");
const throttle = SimVar.GetSimVarValue("L:A32NX_AUTOTHRUST_TLA:1", "number");
const flaps = SimVar.GetSimVarValue("L:A32NX_FLAPS_HANDLE_INDEX", "number");
return !gear && (flaps > 1 || (throttle == 0));
diff --git a/src/behavior/src/A32NX_Interior_Misc.xml b/src/behavior/src/A32NX_Interior_Misc.xml
index 537af210be5..6ac31832189 100644
--- a/src/behavior/src/A32NX_Interior_Misc.xml
+++ b/src/behavior/src/A32NX_Interior_Misc.xml
@@ -188,52 +188,6 @@
-
-
-
- LANDING_GEAR_Lever_Gear
- LANDING_GEAR_Lever_Gear
- LANDING_GEAR_Lever_Gear
- LANDING_GEAR_Lever_GearLight
- 400
- 10
- @TT_Package.LANDING_GEAR_LEVER_GEAR_TITLE
- gear_lever
- gear_lever_on
- gear_lever_off
- True
-
-
- #TOOLTIP_LANDING_GEAR_TITLE#
- LANDING_GEAR_Gear
- (>B:LANDING_GEAR_Gear_Inc)
- (>B:LANDING_GEAR_Gear_Dec)
-
-
-
-
- (L:A32NX_GEAR_LEVER_LOCKED, Bool) ! if{ #UP_CODE# }
-
-
-
-
-
-
- 1
-
-
- (B:LANDING_GEAR_Gear) 100 *
-
-
-
-
-
-
- #LIGHT_NODE_ID#
-
-
-
-
diff --git a/src/instruments/src/EWD/elements/PseudoFWC.tsx b/src/instruments/src/EWD/elements/PseudoFWC.tsx
index 8f03d03ef1f..e3cd50fead6 100644
--- a/src/instruments/src/EWD/elements/PseudoFWC.tsx
+++ b/src/instruments/src/EWD/elements/PseudoFWC.tsx
@@ -192,7 +192,7 @@ const PseudoFWC: React.FC = () => {
// const aircraftOnGround = left1LandingGear === 1 || right1LandingGear === 1;
// FIXME The landing gear triggers the dual engine failure on loading
const aircraftOnGround = SimVar.GetSimVarValue('SIM ON GROUND', 'Bool');
- const [landingGearLeverDown] = useSimVar('GEAR HANDLE POSITION', 'bool', 500);
+ const [landingGearLeverDown] = useSimVar('L:A32NX_GEAR_HANDLE_POSITION', 'bool', 500);
const [landingLight2Retracted] = useSimVar('L:LANDING_2_Retracted', 'bool', 500);
const [landingLight3Retracted] = useSimVar('L:LANDING_3_Retracted', 'bool', 500);
const [autoBrakesArmedMode] = useSimVar('L:A32NX_AUTOBRAKES_ARMED_MODE', 'enum', 500);
diff --git a/src/systems/a320_systems_wasm/src/gear.rs b/src/systems/a320_systems_wasm/src/gear.rs
index cebf2865ccc..bb02a7254bd 100644
--- a/src/systems/a320_systems_wasm/src/gear.rs
+++ b/src/systems/a320_systems_wasm/src/gear.rs
@@ -4,7 +4,7 @@ use msfs::sim_connect;
use msfs::{sim_connect::SimConnect, sim_connect::SIMCONNECT_OBJECT_ID_USER};
use systems_wasm::aspects::{
- EventToVariableMapping, MsfsAspectBuilder, ObjectWrite, VariableToEventMapping,
+ EventToVariableMapping, ExecuteOn, MsfsAspectBuilder, ObjectWrite, VariableToEventMapping,
VariableToEventWriteOn, VariablesToObject,
};
use systems_wasm::{set_data_on_sim_object, Variable};
@@ -14,7 +14,7 @@ pub(super) fn gear(builder: &mut MsfsAspectBuilder) -> Result<(), Box
let gear_set_set_event_id = builder.event_to_variable(
"GEAR_SET",
EventToVariableMapping::EventDataRaw,
- Variable::aspect("GEAR_LEVER_POSITION_REQUEST"),
+ Variable::named("GEAR_LEVER_POSITION_REQUEST"),
|options| options.mask(),
)?;
@@ -29,27 +29,51 @@ pub(super) fn gear(builder: &mut MsfsAspectBuilder) -> Result<(), Box
}
},
),
- Variable::aspect("GEAR_LEVER_POSITION_REQUEST"),
+ Variable::named("GEAR_LEVER_POSITION_REQUEST"),
|options| options.mask(),
)?;
builder.event_to_variable(
"GEAR_UP",
EventToVariableMapping::Value(0.),
- Variable::aspect("GEAR_LEVER_POSITION_REQUEST"),
+ Variable::named("GEAR_LEVER_POSITION_REQUEST"),
|options| options.mask(),
)?;
builder.event_to_variable(
"GEAR_DOWN",
EventToVariableMapping::Value(1.),
- Variable::aspect("GEAR_LEVER_POSITION_REQUEST"),
+ Variable::named("GEAR_LEVER_POSITION_REQUEST"),
|options| options.mask(),
)?;
// Feedback the gear event to the sim
+ builder.map_many(
+ ExecuteOn::PostTick,
+ vec![
+ Variable::named("GEAR_CENTER_POSITION"),
+ Variable::named("GEAR_LEFT_POSITION"),
+ Variable::named("GEAR_RIGHT_POSITION"),
+ ],
+ |values| {
+ // println!(
+ // "Gears C L R {:.2} {:.2} {:.2} FINAL HANDLE MSFS {:?}",
+ // values[0],
+ // values[1],
+ // values[2],
+ // values[0] > 50. || values[1] > 5. || values[2] > 5.
+ // );
+ if values[0] > 25. || values[1] > 25. || values[2] > 25. {
+ 1.
+ } else {
+ 0.
+ }
+ },
+ Variable::aspect("SIM_FEEDBACK_FINAL_GEAR_HANDLE"),
+ );
+
builder.variable_to_event_id(
- Variable::aspect("GEAR_HANDLE_POSITION"),
+ Variable::aspect("SIM_FEEDBACK_FINAL_GEAR_HANDLE"),
VariableToEventMapping::EventDataRaw,
VariableToEventWriteOn::Change,
gear_set_set_event_id,
From aa623a0cc014aafe03a620e18a0fad3399a5b956 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Mon, 1 Aug 2022 21:18:36 +0200
Subject: [PATCH 02/24] fix animation range
---
.../AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
index 1b688fa8e76..27920823018 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
@@ -820,7 +820,7 @@
gearleverclick
(L:A32NX_GEAR_HANDLE_POSITION, Bool) ! (>L:A32NX_GEAR_LEVER_POSITION_REQUEST)
- (L:A32NX_GEAR_HANDLE_POSITION, Bool)
+ (L:A32NX_GEAR_HANDLE_POSITION, Bool) 3 *
From 7f855de0915d83e91a2ddc3454f0793cf0b34152 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Tue, 2 Aug 2022 10:02:35 +0200
Subject: [PATCH 03/24] Update A320_NEO_INTERIOR.xml
---
.../FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
index 27920823018..3220433e2e0 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
@@ -805,12 +805,6 @@
%((L:A32NX_BRAKE_FAN_BTN_PRESSED, Bool))%{if}Turn OFF brake fan%{else}Turn ON brake fan%{end}
-
lever_landing_gear
@@ -818,7 +812,7 @@
3
1
gearleverclick
- (L:A32NX_GEAR_HANDLE_POSITION, Bool) ! (>L:A32NX_GEAR_LEVER_POSITION_REQUEST)
+ (L:A32NX_GEAR_HANDLE_POSITION, Bool) ! (>L:A32NX_GEAR_LEVER_POSITION_REQUEST)
(L:A32NX_GEAR_HANDLE_POSITION, Bool) 3 *
From 425314e5ad4798347bd992dc8124ffae7c237b16 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Tue, 2 Aug 2022 10:22:10 +0200
Subject: [PATCH 04/24] Update gear.rs
---
src/systems/a320_systems_wasm/src/gear.rs | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/systems/a320_systems_wasm/src/gear.rs b/src/systems/a320_systems_wasm/src/gear.rs
index bb02a7254bd..7fbe416d5b3 100644
--- a/src/systems/a320_systems_wasm/src/gear.rs
+++ b/src/systems/a320_systems_wasm/src/gear.rs
@@ -56,13 +56,6 @@ pub(super) fn gear(builder: &mut MsfsAspectBuilder) -> Result<(), Box
Variable::named("GEAR_RIGHT_POSITION"),
],
|values| {
- // println!(
- // "Gears C L R {:.2} {:.2} {:.2} FINAL HANDLE MSFS {:?}",
- // values[0],
- // values[1],
- // values[2],
- // values[0] > 50. || values[1] > 5. || values[2] > 5.
- // );
if values[0] > 25. || values[1] > 25. || values[2] > 25. {
1.
} else {
From a16ad09616024b4736a7296b8f9ca74b68916db0 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Tue, 2 Aug 2022 11:16:06 +0200
Subject: [PATCH 05/24] testing improved aspect handling with door drag
---
src/systems/a320_systems_wasm/src/gear.rs | 55 +++++++++++------------
1 file changed, 26 insertions(+), 29 deletions(-)
diff --git a/src/systems/a320_systems_wasm/src/gear.rs b/src/systems/a320_systems_wasm/src/gear.rs
index 7fbe416d5b3..295eef895bc 100644
--- a/src/systems/a320_systems_wasm/src/gear.rs
+++ b/src/systems/a320_systems_wasm/src/gear.rs
@@ -11,7 +11,7 @@ use systems_wasm::{set_data_on_sim_object, Variable};
pub(super) fn gear(builder: &mut MsfsAspectBuilder) -> Result<(), Box> {
// Read gear demand from all sim sim events and mask them
- let gear_set_set_event_id = builder.event_to_variable(
+ builder.event_to_variable(
"GEAR_SET",
EventToVariableMapping::EventDataRaw,
Variable::named("GEAR_LEVER_POSITION_REQUEST"),
@@ -47,36 +47,12 @@ pub(super) fn gear(builder: &mut MsfsAspectBuilder) -> Result<(), Box
|options| options.mask(),
)?;
- // Feedback the gear event to the sim
- builder.map_many(
- ExecuteOn::PostTick,
- vec![
- Variable::named("GEAR_CENTER_POSITION"),
- Variable::named("GEAR_LEFT_POSITION"),
- Variable::named("GEAR_RIGHT_POSITION"),
- ],
- |values| {
- if values[0] > 25. || values[1] > 25. || values[2] > 25. {
- 1.
- } else {
- 0.
- }
- },
- Variable::aspect("SIM_FEEDBACK_FINAL_GEAR_HANDLE"),
- );
-
- builder.variable_to_event_id(
- Variable::aspect("SIM_FEEDBACK_FINAL_GEAR_HANDLE"),
- VariableToEventMapping::EventDataRaw,
- VariableToEventWriteOn::Change,
- gear_set_set_event_id,
- );
-
// GEAR POSITION FEEDBACK TO SIM
builder.variables_to_object(Box::new(GearPosition {
nose_position: 1.,
left_position: 1.,
right_position: 1.,
+ gear_handle_position: 1.,
}));
Ok(())
@@ -95,6 +71,10 @@ struct GearPosition {
#[name = "GEAR RIGHT POSITION"]
#[unit = "Percent over 100"]
right_position: f64,
+
+ #[name = "GEAR HANDLE POSITION"]
+ #[unit = "Percent over 100"]
+ gear_handle_position: f64,
}
impl VariablesToObject for GearPosition {
@@ -103,13 +83,30 @@ impl VariablesToObject for GearPosition {
Variable::named("GEAR_CENTER_POSITION"),
Variable::named("GEAR_LEFT_POSITION"),
Variable::named("GEAR_RIGHT_POSITION"),
+ Variable::named("GEAR_DOOR_CENTER_POSITION"),
+ Variable::named("GEAR_DOOR_LEFT_POSITION"),
+ Variable::named("GEAR_DOOR_RIGHT_POSITION"),
]
}
fn write(&mut self, values: Vec) -> ObjectWrite {
- self.nose_position = values[0] / 100.;
- self.left_position = values[1] / 100.;
- self.right_position = values[2] / 100.;
+ const GEAR_POSITION_FOR_FAKE_DOOR_DRAG: f64 = 0.15;
+
+ let gear_deployed = values[0] > 5. || values[1] > 5. || values[2] > 5.;
+ let door_opened = values[3] > 10. || values[4] > 10. || values[5] > 10.;
+
+ // If doors are deployed we fake gear going down a bit to get some door drag effect from the sim
+ if door_opened && !gear_deployed {
+ self.nose_position = (values[3] / 100.).min(GEAR_POSITION_FOR_FAKE_DOOR_DRAG);
+ self.left_position = (values[4] / 100.).min(GEAR_POSITION_FOR_FAKE_DOOR_DRAG);
+ self.right_position = (values[5] / 100.).min(GEAR_POSITION_FOR_FAKE_DOOR_DRAG);
+ } else {
+ self.nose_position = values[0] / 100.;
+ self.left_position = values[1] / 100.;
+ self.right_position = values[2] / 100.;
+ }
+
+ self.gear_handle_position = if gear_deployed { 1. } else { 0. };
ObjectWrite::default()
}
From baabd82ab3d33a4fc97c3511fd40fbca23ae4fc5 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Tue, 2 Aug 2022 11:46:32 +0200
Subject: [PATCH 06/24] less door drag
---
src/systems/a320_systems_wasm/src/gear.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/systems/a320_systems_wasm/src/gear.rs b/src/systems/a320_systems_wasm/src/gear.rs
index 295eef895bc..5e8128cdb69 100644
--- a/src/systems/a320_systems_wasm/src/gear.rs
+++ b/src/systems/a320_systems_wasm/src/gear.rs
@@ -90,7 +90,7 @@ impl VariablesToObject for GearPosition {
}
fn write(&mut self, values: Vec) -> ObjectWrite {
- const GEAR_POSITION_FOR_FAKE_DOOR_DRAG: f64 = 0.15;
+ const GEAR_POSITION_FOR_FAKE_DOOR_DRAG: f64 = 0.10;
let gear_deployed = values[0] > 5. || values[1] > 5. || values[2] > 5.;
let door_opened = values[3] > 10. || values[4] > 10. || values[5] > 10.;
From 963b6efbf1538645e55f4db1a3ca36e0edc19bbb Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Tue, 2 Aug 2022 11:57:17 +0200
Subject: [PATCH 07/24] Update simvar usage for new custom lvars
---
.../AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml | 2 +-
.../html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js | 4 ++--
.../html_ui/Pages/A32NX_Core/A32NX_LocalVarUpdater.js | 2 +-
src/fbw/src/interface/SimConnectInterface.cpp | 1 -
4 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
index 3220433e2e0..b2e49ccfb60 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
@@ -1809,7 +1809,7 @@
- (A:GEAR CENTER POSITION, Percent over 100) 1 == (L:A32NX_PARK_BRAKE_LEVER_POS, bool) 1 == and
+ (L:A32NX_GEAR_CENTER_POSITION, Percent over 100) 1 == (L:A32NX_PARK_BRAKE_LEVER_POS, bool) 1 == and
(L:A32NX_ELEC_DC_GND_FLT_SVC_BUS_IS_POWERED, Bool)
99
diff --git a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js
index 8e8aca62c1a..e852e685e67 100644
--- a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js
+++ b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js
@@ -82,9 +82,9 @@ class A32NX_BrakeTemp {
SimVar.GetSimVarValue("L:A32NX_REPORTED_BRAKE_TEMPERATURE_4", "celsius")
];
}
- const GearLeftPosition = SimVar.GetSimVarValue("GEAR LEFT POSITION", "Percent Over 100");
+ const GearLeftPosition = SimVar.GetSimVarValue("L:A32NX_GEAR_LEFT_POSITION", "Percent Over 100");
const GearLeftExtended = GearLeftPosition >= 0.25;
- const GearRightExtended = SimVar.GetSimVarValue("GEAR RIGHT POSITION", "Percent Over 100") >= 0.25;
+ const GearRightExtended = SimVar.GetSimVarValue("L:A32NX_GEAR_RIGHT_POSITION", "Percent Over 100") >= 0.25;
const currentBrakeFanState = SimVar.GetSimVarValue("L:A32NX_BRAKE_FAN", "Bool");
const brakeFanButtonIsPressed = SimVar.GetSimVarValue("L:A32NX_BRAKE_FAN_BTN_PRESSED", "Bool");
// if the fan button is pressed down and the left main gear is down and locked, the fan is on
diff --git a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_LocalVarUpdater.js b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_LocalVarUpdater.js
index 7be23073f2b..c3386c7ab73 100644
--- a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_LocalVarUpdater.js
+++ b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_LocalVarUpdater.js
@@ -65,7 +65,7 @@ class A32NX_LocalVarUpdater {
}
_noSmokingMemoSelector() {
- const gearPercent = SimVar.GetSimVarValue("GEAR CENTER POSITION", "Percent");
+ const gearPercent = SimVar.GetSimVarValue("L:A32NX_GEAR_CENTER_POSITION", "Percent");
const noSmokingSwitch = SimVar.GetSimVarValue("L:XMLVAR_SWITCH_OVHD_INTLT_NOSMOKING_Position", "Position");
// Switch is ON
diff --git a/src/fbw/src/interface/SimConnectInterface.cpp b/src/fbw/src/interface/SimConnectInterface.cpp
index 045cfdff5be..81771bd91a7 100644
--- a/src/fbw/src/interface/SimConnectInterface.cpp
+++ b/src/fbw/src/interface/SimConnectInterface.cpp
@@ -240,7 +240,6 @@ bool SimConnectInterface::prepareSimDataSimConnectDataDefinitions() {
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "BRAKE LEFT POSITION", "POSITION");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "BRAKE RIGHT POSITION", "POSITION");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "FLAPS HANDLE INDEX", "NUMBER");
- result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "GEAR HANDLE POSITION", "POSITION");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_INT64, "ASSISTANCE TAKEOFF ENABLED", "BOOL");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_INT64, "ASSISTANCE LANDING ENABLED", "BOOL");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_INT64, "AI AUTOTRIM ACTIVE", "BOOL");
From 6bdac0973abb703942237f9451dd681985e8e159 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Wed, 3 Aug 2022 10:03:15 +0200
Subject: [PATCH 08/24] possible random fail test fix
---
src/systems/a320_systems/src/hydraulic/mod.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/systems/a320_systems/src/hydraulic/mod.rs b/src/systems/a320_systems/src/hydraulic/mod.rs
index dbab98bed60..87425aafaab 100644
--- a/src/systems/a320_systems/src/hydraulic/mod.rs
+++ b/src/systems/a320_systems/src/hydraulic/mod.rs
@@ -7533,6 +7533,7 @@ mod tests {
let mut test_bed = test_bed_on_ground_with()
.on_the_ground()
.set_cold_dark_inputs()
+ .with_worst_case_ptu()
.set_park_brake(false)
.start_eng2(Ratio::new::(80.))
.run_one_tick();
From d89ed18db67c2405e2205861035f5e49fbcf791b Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Wed, 3 Aug 2022 11:47:20 +0200
Subject: [PATCH 09/24] less restrictive test
---
src/systems/a320_systems/src/hydraulic/mod.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/systems/a320_systems/src/hydraulic/mod.rs b/src/systems/a320_systems/src/hydraulic/mod.rs
index 87425aafaab..4e13903adba 100644
--- a/src/systems/a320_systems/src/hydraulic/mod.rs
+++ b/src/systems/a320_systems/src/hydraulic/mod.rs
@@ -7546,7 +7546,7 @@ mod tests {
// Yellow pressurised by engine2, green presurised from ptu we expect fault LOW press on EDP1
assert!(test_bed.is_yellow_pressure_switch_pressurised());
- assert!(test_bed.yellow_pressure() > Pressure::new::(2800.));
+ assert!(test_bed.yellow_pressure() > Pressure::new::(2500.));
assert!(test_bed.is_green_pressure_switch_pressurised());
assert!(test_bed.green_pressure() > Pressure::new::(2300.));
assert!(test_bed.is_green_edp_press_low());
From fb5d96f483980f398e98d37ea4d73a4be8f84450 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Wed, 3 Aug 2022 11:47:32 +0200
Subject: [PATCH 10/24] trying new template
---
.../model/A320_NEO_INTERIOR.xml | 8 +---
src/behavior/src/A32NX_Interior_Handling.xml | 39 +++++++++++++++++++
2 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
index b2e49ccfb60..42e549896a4 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
@@ -806,16 +806,10 @@
-
+
lever_landing_gear
LEVER_LANDINGGEAR
3
- 1
- gearleverclick
- (L:A32NX_GEAR_HANDLE_POSITION, Bool) ! (>L:A32NX_GEAR_LEVER_POSITION_REQUEST)
-
- (L:A32NX_GEAR_HANDLE_POSITION, Bool) 3 *
-
diff --git a/src/behavior/src/A32NX_Interior_Handling.xml b/src/behavior/src/A32NX_Interior_Handling.xml
index 59f42599835..a13e229f05e 100644
--- a/src/behavior/src/A32NX_Interior_Handling.xml
+++ b/src/behavior/src/A32NX_Interior_Handling.xml
@@ -542,6 +542,45 @@
+
+
+ TT_Package.LANDING_GEAR_LEVER_GEAR_TITLE
+ LANDING_GEAR_Lever_Gear
+ LANDING_GEAR_Lever_Gear
+ LANDING_GEAR_Lever_Gear
+ 1000
+ gearleverclick
+ 0
+ 100
+ 0.001
+ 0.03
+
+ (L:A32NX_GEAR_HANDLE_POSITION, Bool) ! (>L:A32NX_GEAR_LEVER_POSITION_REQUEST)
+
+
+
+
+
+ (L:A32NX_GEAR_LEVER_POSITION_REQUEST) = ((O:Position, number) / 100 );
+
+
+
+
+
+
+ 3
+ (L:A32NX_GEAR_HANDLE_POSITION, Bool) 3 *
+ #DRAG_CODE#
+ #DRAG_CODE#
+
+
+ if (O:IsDragging, number) == 1 {
+ #DRAG_CODE#;
+ }
+
+
+
+
HANDLING_Indicator_ElevatorTrim
From b1bf1e1816bae6de0369bd991bca92014357fdf2 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 08:34:50 +0200
Subject: [PATCH 11/24] gear lever handled in systems
---
src/systems/systems/src/landing_gear/mod.rs | 141 +++++++++++++++-----
1 file changed, 111 insertions(+), 30 deletions(-)
diff --git a/src/systems/systems/src/landing_gear/mod.rs b/src/systems/systems/src/landing_gear/mod.rs
index b0efca0e120..4789649fc1c 100644
--- a/src/systems/systems/src/landing_gear/mod.rs
+++ b/src/systems/systems/src/landing_gear/mod.rs
@@ -320,10 +320,10 @@ struct LandingGearControlCoordinator {
previous_gear_handle_is_down: bool,
}
impl LandingGearControlCoordinator {
- fn new() -> Self {
+ fn new(context: &mut InitContext) -> Self {
Self {
active_lgciu_id: LgciuId::Lgciu1,
- previous_gear_handle_is_down: true,
+ previous_gear_handle_is_down: context.start_gear_down(),
}
}
@@ -386,7 +386,7 @@ impl LandingGearControlInterfaceUnitSet {
) -> Self {
Self {
gear_handle_baulk_lock_id: context.get_identifier("GEAR_LEVER_LOCKED".to_owned()),
- coordinator: LandingGearControlCoordinator::new(),
+ coordinator: LandingGearControlCoordinator::new(context),
lgcius: [
LandingGearControlInterfaceUnit::new(context, LgciuId::Lgciu1, lgciu1_powered_by),
LandingGearControlInterfaceUnit::new(context, LgciuId::Lgciu2, lgciu2_powered_by),
@@ -428,6 +428,7 @@ impl LandingGearControlInterfaceUnitSet {
);
self.gear_handle_unit.update(
+ context,
&self.lgcius[LgciuId::Lgciu1 as usize],
&self.lgcius[LgciuId::Lgciu2 as usize],
);
@@ -484,10 +485,16 @@ struct LandingGearHandleUnit {
gear_handle_real_position_id: VariableIdentifier,
gear_handle_position_requested_id: VariableIdentifier,
- is_lever_down: bool,
lever_should_lock_down: bool,
+
+ lever_position: Ratio,
+ lever_commanded_down: bool,
}
impl LandingGearHandleUnit {
+ const GEAR_LEVER_SPEED_PERCENT_PER_S: f64 = 100.;
+
+ const GEAR_LEVER_MAX_LOCK_POSITION: f64 = 0.95;
+
fn new(context: &mut InitContext) -> Self {
let init_gear_down = context.start_gear_down();
@@ -496,19 +503,76 @@ impl LandingGearHandleUnit {
gear_handle_position_requested_id: context
.get_identifier("GEAR_LEVER_POSITION_REQUEST".to_owned()),
- is_lever_down: init_gear_down,
lever_should_lock_down: init_gear_down,
+
+ lever_position: if init_gear_down {
+ Ratio::new::(1.)
+ } else {
+ Ratio::new::(0.)
+ },
+
+ lever_commanded_down: init_gear_down,
}
}
- fn update(&mut self, lgciu1: &impl LandingGearHandle, lgciu2: &impl LandingGearHandle) {
+ fn update(
+ &mut self,
+ context: &UpdateContext,
+ lgciu1: &impl LandingGearHandle,
+ lgciu2: &impl LandingGearHandle,
+ ) {
self.lever_should_lock_down =
- lgciu1.gear_handle_baulk_locked() && lgciu2.gear_handle_baulk_locked()
+ lgciu1.gear_handle_baulk_locked() && lgciu2.gear_handle_baulk_locked();
+
+ self.update_position(context);
+ }
+
+ fn update_position(&mut self, context: &UpdateContext) {
+ if self.lever_commanded_down {
+ self.lever_position += Ratio::new::(
+ Self::GEAR_LEVER_SPEED_PERCENT_PER_S * context.delta_as_secs_f64(),
+ );
+
+ println!(
+ "GEAR REQ= {:?} GEAR LOCK = {:?} COULD HIT {:?} GEAR POS= {:.2}",
+ self.lever_commanded_down,
+ self.lever_should_lock_down,
+ false,
+ self.lever_position.get::()
+ );
+ } else {
+ let could_hit_lock_mechanism_after_update = self.lever_position.get::()
+ >= Self::GEAR_LEVER_MAX_LOCK_POSITION
+ && self.lever_should_lock_down;
+
+ self.lever_position -= Ratio::new::(
+ Self::GEAR_LEVER_SPEED_PERCENT_PER_S * context.delta_as_secs_f64(),
+ );
+
+ if could_hit_lock_mechanism_after_update {
+ self.lever_position = self
+ .lever_position
+ .max(Ratio::new::(Self::GEAR_LEVER_MAX_LOCK_POSITION));
+ }
+
+ println!(
+ "GEAR REQ= {:?} GEAR LOCK = {:?} COULD HIT {:?} GEAR POS= {:.2}",
+ self.lever_commanded_down,
+ self.lever_should_lock_down,
+ could_hit_lock_mechanism_after_update,
+ self.lever_position.get::()
+ );
+ }
+
+ self.lever_position = self
+ .lever_position
+ .max(Ratio::new::(0.))
+ .min(Ratio::new::(1.));
}
}
impl LandingGearHandle for LandingGearHandleUnit {
fn gear_handle_is_down(&self) -> bool {
- self.is_lever_down
+ self.lever_position.get::() >= Self::GEAR_LEVER_MAX_LOCK_POSITION
}
fn gear_handle_baulk_locked(&self) -> bool {
@@ -517,16 +581,31 @@ impl LandingGearHandle for LandingGearHandleUnit {
}
impl SimulationElement for LandingGearHandleUnit {
fn read(&mut self, reader: &mut SimulatorReader) {
- let lever_down_raw: bool = reader.read(&self.gear_handle_position_requested_id);
+ // let lever_down_raw: bool = reader.read(&self.gear_handle_position_requested_id);
+
+ // self.is_lever_down = lever_down_raw || (self.lever_should_lock_down && self.is_lever_down);
+
+ let lever_down_req_raw: bool = reader.read(&self.gear_handle_position_requested_id);
+
+ self.lever_commanded_down = lever_down_req_raw;
- self.is_lever_down = lever_down_raw || (self.lever_should_lock_down && self.is_lever_down);
+ // println!(
+ // "read() DOWN REQ = {:?} lever_commanded_down = {:?}",
+ // lever_down_req_raw, self.lever_commanded_down
+ // );
}
fn write(&self, writer: &mut SimulatorWriter) {
- writer.write(&self.gear_handle_real_position_id, self.is_lever_down);
+ writer.write(
+ &self.gear_handle_real_position_id,
+ self.lever_position.get::(),
+ );
// Aligning request on demand so in sim position is always consistent with system state
- writer.write(&self.gear_handle_position_requested_id, self.is_lever_down);
+ // writer.write(
+ // &self.gear_handle_position_requested_id,
+ // self.gear_handle_is_down(),
+ // );
}
}
@@ -1283,21 +1362,25 @@ mod tests {
fn in_flight(mut self) -> Self {
self.set_on_ground(false);
+ self = self.set_gear_handle_up();
self
}
fn on_the_ground(mut self) -> Self {
self.set_on_ground(true);
+ self = self.set_gear_handle_down();
self
}
fn set_gear_handle_up(mut self) -> Self {
self.write_by_name("GEAR_LEVER_POSITION_REQUEST", 0.);
+ self.run_with_delta(Duration::from_millis(1000));
self
}
fn set_gear_handle_down(mut self) -> Self {
self.write_by_name("GEAR_LEVER_POSITION_REQUEST", 1.);
+ self.run_with_delta(Duration::from_millis(1000));
self
}
@@ -1306,7 +1389,10 @@ mod tests {
}
fn is_gear_handle_down(&mut self) -> bool {
- self.read_by_name("GEAR_HANDLE_POSITION")
+ let lever_pos: f64 = self.read_by_name("GEAR_HANDLE_POSITION");
+
+ // println!("TEST REQ ANSWER {:.2}", test);
+ lever_pos >= 0.90
}
fn fail_hyd_pressure(&mut self) {
@@ -1389,25 +1475,15 @@ mod tests {
fn gear_lever_up_and_locked_can_go_down_but_not_up() {
let mut test_bed = test_bed_in_flight_with().in_flight().run_one_tick();
- test_bed = test_bed.set_gear_handle_up().run_one_tick();
-
assert!(!test_bed.is_gear_handle_lock_down_active());
assert!(!test_bed.is_gear_handle_down());
- test_bed = test_bed.on_the_ground().set_gear_handle_up().run_one_tick();
-
- assert!(test_bed.is_gear_handle_lock_down_active());
- assert!(!test_bed.is_gear_handle_down());
-
- test_bed = test_bed
- .on_the_ground()
- .set_gear_handle_down()
- .run_one_tick();
+ test_bed = test_bed.on_the_ground().set_gear_handle_down();
assert!(test_bed.is_gear_handle_lock_down_active());
assert!(test_bed.is_gear_handle_down());
- test_bed = test_bed.on_the_ground().set_gear_handle_up().run_one_tick();
+ test_bed = test_bed.on_the_ground().set_gear_handle_up();
assert!(test_bed.is_gear_handle_lock_down_active());
assert!(test_bed.is_gear_handle_down());
@@ -1420,8 +1496,6 @@ mod tests {
.set_gear_handle_down()
.run_one_tick();
- test_bed = test_bed.run_one_tick();
-
assert!(!test_bed.is_gear_handle_lock_down_active());
assert!(test_bed.is_gear_handle_down());
}
@@ -1435,7 +1509,10 @@ mod tests {
#[test]
fn gear_up_when_lever_up_down_when_lever_down() {
- let mut test_bed = test_bed_in_flight_with().in_flight().set_gear_handle_down();
+ let mut test_bed = test_bed_in_flight_with()
+ .in_flight()
+ .set_gear_handle_down()
+ .run_one_tick();
for _ in 0..2 {
test_bed.run_without_delta();
@@ -1444,7 +1521,7 @@ mod tests {
assert!(test_bed.query(|a| a.lgcius.gear_system_state()) == GearSystemState::AllDownLocked);
println!("GEAR UP!!");
- test_bed = test_bed.set_gear_handle_up();
+ test_bed = test_bed.set_gear_handle_up().run_one_tick();
for _ in 0..30 {
test_bed.run_without_delta();
@@ -1453,7 +1530,8 @@ mod tests {
assert!(test_bed.query(|a| a.lgcius.gear_system_state()) == GearSystemState::AllUpLocked);
// Gear DOWN
- test_bed = test_bed.set_gear_handle_down();
+ test_bed = test_bed.set_gear_handle_down().run_one_tick();
+
for _ in 0..30 {
test_bed.run_without_delta();
}
@@ -1471,12 +1549,15 @@ mod tests {
assert!(test_bed.query(|a| a.lgcius.active_lgciu_id()) == LgciuId::Lgciu1);
test_bed = test_bed.set_gear_handle_up().run_one_tick();
+
assert!(test_bed.query(|a| a.lgcius.active_lgciu_id()) == LgciuId::Lgciu2);
test_bed = test_bed.set_gear_handle_down().run_one_tick();
+
assert!(test_bed.query(|a| a.lgcius.active_lgciu_id()) == LgciuId::Lgciu2);
test_bed = test_bed.set_gear_handle_up().run_one_tick();
+
assert!(test_bed.query(|a| a.lgcius.active_lgciu_id()) == LgciuId::Lgciu1);
}
From 7a99dfd5c23d9f48fd520c693ea36318f6e43058 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 08:35:02 +0200
Subject: [PATCH 12/24] flt init
---
.../SimObjects/AirPlanes/FlyByWire_A320_NEO/Climb.flt | 1 +
.../SimObjects/AirPlanes/FlyByWire_A320_NEO/approach.FLT | 1 +
.../SimObjects/AirPlanes/FlyByWire_A320_NEO/apron.FLT | 1 +
.../SimObjects/AirPlanes/FlyByWire_A320_NEO/cruise.FLT | 1 +
.../SimObjects/AirPlanes/FlyByWire_A320_NEO/final.FLT | 1 +
.../SimObjects/AirPlanes/FlyByWire_A320_NEO/hangar.flt | 1 +
.../SimObjects/AirPlanes/FlyByWire_A320_NEO/runway.FLT | 1 +
.../SimObjects/AirPlanes/FlyByWire_A320_NEO/taxi.flt | 1 +
8 files changed, 8 insertions(+)
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/Climb.flt b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/Climb.flt
index fcba78061fd..db8f8a0d8cf 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/Climb.flt
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/Climb.flt
@@ -153,6 +153,7 @@ A32NX_SEC_2_PUSHBUTTON_PRESSED=1
A32NX_SEC_3_PUSHBUTTON_PRESSED=1
A32NX_FAC_1_PUSHBUTTON_PRESSED=1
A32NX_FAC_2_PUSHBUTTON_PRESSED=1
+A32NX_GEAR_LEVER_POSITION_REQUEST = 0
[Gauges.0]
KollsmanSetting=29.921342849731445313
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/approach.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/approach.FLT
index d427ec43102..79c59a385ac 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/approach.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/approach.FLT
@@ -264,6 +264,7 @@ A32NX_OVHD_PRESS_MODE_SEL_PB_IS_AUTO = 1
A32NX_OVHD_PRESS_MAN_VS_CTL_SWITCH = 1
A32NX_TRANSPONDER_MODE = 1
A32NX_SWITCH_ATC_ALT = 1
+A32NX_GEAR_LEVER_POSITION_REQUEST = 0
[Gauges.0]
KollsmanSetting=29.921342849731445313
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/apron.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/apron.FLT
index 6887dcdf667..d19ef1cb9e1 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/apron.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/apron.FLT
@@ -272,6 +272,7 @@ A32NX_SWITCH_ATC_ALT = 1
A32NX_GEAR_CENTER_POSITION = 100
A32NX_GEAR_LEFT_POSITION = 100
A32NX_GEAR_RIGHT_POSITION = 100
+A32NX_GEAR_LEVER_POSITION_REQUEST = 1
[Gauges.0]
KollsmanSetting=29.921342849731445313
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/cruise.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/cruise.FLT
index 684182ff2f5..20127bdb3d2 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/cruise.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/cruise.FLT
@@ -264,6 +264,7 @@ A32NX_OVHD_PRESS_MODE_SEL_PB_IS_AUTO = 1
A32NX_OVHD_PRESS_MAN_VS_CTL_SWITCH = 1
A32NX_TRANSPONDER_MODE = 1
A32NX_SWITCH_ATC_ALT = 1
+A32NX_GEAR_LEVER_POSITION_REQUEST = 0
[Gauges.0]
KollsmanSetting=29.921342849731445313
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/final.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/final.FLT
index 7381cdba7d2..6fd82ea5fe1 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/final.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/final.FLT
@@ -266,6 +266,7 @@ A32NX_SWITCH_ATC_ALT = 1
A32NX_GEAR_CENTER_POSITION = 100
A32NX_GEAR_LEFT_POSITION = 100
A32NX_GEAR_RIGHT_POSITION = 100
+A32NX_GEAR_LEVER_POSITION_REQUEST = 1
[Gauges.0]
KollsmanSetting=29.921342849731445313
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/hangar.flt b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/hangar.flt
index 95c1f41f7d7..47cf0077888 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/hangar.flt
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/hangar.flt
@@ -246,6 +246,7 @@ XMLVAR_A320_WeatherRadar_Sys=1
A32NX_GEAR_CENTER_POSITION = 100
A32NX_GEAR_LEFT_POSITION = 100
A32NX_GEAR_RIGHT_POSITION = 100
+A32NX_GEAR_LEVER_POSITION_REQUEST = 1
[Gauges.0]
KollsmanSetting=29.921342849731445313
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/runway.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/runway.FLT
index cd993124da1..77863930792 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/runway.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/runway.FLT
@@ -274,6 +274,7 @@ A32NX_SWITCH_ATC_ALT = 1
A32NX_GEAR_CENTER_POSITION = 100
A32NX_GEAR_LEFT_POSITION = 100
A32NX_GEAR_RIGHT_POSITION = 100
+A32NX_GEAR_LEVER_POSITION_REQUEST = 1
[Gauges.0]
KollsmanSetting=29.921342849731445313
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/taxi.flt b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/taxi.flt
index cc5788288a6..76bf3570d5e 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/taxi.flt
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/taxi.flt
@@ -257,6 +257,7 @@ A32NX_SWITCH_ATC_ALT = 1
A32NX_GEAR_CENTER_POSITION = 100
A32NX_GEAR_LEFT_POSITION = 100
A32NX_GEAR_RIGHT_POSITION = 100
+A32NX_GEAR_LEVER_POSITION_REQUEST = 1
[Gauges.0]
KollsmanSetting=29.921342849731445313
From 6779238a8131eb497d85f07a318ec737f886d977 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 08:35:11 +0200
Subject: [PATCH 13/24] anim test
---
.../model/A320_NEO_INTERIOR.xml | 23 ++++++++++++++-----
src/behavior/src/A32NX_Interior_Handling.xml | 2 +-
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
index feb2cdaa0dd..0d508465dcc 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
@@ -846,12 +846,23 @@
-
- lever_landing_gear
- LEVER_LANDINGGEAR
- 3
-
-
+
+
+ lever_landing_gear
+ LEVER_LANDINGGEAR
+
+ (L:A32NX_GEAR_HANDLE_POSITION, Percent) 3 *
+
+ 3
+
+ (L:A32NX_GEAR_HANDLE_POSITION, Number) 0.95 > if{
+ (>K:GEAR_UP)
+ } els{
+ (>K:GEAR_DOWN)
+ }
+
+
+
PUSH_AUTOBKR_LDGGEAR_1
diff --git a/src/behavior/src/A32NX_Interior_Handling.xml b/src/behavior/src/A32NX_Interior_Handling.xml
index a13e229f05e..a931a5c0d4f 100644
--- a/src/behavior/src/A32NX_Interior_Handling.xml
+++ b/src/behavior/src/A32NX_Interior_Handling.xml
@@ -569,7 +569,7 @@
3
- (L:A32NX_GEAR_HANDLE_POSITION, Bool) 3 *
+ (L:A32NX_GEAR_HANDLE_POSITION, Percent)
#DRAG_CODE#
#DRAG_CODE#
From 4979cc437e448693e4d483f2968ca5eebdeeedf8 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 10:44:54 +0200
Subject: [PATCH 14/24] working anim interaction
---
.../model/A320_NEO_INTERIOR.xml | 23 +++--------
src/behavior/src/A32NX_Interior_Handling.xml | 39 ++++++++++---------
2 files changed, 26 insertions(+), 36 deletions(-)
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
index 0d508465dcc..6f84057db21 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
@@ -845,24 +845,11 @@
%((L:A32NX_BRAKE_FAN_BTN_PRESSED, Bool))%{if}Turn OFF brake fan%{else}Turn ON brake fan%{end}
-
-
-
- lever_landing_gear
- LEVER_LANDINGGEAR
-
- (L:A32NX_GEAR_HANDLE_POSITION, Percent) 3 *
-
- 3
-
- (L:A32NX_GEAR_HANDLE_POSITION, Number) 0.95 > if{
- (>K:GEAR_UP)
- } els{
- (>K:GEAR_DOWN)
- }
-
-
-
+
+ lever_landing_gear
+ LEVER_LANDINGGEAR
+ 3
+
PUSH_AUTOBKR_LDGGEAR_1
diff --git a/src/behavior/src/A32NX_Interior_Handling.xml b/src/behavior/src/A32NX_Interior_Handling.xml
index a931a5c0d4f..ad341244dbe 100644
--- a/src/behavior/src/A32NX_Interior_Handling.xml
+++ b/src/behavior/src/A32NX_Interior_Handling.xml
@@ -542,45 +542,48 @@
-
+
TT_Package.LANDING_GEAR_LEVER_GEAR_TITLE
- LANDING_GEAR_Lever_Gear
- LANDING_GEAR_Lever_Gear
- LANDING_GEAR_Lever_Gear
- 1000
+ lever_landing_gear
+ LEVER_LANDINGGEAR
+ LEVER_LANDINGGEAR
+ 0
gearleverclick
0
100
0.001
0.03
- (L:A32NX_GEAR_HANDLE_POSITION, Bool) ! (>L:A32NX_GEAR_LEVER_POSITION_REQUEST)
+ (L:A32NX_GEAR_HANDLE_POSITION, Number) 0.95 > if{
+ (>K:GEAR_UP)
+ } els{
+ (>K:GEAR_DOWN)
+ }
-
+ (L:A32NX_GEAR_LEVER_LOCKED, Boolean) 1 == if{
+ (>K:GEAR_DOWN)
+ }
-
- (L:A32NX_GEAR_LEVER_POSITION_REQUEST) = ((O:Position, number) / 100 );
+
+
-
3
- (L:A32NX_GEAR_HANDLE_POSITION, Percent)
- #DRAG_CODE#
- #DRAG_CODE#
+
+ (L:A32NX_GEAR_HANDLE_POSITION, Percent) 3 *
+
+ (>K:GEAR_UP)
+ (>K:GEAR_DOWN)
-
- if (O:IsDragging, number) == 1 {
- #DRAG_CODE#;
- }
-
+
HANDLING_Indicator_ElevatorTrim
From 56e950a19cce45fa9371e381aaca39488e1ca5b8 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 13:21:23 +0200
Subject: [PATCH 15/24] clean up
---
src/systems/systems/src/landing_gear/mod.rs | 40 +++------------------
1 file changed, 4 insertions(+), 36 deletions(-)
diff --git a/src/systems/systems/src/landing_gear/mod.rs b/src/systems/systems/src/landing_gear/mod.rs
index 4789649fc1c..8774f1e5c05 100644
--- a/src/systems/systems/src/landing_gear/mod.rs
+++ b/src/systems/systems/src/landing_gear/mod.rs
@@ -491,10 +491,12 @@ struct LandingGearHandleUnit {
lever_commanded_down: bool,
}
impl LandingGearHandleUnit {
- const GEAR_LEVER_SPEED_PERCENT_PER_S: f64 = 100.;
+ const GEAR_LEVER_SPEED_PERCENT_PER_S: f64 = 180.;
const GEAR_LEVER_MAX_LOCK_POSITION: f64 = 0.95;
+ const GEAR_LEVER_UP_DOWN_DETECTION_POSITION: f64 = 0.5;
+
fn new(context: &mut InitContext) -> Self {
let init_gear_down = context.start_gear_down();
@@ -532,14 +534,6 @@ impl LandingGearHandleUnit {
self.lever_position += Ratio::new::(
Self::GEAR_LEVER_SPEED_PERCENT_PER_S * context.delta_as_secs_f64(),
);
-
- println!(
- "GEAR REQ= {:?} GEAR LOCK = {:?} COULD HIT {:?} GEAR POS= {:.2}",
- self.lever_commanded_down,
- self.lever_should_lock_down,
- false,
- self.lever_position.get::()
- );
} else {
let could_hit_lock_mechanism_after_update = self.lever_position.get::()
>= Self::GEAR_LEVER_MAX_LOCK_POSITION
@@ -554,14 +548,6 @@ impl LandingGearHandleUnit {
.lever_position
.max(Ratio::new::(Self::GEAR_LEVER_MAX_LOCK_POSITION));
}
-
- println!(
- "GEAR REQ= {:?} GEAR LOCK = {:?} COULD HIT {:?} GEAR POS= {:.2}",
- self.lever_commanded_down,
- self.lever_should_lock_down,
- could_hit_lock_mechanism_after_update,
- self.lever_position.get::()
- );
}
self.lever_position = self
@@ -572,7 +558,7 @@ impl LandingGearHandleUnit {
}
impl LandingGearHandle for LandingGearHandleUnit {
fn gear_handle_is_down(&self) -> bool {
- self.lever_position.get::() >= Self::GEAR_LEVER_MAX_LOCK_POSITION
+ self.lever_position.get::() >= Self::GEAR_LEVER_UP_DOWN_DETECTION_POSITION
}
fn gear_handle_baulk_locked(&self) -> bool {
@@ -581,18 +567,8 @@ impl LandingGearHandle for LandingGearHandleUnit {
}
impl SimulationElement for LandingGearHandleUnit {
fn read(&mut self, reader: &mut SimulatorReader) {
- // let lever_down_raw: bool = reader.read(&self.gear_handle_position_requested_id);
-
- // self.is_lever_down = lever_down_raw || (self.lever_should_lock_down && self.is_lever_down);
-
let lever_down_req_raw: bool = reader.read(&self.gear_handle_position_requested_id);
-
self.lever_commanded_down = lever_down_req_raw;
-
- // println!(
- // "read() DOWN REQ = {:?} lever_commanded_down = {:?}",
- // lever_down_req_raw, self.lever_commanded_down
- // );
}
fn write(&self, writer: &mut SimulatorWriter) {
@@ -600,12 +576,6 @@ impl SimulationElement for LandingGearHandleUnit {
&self.gear_handle_real_position_id,
self.lever_position.get::(),
);
-
- // Aligning request on demand so in sim position is always consistent with system state
- // writer.write(
- // &self.gear_handle_position_requested_id,
- // self.gear_handle_is_down(),
- // );
}
}
@@ -1390,8 +1360,6 @@ mod tests {
fn is_gear_handle_down(&mut self) -> bool {
let lever_pos: f64 = self.read_by_name("GEAR_HANDLE_POSITION");
-
- // println!("TEST REQ ANSWER {:.2}", test);
lever_pos >= 0.90
}
From 2b953583e634eb2049e672ba4ed479ddcaaf9605 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 13:21:37 +0200
Subject: [PATCH 16/24] restore fbw original var for now
---
src/fbw/src/interface/SimConnectInterface.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/fbw/src/interface/SimConnectInterface.cpp b/src/fbw/src/interface/SimConnectInterface.cpp
index 38114bd6727..ff03bffd593 100644
--- a/src/fbw/src/interface/SimConnectInterface.cpp
+++ b/src/fbw/src/interface/SimConnectInterface.cpp
@@ -242,6 +242,7 @@ bool SimConnectInterface::prepareSimDataSimConnectDataDefinitions() {
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "BRAKE LEFT POSITION", "POSITION");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "BRAKE RIGHT POSITION", "POSITION");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "FLAPS HANDLE INDEX", "NUMBER");
+ result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "GEAR HANDLE POSITION", "POSITION");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_INT64, "ASSISTANCE TAKEOFF ENABLED", "BOOL");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_INT64, "ASSISTANCE LANDING ENABLED", "BOOL");
result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_INT64, "AI AUTOTRIM ACTIVE", "BOOL");
From fcde2113171d7109c444b9001c084822108343be Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 13:21:46 +0200
Subject: [PATCH 17/24] fix nose light
---
.../AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
index 6f84057db21..fccb921c6c8 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
@@ -1779,7 +1779,7 @@
5
- (L:A32NX_GEAR_HANDLE_POSITION, Bool) (A:GEAR POSITION, percent) 99.9 > and (>O:_ShouldBeConnectedToPowerGrid)
+ (L:A32NX_LGCIU_2_NOSE_GEAR_DOWNLOCKED, Bool) 1 == (>O:_ShouldBeConnectedToPowerGrid)
(O:_ShouldBeConnectedToPowerGrid) sp0
2 (>A:BUS LOOKUP INDEX, Number)
(A:CIRCUIT CONNECTION ON:17, Bool) l0 != if{ 17 2 (>K:2:ELECTRICAL_BUS_TO_CIRCUIT_CONNECTION_TOGGLE) }
From 0cee252e19527e90922d1cb572182e124f792c54 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 13:29:00 +0200
Subject: [PATCH 18/24] Update a320-simvars.md
---
docs/a320-simvars.md | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/docs/a320-simvars.md b/docs/a320-simvars.md
index 224c98e63e4..42012816b99 100644
--- a/docs/a320-simvars.md
+++ b/docs/a320-simvars.md
@@ -3136,6 +3136,14 @@ In the variables below, {number} should be replaced with one item in the set: {
- Indicates the position of the gear emergency extension crank handle from 0 to 300 (3 turns)
- Percent
+- A32NX_GEAR_LEVER_POSITION_REQUEST
+ - Indicates that the pilot tries to move the gear lever (1=down)
+ - Boolean
+
+- A32NX_GEAR_HANDLE_POSITION
+ - Indicates the actual position of the gear handle
+ - Percent over 100
+
## ATC (ATA 34)
- A32NX_TRANSPONDER_MODE
From 61119768b491ae38bec4428a9002a5674e92f0c7 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 13:38:08 +0200
Subject: [PATCH 19/24] update non boolean variable check
---
.../html_ui/Pages/A32NX_Core/A32NX_FWC.js | 2 +-
.../VCockpit/Instruments/NavSystems/A320_Neo/A32NX_NavSystem.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_FWC.js b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_FWC.js
index 64d1fcbb8d2..ddb8b2fe63a 100644
--- a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_FWC.js
+++ b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_FWC.js
@@ -367,7 +367,7 @@ class A32NX_FWC {
// - Glide slope captured
// - Landing locked down
- const landingGearIsDown = SimVar.GetSimVarValue("L:A32NX_FLAPS_HANDLE_INDEX", "Enum") >= 1 && SimVar.GetSimVarValue("L:A32NX_GEAR_HANDLE_POSITION", "Boolean");
+ const landingGearIsDown = SimVar.GetSimVarValue("L:A32NX_FLAPS_HANDLE_INDEX", "Enum") >= 1 && SimVar.GetSimVarValue("L:A32NX_GEAR_HANDLE_POSITION", "Percent over 100") > 0.5;
const verticalMode = SimVar.GetSimVarValue("L:A32NX_FMA_VERTICAL_MODE", "Number");
const glideSlopeCaptured = verticalMode >= 30 && verticalMode <= 34;
const landingGearIsLockedDown = SimVar.GetSimVarValue("GEAR POSITION:0", "Enum") > 0.9;
diff --git a/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/NavSystems/A320_Neo/A32NX_NavSystem.js b/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/NavSystems/A320_Neo/A32NX_NavSystem.js
index 7b868a66bf8..73e07f550a5 100644
--- a/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/NavSystems/A320_Neo/A32NX_NavSystem.js
+++ b/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/NavSystems/A320_Neo/A32NX_NavSystem.js
@@ -2824,7 +2824,7 @@ class Warnings extends NavSystemElement {
return this.linearMultiPointsEvaluation(this.pullUp_sinkRate_Points, descentRate, height) == 2;
}
landingGearCallback() {
- const gear = !SimVar.GetSimVarValue("IS GEAR RETRACTABLE", "Boolean") || SimVar.GetSimVarValue("L:A32NX_GEAR_HANDLE_POSITION", "Boolean");
+ const gear = !SimVar.GetSimVarValue("IS GEAR RETRACTABLE", "Boolean") || SimVar.GetSimVarValue("L:A32NX_GEAR_HANDLE_POSITION", "Percent over 100") > 0.5;
const throttle = SimVar.GetSimVarValue("L:A32NX_AUTOTHRUST_TLA:1", "number");
const flaps = SimVar.GetSimVarValue("L:A32NX_FLAPS_HANDLE_INDEX", "number");
return !gear && (flaps > 1 || (throttle == 0));
From 5562445e69e86125dae9ceabb75d92f85410379d Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Thu, 13 Oct 2022 17:06:53 +0200
Subject: [PATCH 20/24] Update A32NX_Interior_Handling.xml
---
src/behavior/src/A32NX_Interior_Handling.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/behavior/src/A32NX_Interior_Handling.xml b/src/behavior/src/A32NX_Interior_Handling.xml
index ad341244dbe..5cf3de5a9a5 100644
--- a/src/behavior/src/A32NX_Interior_Handling.xml
+++ b/src/behavior/src/A32NX_Interior_Handling.xml
@@ -549,7 +549,9 @@
LEVER_LANDINGGEAR
LEVER_LANDINGGEAR
0
- gearleverclick
+ gear_lever
+ gear_lever_on
+ gear_lever_off
0
100
0.001
From 3c2e7c06a48147bb53fa2ce52da6c9956b899aef Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Fri, 21 Oct 2022 08:47:14 +0200
Subject: [PATCH 21/24] added sound lvar for locked gear lever
---
docs/a320-simvars.md | 4 ++
src/behavior/src/A32NX_Interior_Handling.xml | 3 --
src/systems/systems/src/landing_gear/mod.rs | 42 ++++++++++++++++++++
3 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/docs/a320-simvars.md b/docs/a320-simvars.md
index 42012816b99..736b4a8dd9c 100644
--- a/docs/a320-simvars.md
+++ b/docs/a320-simvars.md
@@ -3144,6 +3144,10 @@ In the variables below, {number} should be replaced with one item in the set: {
- Indicates the actual position of the gear handle
- Percent over 100
+- A32NX_GEAR_HANDLE_HITS_LOCK_SOUND
+ - Indicates that gear lever just hit the baulk lock mechanism
+ - Boolean
+
## ATC (ATA 34)
- A32NX_TRANSPONDER_MODE
diff --git a/src/behavior/src/A32NX_Interior_Handling.xml b/src/behavior/src/A32NX_Interior_Handling.xml
index 5cf3de5a9a5..004d54bf8ea 100644
--- a/src/behavior/src/A32NX_Interior_Handling.xml
+++ b/src/behavior/src/A32NX_Interior_Handling.xml
@@ -549,9 +549,6 @@
LEVER_LANDINGGEAR
LEVER_LANDINGGEAR
0
- gear_lever
- gear_lever_on
- gear_lever_off
0
100
0.001
diff --git a/src/systems/systems/src/landing_gear/mod.rs b/src/systems/systems/src/landing_gear/mod.rs
index 8774f1e5c05..e60be2e7aa4 100644
--- a/src/systems/systems/src/landing_gear/mod.rs
+++ b/src/systems/systems/src/landing_gear/mod.rs
@@ -484,11 +484,14 @@ impl LandingGearHandle for LandingGearControlInterfaceUnitSet {
struct LandingGearHandleUnit {
gear_handle_real_position_id: VariableIdentifier,
gear_handle_position_requested_id: VariableIdentifier,
+ gear_handle_hits_lock_sound_id: VariableIdentifier,
lever_should_lock_down: bool,
lever_position: Ratio,
lever_commanded_down: bool,
+
+ lever_just_hit_lock_sound: bool,
}
impl LandingGearHandleUnit {
const GEAR_LEVER_SPEED_PERCENT_PER_S: f64 = 180.;
@@ -504,6 +507,8 @@ impl LandingGearHandleUnit {
gear_handle_real_position_id: context.get_identifier("GEAR_HANDLE_POSITION".to_owned()),
gear_handle_position_requested_id: context
.get_identifier("GEAR_LEVER_POSITION_REQUEST".to_owned()),
+ gear_handle_hits_lock_sound_id: context
+ .get_identifier("GEAR_HANDLE_HITS_LOCK_SOUND".to_owned()),
lever_should_lock_down: init_gear_down,
@@ -514,6 +519,8 @@ impl LandingGearHandleUnit {
},
lever_commanded_down: init_gear_down,
+
+ lever_just_hit_lock_sound: false,
}
}
@@ -530,6 +537,8 @@ impl LandingGearHandleUnit {
}
fn update_position(&mut self, context: &UpdateContext) {
+ let previous_position = self.lever_position;
+
if self.lever_commanded_down {
self.lever_position += Ratio::new::(
Self::GEAR_LEVER_SPEED_PERCENT_PER_S * context.delta_as_secs_f64(),
@@ -554,6 +563,10 @@ impl LandingGearHandleUnit {
.lever_position
.max(Ratio::new::(0.))
.min(Ratio::new::(1.));
+
+ self.lever_just_hit_lock_sound = previous_position.get::()
+ > Self::GEAR_LEVER_MAX_LOCK_POSITION
+ && self.lever_position == Ratio::new::(Self::GEAR_LEVER_MAX_LOCK_POSITION);
}
}
impl LandingGearHandle for LandingGearHandleUnit {
@@ -576,6 +589,11 @@ impl SimulationElement for LandingGearHandleUnit {
&self.gear_handle_real_position_id,
self.lever_position.get::(),
);
+
+ writer.write(
+ &self.gear_handle_hits_lock_sound_id,
+ self.lever_just_hit_lock_sound,
+ );
}
}
@@ -1363,6 +1381,10 @@ mod tests {
lever_pos >= 0.90
}
+ fn is_gear_lever_lock_makes_sound(&mut self) -> bool {
+ self.read_by_name("GEAR_HANDLE_HITS_LOCK_SOUND")
+ }
+
fn fail_hyd_pressure(&mut self) {
self.command(|a| a.set_no_pressure());
}
@@ -1439,6 +1461,26 @@ mod tests {
assert!(test_bed.is_gear_handle_down());
}
+ #[test]
+ fn gear_lever_locked_makes_locked_sound_once_when_trying_up() {
+ let mut test_bed = test_bed_on_ground_with().on_the_ground().run_one_tick();
+
+ assert!(test_bed.is_gear_handle_lock_down_active());
+ assert!(test_bed.is_gear_handle_down());
+ assert!(!test_bed.is_gear_lever_lock_makes_sound());
+
+ test_bed = test_bed.on_the_ground().set_gear_handle_up();
+
+ assert!(test_bed.is_gear_lever_lock_makes_sound());
+
+ // Make sure next ticks sound doesn't play anymore
+ test_bed = test_bed.run_one_tick();
+ assert!(!test_bed.is_gear_lever_lock_makes_sound());
+
+ test_bed = test_bed.run_one_tick();
+ assert!(!test_bed.is_gear_lever_lock_makes_sound());
+ }
+
#[test]
fn gear_lever_up_and_locked_can_go_down_but_not_up() {
let mut test_bed = test_bed_in_flight_with().in_flight().run_one_tick();
From 8f89f7a70b7afefd9ac2803ec70f2b8355f9b49c Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Mon, 21 Nov 2022 16:41:03 +0100
Subject: [PATCH 22/24] Update sound.xml
---
.../SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml
index 6ff02621624..815094c5623 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml
@@ -642,11 +642,11 @@
-
+
-
+
From f2e87fd002dc4d08af8e73e8ae3e7ec9a9b63e15 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Mon, 21 Nov 2022 18:22:45 +0100
Subject: [PATCH 23/24] Update gear.rs
---
src/systems/a320_systems_wasm/src/gear.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/systems/a320_systems_wasm/src/gear.rs b/src/systems/a320_systems_wasm/src/gear.rs
index 5e8128cdb69..8f8a5b3a3bc 100644
--- a/src/systems/a320_systems_wasm/src/gear.rs
+++ b/src/systems/a320_systems_wasm/src/gear.rs
@@ -4,8 +4,7 @@ use msfs::sim_connect;
use msfs::{sim_connect::SimConnect, sim_connect::SIMCONNECT_OBJECT_ID_USER};
use systems_wasm::aspects::{
- EventToVariableMapping, ExecuteOn, MsfsAspectBuilder, ObjectWrite, VariableToEventMapping,
- VariableToEventWriteOn, VariablesToObject,
+ EventToVariableMapping, MsfsAspectBuilder, ObjectWrite, VariablesToObject,
};
use systems_wasm::{set_data_on_sim_object, Variable};
From ed88c9cf9706324d8262379e81c7eb48c544af72 Mon Sep 17 00:00:00 2001
From: davydecorps <38904654+crocket63@users.noreply.github.com>
Date: Wed, 14 Dec 2022 15:50:58 +0100
Subject: [PATCH 24/24] Update A32NX_BrakeTemp.js
---
.../html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js
index e852e685e67..3dc049e4d03 100644
--- a/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js
+++ b/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_BrakeTemp.js
@@ -88,7 +88,7 @@ class A32NX_BrakeTemp {
const currentBrakeFanState = SimVar.GetSimVarValue("L:A32NX_BRAKE_FAN", "Bool");
const brakeFanButtonIsPressed = SimVar.GetSimVarValue("L:A32NX_BRAKE_FAN_BTN_PRESSED", "Bool");
// if the fan button is pressed down and the left main gear is down and locked, the fan is on
- const brakeFanIsOn = brakeFanButtonIsPressed && (GearLeftPosition == 1);
+ const brakeFanIsOn = brakeFanButtonIsPressed && (GearLeftPosition == 100);
let fanMultiplier = 1;
let fanDifferentialFactor = 1;
if (brakeFanIsOn) {