From b2fab0c374fe08106e7c4b5efe0460f8a0bf9f2d Mon Sep 17 00:00:00 2001 From: karim Date: Tue, 2 Jun 2026 12:15:34 +0200 Subject: [PATCH] G1000 MFD EIS: real two-bus volts, alternator/battery amps, engine hours MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- server/bridge.js | 2 +- server/config.js | 6 ++++-- web/src/components/MFD.jsx | 17 ++++++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/server/bridge.js b/server/bridge.js index 4271de2..ec74d67 100644 --- a/server/bridge.js +++ b/server/bridge.js @@ -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: [ diff --git a/server/config.js b/server/config.js index 303283e..4b1825e 100644 --- a/server/config.js +++ b/server/config.js @@ -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 diff --git a/web/src/components/MFD.jsx b/web/src/components/MFD.jsx index 0fcf0b5..64ad036 100644 --- a/web/src/components/MFD.jsx +++ b/web/src/components/MFD.jsx @@ -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 ( @@ -153,20 +156,20 @@ function EisStrip({ V }) { zones={[{ from: 4.5, to: 5.5, c: '#0c0' }]} /> ENG - 0.0 HRS + {engHrs.toFixed(1)} HRS – ELECTRICAL – M BUS E - {volts.toFixed(1)} + {voltsM.toFixed(1)} VOLTS - {volts.toFixed(1)} + {voltsE.toFixed(1)} M BATT S - {amps >= 0 ? '+' : ''}{amps.toFixed(1)} + {ampsM >= 0 ? '+' : ''}{ampsM.toFixed(1)} AMPS - +0.0 + {ampsS >= 0 ? '+' : ''}{ampsS.toFixed(1)} ); }