Skip to content

Commit

Permalink
feat(hyd): changed gear lever mechanism / added gear door drag flybyw…
Browse files Browse the repository at this point in the history
  • Loading branch information
Saschl committed Dec 8, 2022
1 parent b4435bd commit 4a7fe3e
Show file tree
Hide file tree
Showing 23 changed files with 239 additions and 118 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,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)
1. [HYD] Randomised per actuator flow restrictions at plane init - @Crocket63 (crocket)
1. [MCDU] Hide stored elements on A/C Status when there are none - @tracernz (Mike)
1. [FMGC] Fix ident for CD legs - @tracernz (Mike)
Expand Down
12 changes: 12 additions & 0 deletions docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -3369,6 +3369,18 @@ 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

- A32NX_GEAR_HANDLE_HITS_LOCK_SOUND
- Indicates that gear lever just hit the baulk lock mechanism
- Boolean

## ATC (ATA 34)

- A32NX_TRANSPONDER_MODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<Instrument Id="LANDING_GEAR_Lever_Gear" />
<Test>
<TestValue>
<Val SimVarName="GEAR HANDLE POSITION" Units="Boolean"/>
<Val SimVarName="L:A32NX_GEAR_HANDLE_POSITION" Units="Boolean"/>
</TestValue>
<Action Copilot="True" Condition="TestValueFalse" Once="true" EventID="GEAR_TOGGLE"/>
</Test>
Expand Down Expand Up @@ -1150,7 +1150,7 @@
<Test>
<TestValue>
<Operator OpType="NOT">
<Val SimVarName="GEAR HANDLE POSITION" Units="Boolean"/>
<Val SimVarName="L:A32NX_GEAR_HANDLE_POSITION" Units="Boolean"/>
</Operator>
</TestValue>
<Action Copilot="True" Condition="TestValueFalse" Once="true" EventID="GEAR_TOGGLE"/>
Expand Down Expand Up @@ -1641,7 +1641,7 @@
<Instrument Id="LANDING_GEAR_Lever_Gear" />
<Test>
<TestValue>
<Val SimVarName="GEAR HANDLE POSITION" Units="Boolean"/>
<Val SimVarName="L:A32NX_GEAR_HANDLE_POSITION" Units="Boolean"/>
</TestValue>
<Action Copilot="True" Condition="TestValueFalse" Once="true" EventID="GEAR_TOGGLE"/>
</Test>
Expand Down Expand Up @@ -1841,7 +1841,7 @@
<Instrument Id="LANDING_GEAR_Lever_Gear" />
<Test>
<TestValue>
<Val SimVarName="GEAR HANDLE POSITION" Units="Boolean"/>
<Val SimVarName="L:A32NX_GEAR_HANDLE_POSITION" Units="Boolean"/>
</TestValue>
<Action Copilot="True" Condition="TestValueFalse" Once="true" EventID="GEAR_TOGGLE"/>
</Test>
Expand Down Expand Up @@ -2381,7 +2381,7 @@
<Test>
<TestValue>
<Operator OpType="NOT">
<Val SimVarName="GEAR HANDLE POSITION" Units="Boolean"/>
<Val SimVarName="L:A32NX_GEAR_HANDLE_POSITION" Units="Boolean"/>
</Operator>
</TestValue>
<Action Copilot="True" Condition="TestValueFalse" Once="true" EventID="GEAR_TOGGLE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,12 +840,12 @@
<TOOLTIPID>%((L:A32NX_BRAKE_FAN_BTN_PRESSED, Bool))%{if}Turn OFF brake fan%{else}Turn ON brake fan%{end}</TOOLTIPID>
</UseTemplate>

