Shearwater: Add Sensor Calibration Info.
Add the calibration values for ppO2 sonsors in CCR mode as extra info fields. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
6e65428fc8
commit
a7fb341fb0
@ -727,25 +727,31 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser)
|
||||
dc_field_add_string_fmt(&parser->cache, "Logversion", "%d%s", logversion, pnf ? "(PNF)" : "");
|
||||
|
||||
// Cache sensor calibration for later use
|
||||
unsigned int nsensors = 0;
|
||||
unsigned int base = parser->opening[3] + (pnf ? 6 : 86);
|
||||
parser->calibrated = data[base];
|
||||
|
||||
for (size_t i = 0; i < 3; ++i) {
|
||||
unsigned int calibration = array_uint16_be(data + base + 1 + i * 2);
|
||||
parser->calibration[i] = calibration / 100000.0;
|
||||
if (parser->model == PREDATOR) {
|
||||
// The Predator expects the mV output of the cells to be
|
||||
// within 30mV to 70mV in 100% O2 at 1 atmosphere. If the
|
||||
// calibration value is scaled with a factor 2.2, then the
|
||||
// sensors lines up and matches the average.
|
||||
parser->calibration[i] *= 2.2;
|
||||
}
|
||||
if (data[base] & (1 << i)) {
|
||||
nsensors++;
|
||||
if (parser->calibrated & (1 << i)) {
|
||||
unsigned int calibration = array_uint16_be(data + base + 1 + i * 2);
|
||||
parser->calibration[i] = calibration / 100000.0;
|
||||
if (parser->model == PREDATOR) {
|
||||
// The Predator expects the mV output of the cells to be
|
||||
// within 30mV to 70mV in 100% O2 at 1 atmosphere. If the
|
||||
// calibration value is scaled with a factor 2.2, then the
|
||||
// sensors lines up and matches the average.
|
||||
parser->calibration[i] *= 2.2;
|
||||
}
|
||||
|
||||
static const char *name[] = {
|
||||
"Sensor 1 calibration [bar / V]",
|
||||
"Sensor 2 calibration [bar / V]",
|
||||
"Sensor 3 calibration [bar / V]",
|
||||
};
|
||||
dc_field_add_string_fmt(&parser->cache, name[i], "%.2f", parser->calibration[i] * 1000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
parser->calibrated = data[base];
|
||||
|
||||
// Get the dive mode from the header (if available).
|
||||
if (logversion >= 8) {
|
||||
divemode = data[parser->opening[4] + (pnf ? 1 : 112)];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user