wrongly displayed Safetystop

Dirk Hohndel dirk at hohndel.org
Thu Jan 31 16:04:58 PST 2013


Jan Schubert <Jan.Schubert at GMX.li> writes:

> In all of my profiles from OSTC and Predator I get a Safetystop
> displayed in the mouse over dialog after the official deco is finished
> until surfacing. The stop seems to be displayed regardless if the
> calculated deco is finished or not but only seems to be there in cases
> there is deco calculated. Funny enough, in some cases it also seems to
> be there before a deco got calculated, I did not find any specific
> pattern so far.
>
> Tracking down I found that the there is even an entry for "stoptime" in
> the XML, so the GUI is correct, but I've no idea where this is coming from.
>
> The safety stop should not be there and there is not even such a thing
> like safety stop implemented in the Predator. Any ideas?

If you have a stopdepth > 0 and positive NDL then Subsurface thinks your
computer wants you to do a safety stop. Because what else could that
mean? You have NDL, so you don't have a ceiling, so you are not in
deco... so your divecomputer wants you to be at a certain depth... 
that's a safety stop, right?

And you can see that pattern in the XML file that you sent.

So I think the issue is that we don't see the end of the deco
obligation, i.e., the stopdepth doesn't reset back down to 0 for some
reason.

My guess is that this is an issue with what libdivecomputer gives us (or
how we interpret it). Here's the code in src/shearwater_predator_parser.c:

                // Deco stop / NDL.
                unsigned int decostop = array_uint16_be (data + offset + 2);
                if (decostop) {
                        sample.deco.type = DC_DECO_DECOSTOP;
                        if (units == IMPERIAL)
                                sample.deco.depth = decostop * FEET;
                        else
                                sample.deco.depth = decostop;
                } else {
                        sample.deco.type = DC_DECO_NDL;
                        sample.deco.depth = 0.0;
                }
                sample.deco.time = data[offset + 9] * 60;
                if (callback) callback (DC_SAMPLE_DECO, sample, userdata);

It definitely gives us a depth of 0 once we see positive NDL. But it
looks like we are ignoring that.

Can you try this patch?


diff --git a/libdivecomputer.c b/libdivecomputer.c
index e0d1809..d41c27b 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -249,6 +249,7 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
        case DC_SAMPLE_DECO:
                if (value.deco.type == DC_DECO_NDL) {
                        sample->ndl.seconds = ndl = value.deco.time;
+                       sample->stopdepth.mm = stopdepth = value.deco.depth * 1000.0 + 0.5;
                        sample->in_deco = in_deco = FALSE;
                } else if (value.deco.type == DC_DECO_DECOSTOP ||
                           value.deco.type == DC_DECO_DEEPSTOP) {


/D



More information about the subsurface mailing list