<UseTemplate Name="FBW_LANDING_GEAR_Gear_Lever_Template">
<UseTemplate Name="FBW_HANDLING_Gear_Lever_Template">
<ANIM_NAME>lever_landing_gear</ANIM_NAME>
<NODE_ID>LEVER_LANDINGGEAR</NODE_ID>
<WWISE_EVENT>gearleverclick</WWISE_EVENT>
<NO_GEARUP_IF_LOCKED/>
<ANIM_LENGTH>3</ANIM_LENGTH>
</UseTemplate>

<UseTemplate Name="FBW_Airbus_LANDING_GEAR_Light_Template">
<NODE_ID>PUSH_AUTOBKR_LDGGEAR_1</NODE_ID>
<ID>1</ID>
Expand Down Expand Up @@ -1777,7 +1777,7 @@
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>5</FREQUENCY>
<UPDATE_CODE>
(A:GEAR HANDLE POSITION, Bool) (A:GEAR POSITION, percent) 99.9 &gt; and (&gt;O:_ShouldBeConnectedToPowerGrid)
(L:A32NX_LGCIU_2_NOSE_GEAR_DOWNLOCKED, Bool) 1 == (&gt;O:_ShouldBeConnectedToPowerGrid)
(O:_ShouldBeConnectedToPowerGrid) sp0
2 (&gt;A:BUS LOOKUP INDEX, Number)
(A:CIRCUIT CONNECTION ON:17, Bool) l0 != if{ 17 2 (&gt;K:2:ELECTRICAL_BUS_TO_CIRCUIT_CONNECTION_TOGGLE) }
Expand Down Expand Up @@ -1833,7 +1833,7 @@

<!-- PARK BRK EXT LT -->
<UseTemplate Name="FBW_Potentiometer_Toggle">
<TOGGLE_CONDITION>(A:GEAR CENTER POSITION, Percent over 100) 1 == (L:A32NX_PARK_BRAKE_LEVER_POS, bool) 1 == and</TOGGLE_CONDITION>
<TOGGLE_CONDITION>(L:A32NX_GEAR_CENTER_POSITION, Percent over 100) 1 == (L:A32NX_PARK_BRAKE_LEVER_POS, bool) 1 == and</TOGGLE_CONDITION>
<TOGGLE_REQUISITE>(L:A32NX_ELEC_DC_GND_FLT_SVC_BUS_IS_POWERED, Bool)</TOGGLE_REQUISITE>
<POTENTIOMETER>99</POTENTIOMETER>
</UseTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,11 +643,11 @@
<WwiseRTPC LocalVar="A32NX_COCKPIT_DOOR_LOCKED" Units="bool" Index="1" RTPCName="LOCALVAR_A32NX_COCKPIT_DOOR_LOCKED" />
</Sound>

<Sound WwiseData="true" WwiseEvent="gearleverclick" Continuous="false" NodeName="PEDALS_LEFT" ViewPoint="Inside" SimVar="GEAR HANDLE POSITION" Units="BOOLEAN" Index="0">
<Sound WwiseData="true" WwiseEvent="gearleverclick" Continuous="false" NodeName="PEDALS_LEFT" ViewPoint="Inside" LocalVar="A32NX_GEAR_HANDLE_POSITION">
<Range LowerBound="1" />
</Sound>

