From 444d8c00606356298c90b4fc9ce31b3a8824c8c7 Mon Sep 17 00:00:00 2001
From: BravoMike99 <119708186+BravoMike99@users.noreply.github.com>
Date: Sun, 20 Oct 2024 10:20:21 +0100
Subject: [PATCH] fix(a380x/SD): Hook up door SD page to door status (#9077)
* hookup door page to door status
* fix cargo door & beacon light check
* fix engine running condition
* fix(door sd): do not use conditional react hook
---
.../systems/instruments/src/Common/types.tsx | 3 +
.../src/SD/Pages/Doors/DoorPage.tsx | 210 ++++++++++++++++--
.../src/SD/Pages/Doors/elements/CabinDoor.tsx | 19 +-
.../src/SD/Pages/Doors/elements/CargoDoor.tsx | 4 +-
.../src/SD/Pages/Engine/EngPage.tsx | 2 +-
5 files changed, 210 insertions(+), 28 deletions(-)
diff --git a/fbw-a380x/src/systems/instruments/src/Common/types.tsx b/fbw-a380x/src/systems/instruments/src/Common/types.tsx
index ba2d6045fca..e45177aca70 100644
--- a/fbw-a380x/src/systems/instruments/src/Common/types.tsx
+++ b/fbw-a380x/src/systems/instruments/src/Common/types.tsx
@@ -31,6 +31,8 @@ export type EGTProps = {
export type CabinDoorProps = {
doorNumber: number;
+ interactivePoint: number;
+ slideArmed: boolean;
side: 'L' | 'R';
engineRunning: boolean;
mainOrUpper: 'MAIN' | 'UPPER';
@@ -38,6 +40,7 @@ export type CabinDoorProps = {
export type CargoDoorProps = {
label: 'AFT' | 'FWD' | 'BULK' | 'AVNCS' | 'FWD CARGO' | 'AFT CARGO';
+ closed: boolean;
width: number;
height: number;
engineRunning: boolean;
diff --git a/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/DoorPage.tsx b/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/DoorPage.tsx
index 42a96c3c162..3325560145c 100644
--- a/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/DoorPage.tsx
+++ b/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/DoorPage.tsx
@@ -11,9 +11,17 @@ import CargoDoor from './elements/CargoDoor';
export const DoorPage = () => {
const [windowLeft] = useSimVar('L:CPT_SLIDING_WINDOW', 'number');
const [windowRight] = useSimVar('L:FO_SLIDING_WINDOW', 'number');
- const engineRunning = true;
+ // TODO replace once proper slide implementation & fadec
+ const [beaconOn] = useSimVar('LIGHT BEACON ON', 'bool', 1000);
+ const [engine1State] = useSimVar('L:A32NX_ENGINE_STATE:1', 'enum', 1000);
+ const [engine2State] = useSimVar('L:A32NX_ENGINE_STATE:2', 'enum', 1000);
+ const [engine3State] = useSimVar('L:A32NX_ENGINE_STATE:3', 'enum', 1000);
+ const [engine4State] = useSimVar('L:A32NX_ENGINE_STATE:4', 'enum', 1000);
+ const engineRunning = engine1State === 1 || engine2State === 1 || engine3State === 1 || engine4State === 1;
const sdacActive = true;
const onGround = true;
+ const [fwdCargoClosed] = useSimVar('L:A32NX_FWD_DOOR_CARGO_LOCKED', 'bool', 1000);
+ const [aftCargoClosed] = useSimVar('L:A32NX_AFT_DOOR_CARGO_LOCKED', 'bool', 1000);
return (
<>
@@ -36,31 +44,191 @@ export const DoorPage = () => {
{/* Cabin Doors */}
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
{/* Cargo Doors */}
-
-
-
-
+
+
+
+
>
);
};
diff --git a/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/elements/CabinDoor.tsx b/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/elements/CabinDoor.tsx
index 152c8c570e2..ddfe44b5df0 100644
--- a/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/elements/CabinDoor.tsx
+++ b/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/elements/CabinDoor.tsx
@@ -1,9 +1,20 @@
+import { useSimVar } from '@flybywiresim/fbw-sdk';
import { Position, CabinDoorProps } from '@instruments/common/types';
import React from 'react';
-const CabinDoor: React.FC = ({ x, y, doorNumber, side, mainOrUpper, engineRunning }) => {
- const doorOpen = false;
- const armed = true;
+const CabinDoor: React.FC = ({
+ x,
+ y,
+ doorNumber,
+ interactivePoint,
+ side,
+ mainOrUpper,
+ engineRunning,
+ slideArmed,
+}) => {
+ const [openPercentage] = useSimVar(`INTERACTIVE POINT OPEN:${interactivePoint}`, 'percent', 1000);
+ const doorOpen = openPercentage > 20;
+ const armed = !doorOpen && slideArmed;
const validSDAC = true;
let slide = '';
@@ -54,7 +65,7 @@ const CabinDoor: React.FC = ({ x, y, doorNumber, side
{!validSDAC ? 'X' : doorNumber}
-
+
{cabinDoorMessage}
diff --git a/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/elements/CargoDoor.tsx b/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/elements/CargoDoor.tsx
index 4626cf6099d..0aee0e1a359 100644
--- a/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/elements/CargoDoor.tsx
+++ b/fbw-a380x/src/systems/instruments/src/SD/Pages/Doors/elements/CargoDoor.tsx
@@ -1,8 +1,8 @@
import { Position, CargoDoorProps } from '@instruments/common/types';
import React from 'react';
-const CargoDoor: React.FC = ({ x, y, label, width, height, engineRunning }) => {
- const doorOpen = false;
+const CargoDoor: React.FC = ({ x, y, label, closed, width, height, engineRunning }) => {
+ const doorOpen = !closed;
const validSDAC = true;
let cargoDoorMessage = '';
diff --git a/fbw-a380x/src/systems/instruments/src/SD/Pages/Engine/EngPage.tsx b/fbw-a380x/src/systems/instruments/src/SD/Pages/Engine/EngPage.tsx
index 34375a6c668..44f48edde82 100644
--- a/fbw-a380x/src/systems/instruments/src/SD/Pages/Engine/EngPage.tsx
+++ b/fbw-a380x/src/systems/instruments/src/SD/Pages/Engine/EngPage.tsx
@@ -14,7 +14,7 @@ export const EngPage = () => {
const [engine2State] = useSimVar('L:A32NX_ENGINE_STATE:2', 'enum', 500); // TODO: Update with correct SimVars
const [engine3State] = useSimVar('L:A32NX_ENGINE_STATE:3', 'enum', 500); // TODO: Update with correct SimVars
const [engine4State] = useSimVar('L:A32NX_ENGINE_STATE:4', 'enum', 500); // TODO: Update with correct SimVars
- const engineState = [engine1State, engine2State, engine3State, engine3State, engine4State];
+ const engineState = [engine1State, engine2State, engine3State, engine4State];
const engineRunning = engineState.some((value) => value > 0); // TODO Implement FADEC SimVars once available
return (