# Vacuum-control STM32G030F6P6 diagnostic runtime candidate

Run `sh 固件/vacuum_target/build.sh` from the engineering-package root. This build reuses the pinned CMSIS Device/Core sources and linker script in `固件/lamp_target/`, matching the STM32G030F6P6 selected in `硬件/vacuum_control/`.

The application initializes the 16 MHz reset-clock timebase, PA8/TIM1_CH1 at a 25 kHz candidate rate, ADC channels on PA0/PA3/PA4, rising-edge tach counting on PA1, and the active-low panel key input on PA2. It samples the inputs every 100 ms and publishes raw counts plus nominal divider/shunt estimates and the fan-policy status for debugger inspection. Estimates assume 3.3 V VDDA, a 330 kΩ/56 kΩ VBUS divider, INA180A1 gain 20 V/V, and a 10 mΩ shunt; they are not calibrated.

The `fan_manager` now runs in the target service loop. PA2 is treated as a provisional run request only to exercise the fail-closed path. Measurements and the fan profile remain invalid, so the manager returns NOT_READY on a request. A second target-side output lock rejects all fan-power-on and nonzero-duty requests even if the policy inputs change accidentally. The active-high PA10 power gate is forced low and TIM1 CCR1 remains zero on every service pass.

The policy candidate now consumes the PA1 tach-edge count and has a parameterized stall trip. It allows a measured startup grace period, then latches the fan off when tach edges in a 100 ms window remain below the configured minimum. The edge threshold and grace period must be derived from the selected blower's tach pulses/revolution and measured spin-up; both remain zero/invalid in the target app, so this protection does not grant output permission.

This target link and host policy/output-lock tests do not establish the correct key mapping, blower model, PWM polarity, tach pulses/revolution, electrical limits, airflow, noise, temperature rise, or ADC calibration. No target MCU has been flashed or run. The fan remains disabled pending engineer/factory bench measurements and a signed-off fan profile; dust collection and product equivalence are unverified.
