Skip to main content

rpm_loop

Function rpm_loop 

Source
pub async fn rpm_loop(
    resources: RpmResources<'static>,
    config: RpmConfig,
    on_rpm: fn(f32),
)
Expand description

Convenience loop: ticker + read_rpm + callback.

on_rpm 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 → rpm (measured value)
  • first zero after non-zero → 0.0 (engine just stopped)
  • [NO_SIGNAL_INTERVALS] zeros → f32::NAN (signal lost)

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.