pub(crate) fn calibration_preference(spec: &CalibrationSpec) -> u8Expand description
Returns how strongly a copy’s calibration is preferred when copies collide.
Higher wins. The archiver writes an unnamed identity calibration
({"id":null,"type":"identity"}) when a channel has no calibration configured,
so identity there means “no calibration known” rather than a deliberate choice.
The same raw sample has been found archived once that way and once with the
channel’s real sensor calibration (for example {"id":"tp3586","type":"linear",..}),
when a backlog was archived again after the calibration was set. Both copies hold
the same raw value, so the calibrated one loses nothing and turns volts into the
sensor’s units, while picking identity would report volts as if they were
calibrated and make the calibrated column jump between copies. Between two
non-identity calibrations there is no such rule, and the copy from the earliest
file (by name, which is the order the archiver wrote them) is kept.
§Arguments
spec- Calibration of one copy.