Skip to main content

Module adjustment

Module adjustment 

Source
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§

AdjustmentDisplay
An adjustment value plus the click-quantization detail (Plan B Task 2). value is the whole-click count as an f64 on the clicks arm, the plain angle otherwise. quantized carries the sub-click residual so a caller that needs it doesn’t have to re-derive the click math a second time; None on the angular arm, where nothing is quantized.
ClickValue
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. residual is in the same angular unit as angle (the click’s base unit) and is DEFINED by the exact reconstruction identity angle == clicks as f64 * click.size + residual (bit-for-bit, by construction).

Enums§

AdjustmentUnit
Printed adjustment unit for dial columns (MIL/MOA/SMOA/IPHY or whole clicks).
ClickBase
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_division and clicks_arm_order_of_operations_is_load_bearing tests) and must not move.
adjustment_factor
The (drop_yd / range_yd) * factor conversion factor for a ClickBase:
adjustment_unit_label
Display label for an AdjustmentUnit header/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_factor maps 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_adjustment short-range guard.
drop_to_adjustment
Convert drop to adjustment unit (MIL, MOA, or SMOA/IPHY). unit maps onto ClickBase/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 (iphy is accepted as an alias for smoa, the identical unit) — and the magnitude must be a positive, finite number.
quantize_angle
Quantize an angular value (in click.base units) onto a click detent. Rounding is nearest, ties away from zero — identical to clicks_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_factor a non-clicks AdjustmentUnit renders in, for rescaling a MIL-denominated zero-set bias into the active display unit (MBA-1360). Clicks never reaches this (the clicks arm below works on raw drop); the MIL fallback mirrors drop_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_display when the windage axis itself is Clicks; 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).