[PATCH 2/2] Properly clear sensor pressure data for synthetic plotinfo entries

Linus Torvalds torvalds at linux-foundation.org
Fri Oct 6 11:01:50 PDT 2017


On Fri, Oct 6, 2017 at 10:46 AM, Stefan Fuchs <sfuchs at gmx.de> wrote:
>
> Could you please have a quick look at this:
> https://github.com/Subsurface-divelog/subsurface/pull/628

That looks right.

Alternatively, if the planner really wants to set pressures by hand
(I'm not sure why it would want to, but whatever) maybe that

        sample->pressure[0].mbar = cyl->sample_end.mbar;

line should do

        add_sample_pressure(sample, dp->cylinderid, cyl->sample_end.mbar);

which at least gets the cylinder ID right. That may have been the
problem with the old code, it just set the pressure without ever
setting the cylinder ID.

NOTE! There's three of those

        sample->pressure[0].mbar = ...

lines in the planner there, and you only removed one (the "middle
case"). The two others should probably also either be removed or made
to use that add_sample_pressure() helper.

I'm not sure why the planner adds those sample pressures at all, since
the profile logic should just "do the right thing" based on gas change
events and the beginning/ending pressures of the cylinders.

But there may be valid reasons why the planner does this all, I don't
know the planner code at all.

                 Linus


More information about the subsurface mailing list