Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/shearwater_predator_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,12 +680,26 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser)
nsensors++;
}
}
if (nsensors && nsensors == ndefaults) {
if (nsensors && nsensors == ndefaults && !pnf) {
// If all (calibrated) sensors still have their factory default
// calibration values (2100), they are probably not calibrated
// properly. To avoid returning incorrect ppO2 values to the
// application, they are manually disabled (e.g. marked as
// uncalibrated).
//
// Submersion patch (Shearwater PNF O2 cells): restricted to the
// legacy layout this heuristic was written for. The Petrel Native
// Format records an explicit per-cell calibrated flag in the same
// byte read above, and a Petrel 3 sets it for all three cells while
// writing 2100 for each of them -- so on PNF the default value says
// nothing about whether the diver calibrated, and suppressing on it
// discards cells the computer itself reports as calibrated. 2100 is
// also the factor the computer uses: it displays ppO2 1.3 where the
// cells read 62/65/62 mV, and median(62) * 0.021 = 1.302. Verified
// against the log in test/native/fixtures/petrel3_ccr_o2_cells.bin,
// whose cells track the computer's own voted ppO2 within 0.05 bar
// across the whole dive. See
// packages/libdivecomputer_plugin/patches/0005-shearwater-pnf-o2-cell-calibration.patch.
WARNING (abstract->context, "Disabled all O2 sensors due to a default calibration value.");
parser->calibrated = 0;
} else {
Expand Down