From c0595717e8d4168ddf47e7e4262e3809cc3efe51 Mon Sep 17 00:00:00 2001 From: Latisha Date: Sun, 6 Sep 2026 23:01:10 +0800 Subject: [PATCH] suunto_nautic: begin pressure = max reading (ignore transmitter dropout) A cylinder only loses pressure during a dive, so the highest reading is the true start pressure. The parser was seeding begin from the FIRST observed reading, which on a dual-transmitter dive can be a pre-pairing dropout: a transmitter that hasn't linked yet reports a spurious low value (~9 bar) for the first minutes, then jumps to the real ~200 bar. That produced a nonsensical tank that gained pressure over the dive (9 -> 109 bar). Take the max over all readings for begin pressure instead. Validated on nandodiver's Air+Air dual-transmitter dives (issue #29/#34): the dropped transmitter's begin now recovers from 9 bar to the real 207 bar; end pressures and the other transmitter are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_012VH1Magk9E9nWusjYQd4oe --- src/suunto_nautic_parser.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/suunto_nautic_parser.c b/src/suunto_nautic_parser.c index 8309801..e68ccb1 100644 --- a/src/suunto_nautic_parser.c +++ b/src/suunto_nautic_parser.c @@ -555,13 +555,22 @@ suunto_nautic_parser_parse (dc_parser_t *abstract, dc_sample_callback_t callback // Cylinder slot index == GasNumber, so this tank // breathes gas i (linked to gasmix[i] below). tank[ntanks].gasmix = i; - // Begin from the first observed reading (the deferred one for Pressure2). + // Seed begin from the first observed reading (the deferred + // one for Pressure2); refined to the max below. tank[ntanks].beginpressure = (field == 1 && p2_first[i] >= 0) ? p2_first[i] / 100000.0 : bar; ntanks++; } unsigned int t = (unsigned int) tankmap[key]; tank[t].endpressure = bar; + // Begin pressure = the highest reading seen: a cylinder only + // loses pressure during a dive, so the max is the true start. + // This ignores an initial dropout where a transmitter that + // hasn't paired yet reports a spurious low value (e.g. ~9 bar + // for the first minutes, then jumps to the real ~200 bar -- + // nandodiver's dual-transmitter dives, issue #29/#34). + if (bar > tank[t].beginpressure) + tank[t].beginpressure = bar; if (callback) { dc_sample_value_t sample = {0}; sample.time = (unsigned int) time_ms;