FCU Simulator

Real fcu-core + fcu-proto compiled to WebAssembly; firmware glue and analog front end modelled.
t = 0.000 s
Status LED
off
firmware/led.rs pattern
FireController
—
no fault
Power
Off
—
Trigger classifier
—
—
AUX / safety
—
—
Shots · ROF
0
—

Trigger board

Hold the button or the Space key. The trigger is sampled every 274.7 µs.
0.0 mT

Front end (model)

Power

7.60 V

Short press opens the 2 min pairing window, 3 s hold powers off, 30 min without activity powers off. Changing VBAT here is a slow drift seen by the battery monitor; boot-time detection (bench / 2S / 3S / unsupported) needs a re-plug.

Fault injection

Cable (FCU U9 ↔ trigger board)

Shorts at the connector

Solenoid coils

App (BLE, connected + bonded)

—

Status frame (fcu-proto encode → decode)

Settings

ms ms ms shots/s V (LINEAR) V (LINEAR)

Values are sent unchanged (no client-side clamping), encoded with fcu_proto::encode, decoded with fcu_proto::decode and validated by FireController::set_config (Busy while a shot is in progress), like a BLE CONFIG write. Applied settings are lost at power-off unless saved.

Scenarios

Fire control (FireController)

Trigger classifier

blocked = AUX SAFE (with AUX input = safety switch), LINEAR above 2.8 V or below 1.5 V, or DIP moved. State name inferred for display from the classifier's inputs and outputs; the decision is the real Classifier.

Power

Scope

dashed red: classifier bands · ticks: scans · ▲ coil-current samples · | shot start

Event log

What this simulates / what it doesn't

Real code (compiled from fw/, unmodified)

  • fcu_core::FireController: every state change, ROF limit, debounce, faults, set_config.
  • fcu_core::trigger::Classifier (update_with, bands, re-arm rule, 5 ms fault qualification, DIP mismatch, AuxMode).
  • fcu_core::power::{PowerManager, PowerSource}, battery::BatteryMonitor, diag::{classify, settled_ma}, ShotPlan (edges, hard-off, sample points), Config::validate.
  • fcu_proto: Config / Command / Status encode, decode; the status panel shows the decoded frame.

Mirrored firmware glue (re-typed, cited in fw/sim-web/src/sim.rs)

  • trigger.rs scan loop (9 RTC ticks = 274.7 µs, ADC conversions, raise TriggerInput, on_trigger, shot, coil diagnosis, on_shot_done, ticker.reset).
  • shot.rs (edges at +1 µs, hard-off + 500 µs, sample points with ADC latency 26/38 µs, end at hard-off + 50 µs).
  • power.rs (boot VBAT average, detect, arm, 100 ms tick restarted by button edges, VBAT every 250 ms not while firing, power_off sequence), state.rs arm/status, ble.rs command / config handlers and pairing window, led.rs pattern, storage.rs load_config.

Modelled / approximated

    Usage note: stock 2-wire microswitch

    • A stock switch has no AUX wire, so R11 pulls AUX to 3.3 V = SAFE: with the default config every press is blocked while the engine shows READY and the LED is steady green (no fault; only Status.aux_safe tells). It needs DIP SW3 = LEGACY and AUX input = Ignored (aux_mode). Try the two "Stock" scenarios.

    Findings surfaced by the simulator

    • Broken 3V3_TRG wire (T1-L), not yet bench-tested: without a bleed this behavioural model put TRIG at ~1.03–1.10 V, just above the old 1.0 V threshold (no fire, but no fault either). Now the board has R38 (1 k, 3V3_TRG → GND) and the LINEAR fault threshold is 1.5 V: TRIG settles at ~0.89 V, so Fault::TriggerInput, no fire, in both safety positions. The bench test listed in the docs is still needed.
    • Shorted coil: the shot is now cut short. A guard read 100 µs after each turn-on (plus the 45 % / 90 % reads) aborts the pulse at once when it reads ≥ 3.0 A (diag::aborts_shot), instead of driving the short for the whole dwell. Scenario "Shorted coil A".
    • After changing aux_mode, a press in the very next scan does not count (the classifier needs a released level first). By design.

    Fixed in fcu-core since the simulator found them

    • CoilShort was practically never raised: ISENSE saturates at ~3.28 A, so vbat / i stayed above the 2 Ω threshold at any 2S/3S voltage. Now a sample ≥ 3.0 A is a short too (diag::SHORT_AT_OR_ABOVE_MA). Scenario "Shorted coil A".
    • A config write during a shot was answered Rejected(ShotLongerThanRofInterval); it is now Busy (SetConfigError::Busy). Use 0.01× and Apply while FIRING.