diff --git a/.ace/.gitignore b/.ace/.gitignore new file mode 100644 index 00000000000..60baa9cb833 --- /dev/null +++ b/.ace/.gitignore @@ -0,0 +1 @@ +data/* diff --git a/fbw-a32nx/src/systems/instruments/src/SD/Pages/Eng/Eng.tsx b/fbw-a32nx/src/systems/instruments/src/SD/Pages/Eng/Eng.tsx index 7131a69ceef..b844f216a5c 100644 --- a/fbw-a32nx/src/systems/instruments/src/SD/Pages/Eng/Eng.tsx +++ b/fbw-a32nx/src/systems/instruments/src/SD/Pages/Eng/Eng.tsx @@ -13,13 +13,14 @@ import './Eng.scss'; export const EngPage: FC = () => { const [weightUnit] = usePersistentProperty('CONFIG_USING_METRIC_UNIT', '1'); - const [engSelectorPosition] = useSimVar('L:XMLVAR_ENG_MODE_SEL', 'Enum', 1000); - + const [engSelectorPosition] = useSimVar('L:XMLVAR_ENG_MODE_SEL', 'Enum'); + const [fadec1On] = useSimVar('L:A32NX_FADEC_POWERED_ENG1', 'bool'); + const [fadec2On] = useSimVar('L:A32NX_FADEC_POWERED_ENG2', 'bool'); return ( - + F.USED @@ -50,7 +51,7 @@ export const EngPage: FC = () => { - + ); }; @@ -66,10 +67,11 @@ function getNeedleValue(value: any, max: number): number { interface ComponentPositionProps { x: number, y: number, - engineNumber: number + engineNumber: number, + fadecOn: boolean } -const PressureGauge = ({ x, y, engineNumber }: ComponentPositionProps) => { +const PressureGauge = ({ x, y, engineNumber, fadecOn }: ComponentPositionProps) => { const [engineOilPressure] = useSimVar(`ENG OIL PRESSURE:${engineNumber}`, 'psi', 100); const displayedEngineOilPressure = Math.round(engineOilPressure / 2) * 2; // Engine oil pressure has a step of 2 const OIL_PSI_MAX = 130; @@ -81,7 +83,13 @@ const PressureGauge = ({ x, y, engineNumber }: ComponentPositionProps) => { const [pressureBelowLow, setPressureBelowLow] = useState(false); const [shouldPressurePulse, setShouldPressurePulse] = useState(false); const [n2Percent] = useSimVar(`ENG N2 RPM:${engineNumber}`, 'percent', 50); + const [engine1State] = useSimVar('L:A32NX_ENGINE_STATE:1', 'number'); + const [engine2State] = useSimVar('L:A32NX_ENGINE_STATE:2', 'number'); + + const engineRunning = engine1State > 0 || engine2State > 0; + const activeVisibility = fadecOn ? 'visible' : 'hidden'; + const inactiveVisibility = fadecOn ? 'hidden' : 'visible'; /* Controls different styling of pressure needle and digital readout according to certain critical, or cautionary ranges. */ useEffect(() => { @@ -130,28 +138,33 @@ const PressureGauge = ({ x, y, engineNumber }: ComponentPositionProps) => { - - - - {displayedEngineOilPressure} - + + + + + {displayedEngineOilPressure} + + + + XX + ); }; -const QuantityGauge = ({ x, y, engineNumber }: ComponentPositionProps) => { +const QuantityGauge = ({ x, y, engineNumber, fadecOn }: ComponentPositionProps) => { const [engineOilQuantity] = useSimVar(`ENG OIL QUANTITY:${engineNumber}`, 'percent', 100); const OIL_QTY_MAX = 24.25; const OIL_QTY_LOW_ADVISORY = 1.35; @@ -159,6 +172,8 @@ const QuantityGauge = ({ x, y, engineNumber }: ComponentPositionProps) => { const [quantityAtOrBelowLow, setQuantityAtOrBelowLow] = useState(false); const [shouldQuantityPulse, setShouldQuantityPulse] = useState(false); + const activeVisibility = fadecOn ? 'visible' : 'hidden'; + const inactiveVisibility = fadecOn ? 'hidden' : 'visible'; // Sets engine oil quantity's pulsation based on advisory value constant, this should be changed in the future as its calculated on the fly in NEOs useEffect(() => { if (displayedEngineOilQuantity <= OIL_QTY_LOW_ADVISORY) { @@ -178,51 +193,58 @@ const QuantityGauge = ({ x, y, engineNumber }: ComponentPositionProps) => { - - - - - {displayedEngineOilQuantity.toFixed(1).split('.')[0]} - . - {displayedEngineOilQuantity.toFixed(1).split('.')[1]} - + + + + + + {displayedEngineOilQuantity.toFixed(1).split('.')[0]} + . + {displayedEngineOilQuantity.toFixed(1).split('.')[1]} + + + + XX + ); }; -const ValveGroup = ({ x, y, engineNumber }: ComponentPositionProps) => { +const ValveGroup = ({ x, y, engineNumber, fadecOn }: ComponentPositionProps) => { const [isValveOpen, setIsValveOpen] = useState(false); const [n2Percent] = useSimVar(`ENG N2 RPM:${engineNumber}`, 'percent', 50); const [isEngineStarting] = useSimVar(`GENERAL ENG STARTER:${engineNumber}`, 'bool', 300); - const [engSelectorPosition] = useSimVar('L:XMLVAR_ENG_MODE_SEL', 'Enum', 1000); + const [engSelectorPosition] = useSimVar('L:XMLVAR_ENG_MODE_SEL', 'Enum'); const [igniterAactive] = useSimVar(`L:A32NX_FADEC_IGNITER_A_ACTIVE_ENG${engineNumber}`, 'bool', 300); const [igniterBactive] = useSimVar(`L:A32NX_FADEC_IGNITER_B_ACTIVE_ENG${engineNumber}`, 'bool', 300); const [apuBleedPressure] = useSimVar('L:APU_BLEED_PRESSURE', 'psi', 250); + const activeVisibility = fadecOn ? 'visible' : 'hidden'; + const inactiveVisibility = fadecOn ? 'hidden' : 'visible'; // This useEffect ensures that the valve is only opened if the engine mode selector is set to IGN/START, the engine is starting, and n2% is below 50 useEffect(() => { if (isEngineStarting && n2Percent < 50 && engSelectorPosition === 2) { @@ -247,8 +269,13 @@ const ValveGroup = ({ x, y, engineNumber }: ComponentPositionProps) => { {/* 375 to 30 */} - - + + + + + + XX + {apuBleedPressure} @@ -256,7 +283,7 @@ const ValveGroup = ({ x, y, engineNumber }: ComponentPositionProps) => { ); }; -const EngineColumn = ({ x, y, engineNumber }: ComponentPositionProps) => { +const EngineColumn = ({ x, y, engineNumber, fadecOn }: ComponentPositionProps) => { // Fuel used has a step of 10 when in Kilograms and 20 when in imperial pounds const [weightUnit] = usePersistentProperty('CONFIG_USING_METRIC_UNIT', '1'); const [fuelUsed] = useSimVar(`L:A32NX_FUEL_USED:${engineNumber}`, 'number', 500); @@ -275,6 +302,9 @@ const EngineColumn = ({ x, y, engineNumber }: ComponentPositionProps) => { const [n2Vibration] = useSimVar(`TURB ENG VIBRATION:${engineNumber}`, 'Number'); // FIXME TODO: should have a different value than N1, currently API limited + const activeVisibility = fadecOn ? 'visible' : 'hidden'; + const inactiveVisibility = fadecOn ? 'hidden' : 'visible'; + useEffect(() => { if (displayedEngineOilTemperature >= OIL_TEMP_HIGH_ADVISORY) { setShouldTemperaturePulse(true); @@ -319,25 +349,31 @@ const EngineColumn = ({ x, y, engineNumber }: ComponentPositionProps) => { {displayedFuelUsed} - - - + - {displayedEngineOilTemperature} + + + {displayedEngineOilTemperature} - - {n1Vibration.toFixed(1).toString().split('.')[0]} - . - {n1Vibration.toFixed(1).toString().split('.')[1]} - + + {n1Vibration.toFixed(1).toString().split('.')[0]} + . + {n1Vibration.toFixed(1).toString().split('.')[1]} + - - {n2Vibration.toFixed(1).toString().split('.')[0]} - . - {n2Vibration.toFixed(1).toString().split('.')[1]} - + + {n2Vibration.toFixed(1).toString().split('.')[0]} + . + {n2Vibration.toFixed(1).toString().split('.')[1]} + + + + XX + XX + XX + - + ); };