Skip to content

Commit

Permalink
enable FUNCTIONS -> HOME/PREVIOUS
Browse files Browse the repository at this point in the history
  • Loading branch information
flogross89 committed Jan 22, 2025
1 parent 560d669 commit fd21331
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion fbw-a380x/src/systems/instruments/src/OIT/OIT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class OIT extends DisplayComponent<OitProps> {
return this.props.laptop.data;
}

private readonly operationMode = Subject.create<OisOperationMode>('flt-ops');
public readonly operationMode = Subject.create<OisOperationMode>('flt-ops');

public readonly hEventConsumer = this.props.bus.getSubscriber<InternalKbdKeyEvent>().on('kbdKeyEvent');

Expand Down
18 changes: 16 additions & 2 deletions fbw-a380x/src/systems/instruments/src/OIT/OitHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,22 @@ export abstract class OitHeader extends DisplayComponent<OitHeaderHeaderProps> {
isActive={SubscribableUtils.toSubscribable(false, true)}
label="FUNCTIONS"
menuItems={[
{ label: 'HOME', action: () => {}, disabled: true },
{ label: 'PREVIOUS', action: () => {}, disabled: true },
{
label: 'HOME',
action: () => {
if (this.props.oit.operationMode.get() === 'flt-ops') {
this.props.uiService.navigateTo('flt-ops');
}
},
},
{
label: 'PREVIOUS',
action: () => {
if (this.props.uiService.canGoBack()) {
this.props.uiService.navigateTo('back');
}
},
},
{ label: 'NEXT', action: () => {}, disabled: true, separatorBelow: true },
{ label: 'PRINT', action: () => {}, disabled: true },
{ label: 'STORE', action: () => {}, disabled: true },
Expand Down
14 changes: 6 additions & 8 deletions fbw-a380x/src/systems/instruments/src/OITlegacy/OitLegacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
setAirframeInfo,
setCabinInfo,
setFlypadInfo,
SimbriefData,
store,
TroubleshootingContextProvider,
useAppDispatch,
Expand Down Expand Up @@ -165,7 +164,6 @@ export const OitEfbPageWrapper: React.FC<OitEfbWrapperProps> = () => {
const [showOfp] = useSimVar(`L:A32NX_OIS_${getDisplayIndex()}_SHOW_OFP`, 'Bool', 100);
const [synchroAvionics] = useSimVar('L:A32NX_OIS_SYNCHRO_AVIONICS', 'number', 100);

const [simBriefData, setSimBriefData] = useState<SimbriefData>();
const [fromAirport, setFromAirport] = useState<string>('');
const [toAirport, setToAirport] = useState<string>('');
const [altnAirport, setAltnAirport] = useState<string>('');
Expand All @@ -184,14 +182,18 @@ export const OitEfbPageWrapper: React.FC<OitEfbWrapperProps> = () => {
(navigraphAuthInfo.loggedIn && navigraphAuthInfo.username) || '',
overrideSimBriefUserID ?? '',
);
setSimBriefData(action.payload);
const newAction = simbriefDataFromFms(simBriefData, fromAirport, toAirport, altnAirport);
const newAction = simbriefDataFromFms(action.payload, fromAirport, toAirport, altnAirport);
dispatch(newAction);
} catch (e) {
console.error(e.message);
}
};

useEffect(() => {
console.log('navigraphAuthInfo.loggedIn, synchroAvionics', navigraphAuthInfo);
updateSimBriefInfo();
}, [navigraphAuthInfo, synchroAvionics]);

useEffect(() => {
const sub = bus.getSubscriber<FmsData & OisInternalData>();
const subs: Subscription[] = [];
Expand Down Expand Up @@ -230,10 +232,6 @@ export const OitEfbPageWrapper: React.FC<OitEfbWrapperProps> = () => {
}, [fromAirport, toAirport, altnAirport]);
*/

useEffect(() => {
updateSimBriefInfo();
}, [navigraphAuthInfo.loggedIn, synchroAvionics]);

return (
<>
{showEfbOverlay && (
Expand Down

0 comments on commit fd21331

Please sign in to comment.