Expand description
Turret adjustment-unit conversions and click-value parsing (MBA-1355).
Shared by the CLI (main.rs) and the WASM terminal (wasm.rs). This lives in the
library crate — not main.rs — so it compiles for wasm32-unknown-unknown with no
feature gate. To avoid a circular dependency on main.rs’s clap AdjustmentUnit
ValueEnum, this module defines its own minimal angular base (ClickBase) and factor
table; main.rs maps its own AdjustmentUnit onto ClickBase/adjustment_factor
locally (see drop_to_adjustment in main.rs).
Structs§
- Adjustment
Display - An adjustment value plus the click-quantization detail (Plan B Task 2).
valueis the whole-click count as anf64on the clicks arm, the plain angle otherwise.quantizedcarries the sub-clickresidualso a caller that needs it doesn’t have to re-derive the click math a second time;Noneon the angular arm, where nothing is quantized. - Click
Value - A turret click graduation, parsed from suffixed CLI/profile syntax like “0.1mil” / “0.25moa” / “0.125smoa” (MBA-1355).
- Quantized
- One quantized dial setting: the detent count nearest
angle, and what remains.residualis in the same angular unit asangle(the click’s base unit) and is DEFINED by the exact reconstruction identityangle == clicks as f64 * click.size + residual(bit-for-bit, by construction).
Enums§
- Adjustment
Unit - Printed adjustment unit for dial columns (MIL/MOA/SMOA/IPHY or whole clicks).
- Click
Base - Angular base unit for a turret click graduation (MBA-1355). A click graduation is always expressed in mil, (true) MOA, or SMOA/IPHY — never in whole clicks itself.
Functions§
- adjustment_
display - The one boundary where zero-set bias, tracking CF, and click quantization compose —
the order is load-bearing (see main.rs’s
zero_set_bias_applies_before_the_cf_divisionandclicks_arm_order_of_operations_is_load_bearingtests) and must not move. - adjustment_
factor - The
(drop_yd / range_yd) * factorconversion factor for aClickBase: - adjustment_
unit_ label - Display label for an
AdjustmentUnitheader/column name (MBA-1355/MBA-1410): every surface that prints one shares this, so the “MIL”/“MOA”/“SMOA”/“IPHY”/“CLICKS” spelling cannot drift between commands. - click_
size_ mil - This click’s size in milliradians, the crate’s true-angular unit.
adjustment_factormaps one physical ratio into each display unit, so conversion is a factor ratio — using the LOCKED printed-table MOA constant (3438; MBA-724), deliberately not 3437.7467. - clicks_
for - Whole-click adjustment for a drop at a range: the angular value in the graduation’s
own base unit divided by the graduation, rounded to the nearest click (ties away from
zero). Sign is preserved. Ranges under 1 yard are defined as zero adjustment, matching
the CLI’s
drop_to_adjustmentshort-range guard. - drop_
to_ adjustment - Convert drop to adjustment unit (MIL, MOA, or SMOA/IPHY).
unitmaps ontoClickBase/adjustment_factor(MBA-1355) so the CLI, the WASM terminal, and the bridge card service share one conversion table. - parse_
click_ value - Parses a suffixed click graduation string. The unit suffix is mandatory — one of
mil,moa,smoa,iphy(iphyis accepted as an alias forsmoa, the identical unit) — and the magnitude must be a positive, finite number. - quantize_
angle - Quantize an angular value (in
click.baseunits) onto a click detent. Rounding is nearest, ties away from zero — identical toclicks_for, which delegates here. - tracking_
cf_ in_ range - MBA-1358: the ONE accepted band for a scope tracking correction factor, shared by the native CLI and the WASM terminal so the two surfaces cannot drift: strictly between 0.5 and 1.5 (a real scope does not mistrack by 50% — values outside the band mean the tall-target test or a hand edit went wrong) and finite.
- unit_
factor_ for_ bias - The
adjustment_factora non-clicksAdjustmentUnitrenders in, for rescaling a MIL-denominated zero-set bias into the active display unit (MBA-1360).Clicksnever reaches this (the clicks arm below works on raw drop); the MIL fallback mirrorsdrop_to_adjustment’s own release-safe arm. - windage_
adjustment_ display - Windage-axis adjustment display (Tier 2 review C1 fix): only pass the click
graduation through to
adjustment_displaywhen the windage axis itself isClicks; otherwise this collapses to the angular path. All windage columns (range-table, wind-card, compare, the PDF dope card’s wind_adj/lead_adj, and the bridge card service) go through this one function so the guard cannot be dropped again. - zero_
banner_ dial_ values - Zero-banner dial values
(MOA, mrad)for a solved zero angle, corrected by the elevation tracking correction factor (MBA-1358).