pub fn revolution_annotation(
clicks_from_zero: i64,
clicks_per_revolution: u32,
) -> Option<(u32, u32)>Expand description
Splits a DIAL-space click count measured from zero into (revolutions, clicks_within_the_revolution), for a turret whose cap marks revolutions every
clicks_per_revolution clicks — e.g. rendering “2 revolutions + 7 clicks” instead of a
bare click count the shooter has to do the division on in their head under time
pressure.
clicks_from_zero is DIAL-space, measured from the CURRENT ZERO (see the module
docs) — like every other turret quantity here, NOT from the turret’s mechanical
bottom.
Returns None for:
- a negative
clicks_from_zero. Turret revolution indicators count UP from zero, so a setting below zero has no revolution to report: “-7 clicks” is unambiguous, while any revolutions-plus-clicks decomposition of a negative count invents a direction of revolution the turret does not have. Callers with a below-zero setting should render the plain (negative) click count directly instead of calling this function. clicks_per_revolution == 0, which has no meaningful revolution length (and would be a division by zero).OpticProfile::validaterejectsSome(0)for the analogous reason, but this free function takes a bareu32, not anOpticProfile, and so has no other way to reject an invalid revolution length.
Otherwise returns Some((revolutions, clicks_in_revolution)) with
clicks_in_revolution < clicks_per_revolution and the reconstruction identity
revolutions * clicks_per_revolution + clicks_in_revolution == clicks_from_zero
(ordinary non-negative integer division and remainder).