Skip to content

Commit

Permalink
fix(ND): adjust true indications based on new refs
Browse files Browse the repository at this point in the history
  • Loading branch information
tracernz committed Dec 21, 2022
1 parent ab90e3c commit e745f46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/instruments/src/ND/elements/RadioNavInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const VorInfo: React.FC<{index: 1 | 2, trueRef: boolean, mode: Mode }> = ({ inde
const [vorHasDme] = useSimVar(`NAV HAS DME:${index}`, 'bool');
const [dmeDistance] = useSimVar(`NAV DME:${index}`, 'nautical miles');
const [vorAvailable] = useSimVar(`NAV HAS NAV:${index}`, 'boolean');
// FIXME should be database magvar, not just when received
const [stationDeclination] = useSimVar(`NAV MAGVAR:${index}`, 'degrees');
const [stationLocation] = useSimVar(`NAV VOR LATLONALT:${index}`, 'latlonalt');
const [stationRefTrue, setStationRefTrue] = useState(false);
Expand Down Expand Up @@ -93,9 +94,9 @@ const VorInfo: React.FC<{index: 1 | 2, trueRef: boolean, mode: Mode }> = ({ inde
{(vorAvailable || vorHasDme) && vorFrequency > 1 && (
<>
<text x={x} y={722} fontSize={24} className="White">{vorIdent}</text>
<text x={index === 2 ? x - 52 : x + 69} y={692} fontSize={18} className="Magenta" visibility={corrected ? 'inherit' : 'hidden'}>CORR</text>
<text x={index === 2 ? x - 52 : x + 81} y={692} fontSize={18} className="Amber" visibility={magWarning ? 'inherit' : 'hidden'}>MAG</text>
<text x={index === 2 ? x - 52 : x + 69} y={692} fontSize={18} className="Amber" visibility={trueWarning ? 'inherit' : 'hidden'}>TRUE</text>
<text x={index === 2 ? x - 54 : x + 61} y={692} fontSize={20} className="Magenta" visibility={corrected ? 'inherit' : 'hidden'}>CORR</text>
<text x={index === 2 ? x - 54 : x + 73} y={692} fontSize={20} className="Amber" visibility={magWarning ? 'inherit' : 'hidden'}>MAG</text>
<text x={index === 2 ? x - 54 : x + 61} y={692} fontSize={20} className="Amber" visibility={trueWarning ? 'inherit' : 'hidden'}>TRUE</text>
</>
)}
{!(vorAvailable || vorHasDme) && vorFrequency > 1 && (
Expand Down
15 changes: 9 additions & 6 deletions src/instruments/src/ND/elements/TopMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ type GridTrackProps = {

const GridTrack: React.FC<GridTrackProps> = ({ gridTrack }) => (
<>
<rect x={0} width={87} y={-20} height={22} className="White" strokeWidth={1.5} />
<text x={44} fontSize={22} textAnchor="middle">
<rect x={0} width={94} y={-20} height={23} className="White" strokeWidth={1.5} />
<text x={45} fontSize={22} textAnchor="middle">
<tspan className="Green">
{gridTrack?.toFixed(0).padStart(3, '0') ?? ''}
</tspan>
<tspan className="Cyan">°G</tspan>
<tspan className="Cyan">
<tspan dx="-5" dy="8" fontSize={28}>°</tspan>
<tspan dy="-8">G</tspan>
</tspan>
</text>
</>
);
Expand All @@ -36,8 +39,8 @@ type TrueFlagProps = {

const TrueFlag: React.FC<TrueFlagProps> = ({ xOffset = 0, box }) => (
<>
<rect x={-30 + xOffset} width={60} y={-20} height={22} className="Cyan" strokeWidth={1.5} visibility={box ? 'inherit' : 'hidden'} />
<text x={xOffset} fontSize={22} className="Cyan" textAnchor="middle">TRUE</text>
<rect x={-30 + xOffset} width={68} y={-20} height={23} className="Cyan" strokeWidth={1.5} visibility={box ? 'inherit' : 'hidden'} />
<text x={4 + xOffset} fontSize={22} className="Cyan" textAnchor="middle">TRUE</text>
</>
);

Expand Down Expand Up @@ -66,7 +69,7 @@ export const TopMessages: React.FC<TopMessagesProps> = ({ side, ppos, trueTrack,
<text x={0} y={0} fontSize={25} className="Green" textAnchor="middle">{apprMsg ?? ''}</text>
</Layer>
<Layer x={384} y={apprMsg === null ? 36 : 56} visibility={trueRef ? 'visible' : 'hidden'}>
<TrueFlag xOffset={apprMsg === null && gridTrack !== null ? -40 : 0} box={apprMsg === null} />
<TrueFlag xOffset={apprMsg === null && gridTrack !== null ? -54 : 0} box={apprMsg === null} />
<Layer x={0} y={0} visibility={apprMsg === null && gridTrack !== null ? 'inherit' : 'hidden'}>
<GridTrack gridTrack={gridTrack ?? 0} />
</Layer>
Expand Down

0 comments on commit e745f46

Please sign in to comment.