Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rmp): RMP behaviour and lights #7105

Merged
merged 28 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6a57e41
fix: RMP behavior and lights [issue 344]
juliansebline Apr 24, 2022
f019154
Update src/instruments/src/EWD/elements/PseudoFWC.tsx
juliansebline Apr 27, 2022
a0e4100
Update src/instruments/src/Common/EWDMessages.tsx
juliansebline Apr 28, 2022
6afb3ad
Update src/instruments/src/EWD/elements/PseudoFWC.tsx
juliansebline Apr 28, 2022
17de4ef
Update src/instruments/src/EWD/elements/PseudoFWC.tsx
juliansebline Apr 28, 2022
9789fdf
Update RadioPanelDisplay.tsx
juliansebline Apr 28, 2022
f3402d3
Fix bug with ANN LT involved
juliansebline Apr 28, 2022
ee6a67d
Added comments about commented out code
juliansebline Apr 28, 2022
8f8791a
Fix RMPs elec buses
juliansebline Apr 29, 2022
8af8c8a
add of SEL word backlight
juliansebline Apr 29, 2022
ba3aba3
Default init of transmit and volume buttons
juliansebline Apr 29, 2022
ed0e999
fix SEL light behavior
juliansebline May 19, 2022
e6d657b
fix SEL light behavior #2
juliansebline May 19, 2022
6e58fd6
Removal of commented out code
juliansebline May 19, 2022
a76d2d7
SEL backlight code
juliansebline May 23, 2022
a0939a5
Changelog
juliansebline Jun 7, 2022
e142e91
Merge branch 'flybywiresim:master' into master
juliansebline Jun 9, 2022
adcb7bf
Fix for vPilot
juliansebline Jun 20, 2022
788b2c7
Merge branch 'master' into RMP_fix_behavior_lights
juliansebline Jun 21, 2022
72b2573
Changelog update
juliansebline Jun 21, 2022
f44dca6
Changelog from 0.4.0 to 0.9.0 as requested
juliansebline Jun 22, 2022
5775465
Merge branch 'master' into RMP_fix_behavior_lights
Saschl Aug 3, 2022
20560ad
Fix COM3 Transmit + it is now possible to transmit on no COM
juliansebline Aug 3, 2022
77833af
Merge branch 'RMP_fix_behavior_lights' of https://github.com/julianse…
juliansebline Aug 3, 2022
08f7009
Fix knob animation
juliansebline Aug 7, 2022
f24083d
Fix simvars when switching between CALLS p/b
juliansebline Aug 8, 2022
c400705
Comment
juliansebline Aug 8, 2022
d2b34fc
Merge branch 'master' into RMP_fix_behavior_lights
2hwk Aug 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1054,3 +1054,4 @@
1. [CDU] Full +/- button functionality - @lhoenig (Lukas Hoenig)
1. [DCDU] Fixed MSG- and MSG+ button labels - @tyler58546 (tyler58546)
1. [OVHD] Fixed fire push button not being able to be stowed - Julian Sebline (Julian Sebline#8476 on Discord)
1. [RMP] Fixed the behavior of the RMPs and ACPs (VHFs only) - Julian Sebline (Julian Sebline#8476 on Discord)
juliansebline marked this conversation as resolved.
Show resolved Hide resolved
218 changes: 125 additions & 93 deletions flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/AirlinerCommon.xml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

43 changes: 39 additions & 4 deletions src/behavior/src/A32NX_Interior_RMP.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@
</Component>

<!-- Panel transfer button -->
<!-- Force COM3_RADIO_SET_HZ to 0 to show "DATA" at startup -->
<Component ID="RMP_TRANSFER_BUTTON_#SIDE#" Node="PUSH_RADIO#SIDE#_ARROWS">
<Update Once="True">
0 (&gt;K:COM3_RADIO_SET_HZ)
</Update>
<UseTemplate Name="FBW_Anim_Interactions">
<ANIM_TYPE>BUTTON</ANIM_TYPE>
<ANIM_TEMPLATE>ASOBO_GT_Push_Button</ANIM_TEMPLATE>
Expand Down Expand Up @@ -132,20 +136,50 @@
<BASE_NAME>AM</BASE_NAME>
</UseTemplate>

<!-- SEL word indicator light -->
<Component ID="PUSH_RADIO#SIDE#_SEL_SEQ1" Node="PUSH_RADIO#SIDE#_SEL_SEQ1">
<UseTemplate Name="ASOBO_GT_Emissive_Gauge">
<POTENTIOMETER>7</POTENTIOMETER>
<EMISSIVE_CODE type="rnp" return="number">
let indicatorsPowered = #INDICATORS_POWERED, bool#;
let id = #ID, number#;
alias toggleSwitch = (L:A32NX_RMP_#SIDE#_TOGGLE_SWITCH, bool);
alias selectedModeLeft = (L:A32NX_RMP_L_SELECTED_MODE, number);
alias selectedModeRight = (L:A32NX_RMP_R_SELECTED_MODE, number);
alias annunciatorLight = (L:A32NX_OVHD_INTLT_ANN, number);
let emissiveDim = if annunciatorLight == 2 { 0.05 } else { 1 };
// @todo abnormal defined differently with NAV modes available.
let rmpLeftAbnormal = selectedModeLeft != 1 or selectedModeRight == 1;
let rmpRightAbnormal = selectedModeRight != 2 or selectedModeLeft == 2;
let sideLeftCheck = id == 1;
let sideRightCheck = id == 2;
(if (toggleSwitch and ((rmpLeftAbnormal and sideLeftCheck) or (rmpRightAbnormal and sideRightCheck)) or (annunciatorLight == 0)) and indicatorsPowered {
1 * emissiveDim
} else {
0
})
</EMISSIVE_CODE>
</UseTemplate>
</Component>

<!-- SEL indicator led light -->
<Component ID="PUSH_RADIO#SIDE#_SEL_SEQ2" Node="PUSH_RADIO#SIDE#_SEL_SEQ2">
<UseTemplate Name="ASOBO_GT_Emissive_Gauge">
<POTENTIOMETER>7</POTENTIOMETER>
<EMISSIVE_CODE type="rnp" return="number">
let indicatorsPowered = #INDICATORS_POWERED, bool#;
let id = #ID, number#;
alias toggleSwitch = (L:A32NX_RMP_#SIDE#_TOGGLE_SWITCH, bool);
alias selectedModeLeft = (L:A32NX_RMP_L_SELECTED_MODE, number);
alias selectedModeRight = (L:A32NX_RMP_R_SELECTED_MODE, number);
alias annunciatorLight = (L:A32NX_OVHD_INTLT_ANN, number);
let emissiveDim = if annunciatorLight == 2 { 0.05 } else { 1 };
// @todo abnormal defined differently with NAV modes available.
let rmpLeftAbnormal = selectedModeLeft != 1;
let rmpRightAbnormal = selectedModeRight != 2;
(if (toggleSwitch and (rmpLeftAbnormal or rmpRightAbnormal) or (annunciatorLight == 0)) and indicatorsPowered {
let rmpLeftAbnormal = selectedModeLeft != 1 or selectedModeRight == 1;
let rmpRightAbnormal = selectedModeRight != 2 or selectedModeLeft == 2;
let sideLeftCheck = id == 1;
let sideRightCheck = id == 2;
(if (toggleSwitch and ((rmpLeftAbnormal and sideLeftCheck) or (rmpRightAbnormal and sideRightCheck)) or (annunciatorLight == 0)) and indicatorsPowered {
1 * emissiveDim
} else {
0
Expand All @@ -156,6 +190,7 @@

<!-- SEL indicator backlighting -->
<UseTemplate Name="FBW_RMP_BACKLIGHT_Template">
<POTENTIOMETER>7</POTENTIOMETER>
<BASE_NAME>SEL</BASE_NAME>
</UseTemplate>
</Template>
Expand Down Expand Up @@ -288,7 +323,7 @@
<Component ID="#BACKLIGHT_NAME#" Node="#BACKLIGHT_NAME#">
<UseTemplate Name="ASOBO_GT_Emissive_Gauge">
<EMISSIVE_CODE>
(A:LIGHT POTENTIOMETER:#POTENTIOMETER#, Percent over 100) #BACKLIGHTS_POWERED# *
(A:LIGHT POTENTIOMETER:#POTENTIOMETER#, Percent over 100) #BACKLIGHTS_POWERED# (L:A32NX_RMP_#SIDE#_TOGGLE_SWITCH) * *
</EMISSIVE_CODE>
</UseTemplate>
</Component>
Expand Down
1 change: 1 addition & 0 deletions src/instruments/src/Common/EWDMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const EWDMessages = {
'000055201': '\x1b<3mCOMPANY MSG',
'000056001': '\x1b<3mHI ALT SET',
'000068001': '\x1b<3mADIRS SWTG',
'000056701': '\x1b<3mVHF3 VOICE',
'213122101': '\x1b<2m\x1b4mCAB PR\x1bm EXCESS CAB ALT',
'213122102': '\x1b<5m -CREW OXY MASKS.....USE',
'213122103': '\x1b<5m -SIGNS...............ON',
Expand Down
14 changes: 14 additions & 0 deletions src/instruments/src/EWD/elements/PseudoFWC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ const PseudoFWC: React.FC = () => {
const [pack2On] = useSimVar('L:A32NX_OVHD_COND_PACK_2_PB_IS_ON', 'bool');
const [excessPressure] = useSimVar('L:A32NX_PRESS_EXCESS_CAB_ALT', 'bool', 500);

const [voiceVHF3] = useSimVar('A:COM ACTIVE FREQUENCY:3', 'number', 500);

/* WARNINGS AND FAILURES */
const landASAPRed: boolean = !!(!aircraftOnGround
&& (
Expand Down Expand Up @@ -1390,6 +1392,17 @@ const PseudoFWC: React.FC = () => {
sysPage: -1,
side: 'RIGHT',
},
'0000567': // VHF3 VOICE
{
flightPhaseInhib: [],
simVarIsActive: voiceVHF3 !== 0 && [1, 2, 6, 9, 10].includes(flightPhase),
whichCodeToReturn: [0],
codesToReturn: ['000056701'],
memoInhibit: false,
failure: 0,
sysPage: -1,
side: 'RIGHT',
},
};

/* TO CONFIG */
Expand Down Expand Up @@ -1697,6 +1710,7 @@ const PseudoFWC: React.FC = () => {
unit,
usrStartRefueling,
wingAntiIce,
voiceVHF3,
]);

useEffect(() => {
Expand Down
37 changes: 32 additions & 5 deletions src/instruments/src/RMP/Components/RadioPanelDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ interface Props {
value: number | string,
}

const TEXT_DATA_MODE_VHF3 = 'DATA';

/**
* Format the given frequency to be displayed.
* @param frequency The given frequency number in Hz.
Expand All @@ -23,14 +25,39 @@ const formatFrequency = (frequency: number): string => (frequency / 1000000).toF
export function RadioPanelDisplay(props: Props) {
const [lightsTest] = useSimVar('L:A32NX_OVHD_INTLT_ANN', 'Boolean', 1000);

// If the passed value prop is a number, we'll use formatFrequency to get string format.
const value = typeof props.value === 'number' ? formatFrequency(props.value) : props.value;
let content: JSX.Element;

return (
<svg className="rmp-svg">
if (lightsTest === 0) {
content = (
<text x="100%" y="52%">
8.8.8.8.8.8
</text>
);
} else if (props.value > 0) {
let value = '';
// If the passed value prop is a number, we'll use formatFrequency to get string format.
if (typeof props.value === 'number') {
value = formatFrequency(props.value);
} else {
value = props.value;
}

content = (
<text x="100%" y="52%">
{lightsTest === 0 ? '8.8.8.8.8.8' : value}
{value}
</text>
);
} else {
content = (
<text x="85%" y="52%">
{TEXT_DATA_MODE_VHF3}
</text>
);
}

return (
<svg className="rmp-svg">
{content}
</svg>
);
}
41 changes: 24 additions & 17 deletions src/instruments/src/RMP/Components/StandbyFrequency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,29 +103,36 @@ export const StandbyFrequency = (props: Props) => {
const spacing = usePersistentProperty('RMP_VHF_SPACING_25KHZ', '0')[0] === '0' ? 8.33 : 25;
// Handle outer knob turned.
const outerKnobUpdateCallback: UpdateValueCallback = useCallback((offset) => {
const frequency = Math.round(props.value / 1000);
const integer = Math.floor(frequency / 1000);
const decimal = frequency % 1000;
// @todo determine min/max depending on mode.
const maxInteger = decimal > 975 ? 135 : 136;
const newInteger = Utils.Clamp(integer + offset, 118, maxInteger);
props.setValue((newInteger * 1000 + decimal) * 1000);
if (props.value !== 0) {
const frequency = Math.round(props.value / 1000);
const integer = Math.floor(frequency / 1000);
const decimal = frequency % 1000;
// @todo determine min/max depending on mode.
const maxInteger = decimal > 975 ? 135 : 136;
const newInteger = Utils.Clamp(integer + offset, 118, maxInteger);
props.setValue((newInteger * 1000 + decimal) * 1000);
} else {
props.setValue(0);
}
}, [props.value]);

// Handle inner knob turned.
const innerKnobUpdateCallback: UpdateValueCallback = useCallback((offset) => {
const frequency = Math.round(props.value / 1000);
if (Math.sign(offset) === 1 && frequency === 136975) {
return;
if (props.value !== 0) {
const integer = Math.floor(frequency / 1000);
// @todo determine correct frequency spacing depending on mode.
const decimal = offsetFrequencyChannel(spacing, frequency % 1000, offset);
// @todo determine min/max depending on mode.
// Tested in real life:
// Integer cannot return to 118 from 136 to the right
// Decimal can return to 0 from 975 to the right
// const maxDecimal = integer === 136 ? 975 : 1000;
const newDecimal = Utils.Clamp(decimal, 0, 1000);
props.setValue((integer * 1000 + newDecimal) * 1000);
} else {
props.setValue(0);
}

const integer = Math.floor(frequency / 1000);
// @todo determine correct frequency spacing depending on mode.
const decimal = offsetFrequencyChannel(spacing, frequency % 1000, offset);
// @todo determine min/max depending on mode.
const maxDecimal = integer === 136 ? 975 : 1000;
const newDecimal = Utils.Clamp(decimal, 0, maxDecimal);
props.setValue((integer * 1000 + newDecimal) * 1000);
}, [props.value]);

// Used to change integer value of freq.
Expand Down
6 changes: 6 additions & 0 deletions src/instruments/src/RMP/Components/VhfRadioPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ const useStandbyVhfFrequency = (side: string, transceiver: number) => {
export const VhfRadioPanel = (props: Props) => {
const [active, setActive] = useActiveVhfFrequency(props.transceiver);
const [standby, setStandby] = useStandbyVhfFrequency(props.side, props.transceiver);
const [, setValueOppositePanelStandby] = props.side === 'L' ? useStandbyVhfFrequency('R', 3) : useStandbyVhfFrequency('L', 3);

// Handle Transfer Button Pressed.
useInteractionEvent(`A32NX_RMP_${props.side}_TRANSFER_BUTTON_PRESSED`, () => {
// Force the standby opposite side otherwise we would lose the frequency/data format
// Otherwise it would become frequency/frequency
if (props.transceiver === 3) {
setValueOppositePanelStandby(active);
}
setActive(standby);
setStandby(active);
});
Expand Down