Skip to content

Commit

Permalink
fix(efb): simbrief load not working on first attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
2hwk committed Jan 2, 2023
1 parent c5e59cf commit 9e16931
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
"stationIndex": 1,
"position": 21.98,
"fill": 0.19,
"bitFlags": "A32NX_PAX_FLAGS_A"
"simVar": "A32NX_PAX_FLAGS_A"
},
{
"name": "ROWS [7-13]",
Expand Down Expand Up @@ -610,7 +610,7 @@
"stationIndex": 2,
"position": 2.86,
"fill": 0.25,
"bitFlags": "A32NX_PAX_FLAGS_B"
"simVar": "A32NX_PAX_FLAGS_B"
},
{
"name": "ROWS [14-21]",
Expand Down Expand Up @@ -973,7 +973,7 @@
"stationIndex": 3,
"position": -15.34,
"fill": 0.28,
"bitFlags": "A32NX_PAX_FLAGS_C"
"simVar": "A32NX_PAX_FLAGS_C"
},
{
"name": "ROWS [22-29]",
Expand Down Expand Up @@ -1336,7 +1336,7 @@
"index": 3,
"stationIndex": 4,
"position": -32.81,
"bitFlags": "A32NX_PAX_FLAGS_D"
"simVar": "A32NX_PAX_FLAGS_D"
}
],
"cargoMap": [
Expand Down
18 changes: 9 additions & 9 deletions src/instruments/src/EFB/Ground/Pages/Payload/Payload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export const Payload = () => {
const { usingMetric } = Units;
const { showModal } = useModals();

const [aFlags] = useSeatFlags(`L:${Loadsheet.seatMap[0].bitFlags}`, Loadsheet.seatMap[0].capacity);
const [bFlags] = useSeatFlags(`L:${Loadsheet.seatMap[1].bitFlags}`, Loadsheet.seatMap[1].capacity);
const [cFlags] = useSeatFlags(`L:${Loadsheet.seatMap[2].bitFlags}`, Loadsheet.seatMap[2].capacity);
const [dFlags] = useSeatFlags(`L:${Loadsheet.seatMap[3].bitFlags}`, Loadsheet.seatMap[3].capacity);
const [aFlags] = useSeatFlags(`L:${Loadsheet.seatMap[0].simVar}`, Loadsheet.seatMap[0].capacity);
const [bFlags] = useSeatFlags(`L:${Loadsheet.seatMap[1].simVar}`, Loadsheet.seatMap[1].capacity);
const [cFlags] = useSeatFlags(`L:${Loadsheet.seatMap[2].simVar}`, Loadsheet.seatMap[2].capacity);
const [dFlags] = useSeatFlags(`L:${Loadsheet.seatMap[3].simVar}`, Loadsheet.seatMap[3].capacity);

const [aFlagsDesired, setAFlagsDesired] = useSeatFlags(`L:${Loadsheet.seatMap[0].bitFlags}_DESIRED`, Loadsheet.seatMap[0].capacity);
const [bFlagsDesired, setBFlagsDesired] = useSeatFlags(`L:${Loadsheet.seatMap[1].bitFlags}_DESIRED`, Loadsheet.seatMap[1].capacity);
const [cFlagsDesired, setCFlagsDesired] = useSeatFlags(`L:${Loadsheet.seatMap[2].bitFlags}_DESIRED`, Loadsheet.seatMap[2].capacity);
const [dFlagsDesired, setDFlagsDesired] = useSeatFlags(`L:${Loadsheet.seatMap[3].bitFlags}_DESIRED`, Loadsheet.seatMap[3].capacity);
const [aFlagsDesired, setAFlagsDesired] = useSeatFlags(`L:${Loadsheet.seatMap[0].simVar}_DESIRED`, Loadsheet.seatMap[0].capacity);
const [bFlagsDesired, setBFlagsDesired] = useSeatFlags(`L:${Loadsheet.seatMap[1].simVar}_DESIRED`, Loadsheet.seatMap[1].capacity);
const [cFlagsDesired, setCFlagsDesired] = useSeatFlags(`L:${Loadsheet.seatMap[2].simVar}_DESIRED`, Loadsheet.seatMap[2].capacity);
const [dFlagsDesired, setDFlagsDesired] = useSeatFlags(`L:${Loadsheet.seatMap[3].simVar}_DESIRED`, Loadsheet.seatMap[3].capacity);

const activeFlags = useMemo(() => [aFlags, bFlags, cFlags, dFlags], [aFlags, bFlags, cFlags, dFlags]);
const desiredFlags = useMemo(() => [aFlagsDesired, bFlagsDesired, cFlagsDesired, dFlagsDesired], [aFlagsDesired, bFlagsDesired, cFlagsDesired, dFlagsDesired]);
Expand Down Expand Up @@ -210,7 +210,7 @@ export const Payload = () => {
fillCargo(i, cargoStationSize[i] / maxCargo, loadableCargoWeight);
}
fillCargo(0, 1, remainingWeight);
}, [...cargoDesired, paxBagWeight, ...cargoStationSize]);
}, [maxCargo, ...cargoStationSize, ...cargoMap, ...cargoDesired, paxBagWeight]);

const calculatePaxMoment = useCallback(() => {
let paxMoment = 0;
Expand Down

0 comments on commit 9e16931

Please sign in to comment.