G1000 MFD EIS: real two-bus volts, alternator/battery amps, engine hours

- electrical readout now shows M (main) and E (essential) bus volts from
  bus_volts[0]/[1], M (alternator generator_amps) and S (battery_amps) separately,
  and ENG hours from flight time — replacing the hardcoded duplicate volts / +0.0
  amps / 0.0 HRS placeholders (manual S.54 C172 layout)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 12:15:34 +02:00
parent 6738e6085b
commit b2fab0c374
3 changed files with 15 additions and 10 deletions
+1 -1
View File
@@ -291,7 +291,7 @@ function startDemo() {
...(process.env.DEMO_RANGE ? { uiMapRange: Number(process.env.DEMO_RANGE) } : {}),
// engine strip (arrays, like the sim)
engRpm: [2410], fuelFlow: [0.0072], oilTemp: [88], oilPress: [52], egt: [720],
fuelQty: [60, 58], volts: [process.env.DEMO_ALERT ? 23.4 : 28.0], amps: [12],
fuelQty: [60, 58], volts: [process.env.DEMO_ALERT ? 23.4 : 28.0, 27.8], amps: [-1.5], genAmps: [20.5], engHrs: 5040,
});
// a sample plan so the map/FMS show something in demo mode
fp.setPlan({ name: 'DEMO', waypoints: [
+4 -2
View File
@@ -96,8 +96,10 @@ export const DATAREFS = {
oilPress: 'sim/cockpit2/engine/indicators/oil_pressure_psi',
egt: 'sim/cockpit2/engine/indicators/EGT_deg_C',
fuelQty: 'sim/cockpit2/fuel/fuel_quantity',
volts: 'sim/cockpit2/electrical/bus_volts',
amps: 'sim/cockpit2/electrical/battery_amps',
volts: 'sim/cockpit2/electrical/bus_volts', // array: [0]=main bus, [1]=essential
amps: 'sim/cockpit2/electrical/battery_amps', // battery (S) amps
genAmps: 'sim/cockpit2/electrical/generator_amps', // alternator (M) amps
engHrs: 'sim/time/total_flight_time_sec', // proxy for engine/tach hours
// --- autopilot readouts (live values, so the panel reflects reality) ---
apState: 'sim/cockpit2/autopilot/autopilot_state', // bitfield of active modes
+10 -7
View File
@@ -136,8 +136,11 @@ function EisStrip({ V }) {
const egtF = egtT > 900 ? egtT : egtT * 9 / 5 + 32;
const fuelL = arr(V.fuelQty, 0) / KG_PER_GAL;
const fuelR = arr(V.fuelQty, 1) / KG_PER_GAL;
const volts = arr(V.volts, 0, 28);
const amps = arr(V.amps);
const voltsM = arr(V.volts, 0, 28); // main bus
const voltsE = arr(V.volts, 1, voltsM); // essential bus (falls back to main)
const ampsM = arr(V.genAmps, 0); // alternator (M)
const ampsS = arr(V.amps, 0); // battery (S)
const engHrs = num(V.engHrs) / 3600;
return (
<svg className="eis-svg" viewBox="0 0 190 540" preserveAspectRatio="xMidYMin meet" fontFamily="monospace">
<rect x="0" y="0" width="190" height="540" fill="#0a0a0a" />
@@ -153,20 +156,20 @@ function EisStrip({ V }) {
zones={[{ from: 4.5, to: 5.5, c: '#0c0' }]} />
<FuelBar y={330} left={fuelL} right={fuelR} />
<text x="8" y="412" fill="#39d3c0" fontSize="12">ENG</text>
<text x="182" y="412" fill="#fff" fontSize="14" textAnchor="end">0.0 HRS</text>
<text x="182" y="412" fill="#fff" fontSize="14" textAnchor="end">{engHrs.toFixed(1)} HRS</text>
<text x="95" y="438" fill="#39d3c0" fontSize="12" textAnchor="middle"> ELECTRICAL </text>
<text x="20" y="462" fill="#fff" fontSize="12">M</text>
<text x="95" y="462" fill="#39d3c0" fontSize="12" textAnchor="middle">BUS</text>
<text x="170" y="462" fill="#fff" fontSize="12" textAnchor="end">E</text>
<text x="18" y="482" fill="#fff" fontSize="15">{volts.toFixed(1)}</text>
<text x="18" y="482" fill="#fff" fontSize="15">{voltsM.toFixed(1)}</text>
<text x="95" y="482" fill="#39d3c0" fontSize="11" textAnchor="middle">VOLTS</text>
<text x="172" y="482" fill="#fff" fontSize="15" textAnchor="end">{volts.toFixed(1)}</text>
<text x="172" y="482" fill="#fff" fontSize="15" textAnchor="end">{voltsE.toFixed(1)}</text>
<text x="20" y="506" fill="#fff" fontSize="12">M</text>
<text x="95" y="506" fill="#39d3c0" fontSize="12" textAnchor="middle">BATT</text>
<text x="170" y="506" fill="#fff" fontSize="12" textAnchor="end">S</text>
<text x="18" y="526" fill="#fff" fontSize="15">{amps >= 0 ? '+' : ''}{amps.toFixed(1)}</text>
<text x="18" y="526" fill="#fff" fontSize="15">{ampsM >= 0 ? '+' : ''}{ampsM.toFixed(1)}</text>
<text x="95" y="526" fill="#39d3c0" fontSize="11" textAnchor="middle">AMPS</text>
<text x="172" y="526" fill="#fff" fontSize="15" textAnchor="end">+0.0</text>
<text x="172" y="526" fill="#fff" fontSize="15" textAnchor="end">{ampsS >= 0 ? '+' : ''}{ampsS.toFixed(1)}</text>
</svg>
);
}