<Sound WwiseData="true" WwiseEvent="gearleverclick" Continuous="false" NodeName="PEDALS_LEFT" ViewPoint="Inside" SimVar="GEAR HANDLE POSITION" Units="BOOLEAN" Index="0">
<Sound WwiseData="true" WwiseEvent="gearleverclick" Continuous="false" NodeName="PEDALS_LEFT" ViewPoint="Inside" LocalVar="A32NX_GEAR_HANDLE_POSITION">
<Range UpperBound="0" />
</Sound>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("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));
Expand Down
41 changes: 41 additions & 0 deletions src/behavior/src/A32NX_Interior_Handling.xml
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,47 @@
</Component>
</Template>

<Template Name="FBW_HANDLING_Gear_Lever_Template">
<DefaultTemplateParameters>
<TOOLTIPID>TT_Package.LANDING_GEAR_LEVER_GEAR_TITLE</TOOLTIPID>
<ANIM_NAME>lever_landing_gear</ANIM_NAME>
<NODE_ID>LEVER_LANDINGGEAR</NODE_ID>
<PART_ID>LEVER_LANDINGGEAR</PART_ID>
<ANIM_LAG>0</ANIM_LAG>
<DRAG_MIN_VALUE>0</DRAG_MIN_VALUE>
<DRAG_MAX_VALUE>100</DRAG_MAX_VALUE>
<DRAG_DELTA>0.001</DRAG_DELTA>
<DRAG_SPEED>0.03</DRAG_SPEED>
<LEFT_SINGLE_CODE>
(L:A32NX_GEAR_HANDLE_POSITION, Number) 0.95 &gt; if{
(&gt;K:GEAR_UP)
} els{
(&gt;K:GEAR_DOWN)
}
</LEFT_SINGLE_CODE>
<LEFT_RELEASE_CODE>
(L:A32NX_GEAR_LEVER_LOCKED, Boolean) 1 == if{
(&gt;K:GEAR_DOWN)
}
</LEFT_RELEASE_CODE>
<DRAG_CODE>

</DRAG_CODE>
</DefaultTemplateParameters>

<Component ID="#NODE_ID#" Node="#NODE_ID#">
<UseTemplate Name="ASOBO_GT_Lever_DraggingYAxis_Code">
<ANIM_LENGTH>3</ANIM_LENGTH>
<ANIM_CODE>
(L:A32NX_GEAR_HANDLE_POSITION, Percent) 3 *
</ANIM_CODE>
<UP_CODE> (&gt;K:GEAR_UP)</UP_CODE>
<DOWN_CODE> (&gt;K:GEAR_DOWN)</DOWN_CODE>
</UseTemplate>
</Component>
</Template>


<Template Name="FBW_HANDLING_Indicator_ElevatorTrim_Template">
<Parameters Type="Default">
<ANIM_NAME>HANDLING_Indicator_ElevatorTrim</ANIM_NAME>
Expand Down
46 changes: 0 additions & 46 deletions src/behavior/src/A32NX_Interior_Misc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,52 +188,6 @@
</UseTemplate>
</Template>

<!-- GEAR LEVER CUSTOM MODEL LOCKED DOWN WITH SIMVAR FROM SYSTEM WASM -->
<Template Name="FBW_LANDING_GEAR_Gear_Lever_Template">
<Parameters Type="Default">
<ANIM_NAME>LANDING_GEAR_Lever_Gear</ANIM_NAME>
<PART_ID>LANDING_GEAR_Lever_Gear</PART_ID>
<NODE_ID>LANDING_GEAR_Lever_Gear</NODE_ID>
<LIGHT_NODE_ID>LANDING_GEAR_Lever_GearLight</LIGHT_NODE_ID>
<ANIM_LAG>400</ANIM_LAG>
<DRAG_SCALAR>10</DRAG_SCALAR>
<TOOLTIP_LANDING_GEAR_TITLE>@TT_Package.LANDING_GEAR_LEVER_GEAR_TITLE</TOOLTIP_LANDING_GEAR_TITLE>
<WWISE_EVENT>gear_lever</WWISE_EVENT>
<WWISE_EVENT_1>gear_lever_on</WWISE_EVENT_1>
<WWISE_EVENT_2>gear_lever_off</WWISE_EVENT_2>
<ALWAYS_USE_ANIM_LAG>True</ALWAYS_USE_ANIM_LAG> <!-- Only 2 positions so anim lag during drags is wanted -->
</Parameters>
<Parameters Type="Override">
<TOOLTIP_TITLE>#TOOLTIP_LANDING_GEAR_TITLE#</TOOLTIP_TITLE>
<TOOLTIP_ENTRY_0>LANDING_GEAR_Gear</TOOLTIP_ENTRY_0>
<UP_CODE>(&gt;B:LANDING_GEAR_Gear_Inc)</UP_CODE>
<DOWN_CODE>(&gt;B:LANDING_GEAR_Gear_Dec)</DOWN_CODE>
</Parameters>
<Parameters Type="Override">
<Condition Check="NO_GEARUP_IF_LOCKED">
<True>
<UP_CODE>(L:A32NX_GEAR_LEVER_LOCKED, Bool) ! if{ #UP_CODE# }</UP_CODE>
</True>
</Condition>
</Parameters>

<Component ID="#NODE_ID#" Node="#NODE_ID#">
<UseInputEvent ID="LANDING_GEAR">
<GEAR_ID>1</GEAR_ID>
</UseInputEvent>
<UseTemplate Name="ASOBO_GT_Lever_DraggingYAxis_Code">
<ANIM_CODE>(B:LANDING_GEAR_Gear) 100 *</ANIM_CODE>
</UseTemplate>
</Component>

<Condition Check="EMISSIVE_CODE">
<Component ID="#LIGHT_NODE_ID#" Node="#LIGHT_NODE_ID#">
<UseTemplate Name="ASOBO_GT_Emissive_Gauge">
<PART_ID>#LIGHT_NODE_ID#</PART_ID>
</UseTemplate>
</Component>
</Condition>
</Template>

<Template Name="FBW_Airbus_Fuel_Pump">
<UseTemplate Name="FBW_Push_Toggle">
Expand Down
8 changes: 4 additions & 4 deletions src/instruments/src/EFB/Ground/Pages/Payload/Payload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ export const Payload = () => {
<TooltipWrapper text={t('Ground.Payload.TT.StartBoarding')}>
<button
type="button"
className={`flex justify-center rounded-lg items-center ml-auto w-24 h-12
className={`flex justify-center rounded-lg items-center ml-auto w-24 h-12
${boardingStatusClass} bg-current`}
onClick={() => setBoardingStarted(!boardingStarted)}
>
Expand All @@ -767,7 +767,7 @@ export const Payload = () => {
<TooltipWrapper text={t('Ground.Payload.TT.StartDeboarding')}>
<button
type="button"
className={`flex justify-center items-center ml-1 w-16 h-12 text-theme-highlight bg-current rounded-lg
className={`flex justify-center items-center ml-1 w-16 h-12 text-theme-highlight bg-current rounded-lg
${totalPax === 0 && totalCargo === 0 && 'opacity-20 pointer-events-none'}`}
onClick={() => handleDeboarding()}
>
Expand All @@ -789,8 +789,8 @@ export const Payload = () => {
&& (
<TooltipWrapper text={t('Ground.Payload.TT.FillPayloadFromSimbrief')}>
<div
className={`flex justify-center items-center px-2 h-auto text-theme-body
hover:text-theme-highlight bg-theme-highlight hover:bg-theme-body
className={`flex justify-center items-center px-2 h-auto text-theme-body
hover:text-theme-highlight bg-theme-highlight hover:bg-theme-body
rounded-md rounded-l-none border-2 border-theme-highlight transition duration-100`}
onClick={setSimBriefValues}
>
Expand Down
2 changes: 1 addition & 1 deletion src/instruments/src/EWD/elements/PseudoFWC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,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);
Expand Down
3 changes: 2 additions & 1 deletion src/systems/a320_systems/src/hydraulic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7675,6 +7675,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::<percent>(80.))
.run_one_tick();
Expand All @@ -7687,7 +7688,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::<psi>(2800.));
assert!(test_bed.yellow_pressure() > Pressure::new::<psi>(2500.));
assert!(test_bed.is_green_pressure_switch_pressurised());
assert!(test_bed.green_pressure() > Pressure::new::<psi>(2300.));
assert!(test_bed.is_green_edp_press_low());
Expand Down
Loading

0 comments on commit 4a7fe3e

Please sign in to comment.