pub async fn pulse_loop(
resources: RpmResources<'static>,
config: RpmConfig,
on_pulse_hz: fn(f32),
)Expand description
Convenience loop: ticker + read_pulse_hz + callback.
on_pulse_hz is invoked only on state transitions, so callers that
store into a shared atomic don’t get hammered every 100 ms:
- each non-zero reading → pulse rate in Hz
- first zero after non-zero →
0.0(engine just stopped) - [
NO_SIGNAL_INTERVALS] zeros →f32::NAN(signal lost)
Both sentinels survive any linear Hz→rpm conversion the caller applies
(0.0 * k == 0.0, NAN * k == NAN), so the application does not have to
special-case them.
Between the “stopped” and “no signal” transitions the callback is silent, which lets HIL-injected values stick once the rig has been idle long enough.