Air Pressure - Subsurface

Linus Torvalds torvalds at linux-foundation.org
Wed Feb 12 13:46:59 UTC 2014


[ Please keep the subsurface list cc'd ]

On Wed, Feb 12, 2014 at 1:30 PM, Pedro Neves <nevesdiver at gmail.com> wrote:
>
> I was wondering where does the Subsurface air pressure value (displayed on
> the Dive Info tab) come from. It shows up as 1000 mbab on the last 3 dives
> on my logbook but it doesn't show up on any other dive...

Generally it comes from the dive computer. If the dive computer
doesn't say anything, we should default to normal surface pressure
(1.013 bar), but that case shouldn't be saved or shown anywhere.

If you see 1000mbar, then we're likely doing something wrong. And
looking at it, this does seem to be completely bogus:

#if DC_VERSION_CHECK(0, 3, 0)
  ...
        double surface_pressure = 1.0;
        rc = dc_parser_get_field(parser, DC_FIELD_ATMOSPHERIC, 0,
&surface_pressure);
        if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
                dev_info(devdata, translate("gettextFromC","Error
obtaining surface pressure"));
                dc_parser_destroy(parser);
                return false;
        }
        dive->dc.surface_pressure.mbar = surface_pressure * 1000.0 + 0.5;
#endif

because the default surface_pressure should *not* be one bar - that
"double surface_pressure = 1.0;" is just wrong.

If the dive computer doesn't report a surface pressure, we should keep
it empty (ie 0). Not a completely incorrect reading of 1 bar.

This bug was introduced in commit b79a8ec3866f ("Importing salinity
and atmospheric pressure from DC.") so it's been in all the 4.0.x
versions afaik. Before that, we only got the surface pressure from
Uemis, iirc, and got that right.

                   Linus


More information about the subsurface mailing list