A format tells Pelican how to decode a signal from the response of a command. Pelican calculates the value like this:
var value: Double
if sign {
value = SignedBitReader(response, bix, len)
} else {
value = UnsignedBitReader(response, bix, len)
}
value = (value * mul / div + add).clamped(to: min...max)
return Measurement(value: value, unit: unit)
Properties
The OBDb schema defines these properties:
| Property | Type | Required | Description |
|---|---|---|---|
bix | integer | No | Bit index in the response where the signal starts |
len | integer | Yes | Length of the signal in bits |
blsb | boolean | No | Byte is LSB (Least Significant Bit) first |
sign | boolean | No | Whether the value is signed |
min | number | No | Minimum valid scaled value for the signal |
max | number | No | Maximum valid scaled value for the signal |
add | number | No | Offset to add to the raw value |
mul | number | No | Multiplier to apply to the raw value |
div | number | No | Divisor to apply to the raw value |
unit | string | No | Unit of measurement for the signal |
nullmin | number | No | Values below or equal to this value are considered null |
nullmax | number | No | Values above or equal to this value are considered null |
omin | number | No | Optimal minimum scaled value |
omax | number | No | Optimal maximum scaled value |
oval | number | No | Optimal scaled value |
map | object | No | Enumeration of raw values (integer-keyed) to human-readable values |
The format requires either map, or both max and unit.