On Montag, 11. November 2019 09:05:18 CET Willem Ferguson wrote:
> There appears to be a bug in Subsurface. Check the attached dive log and
> the rendering of cylinder pressures. Also see attached screenshot. I did
> not notice this until now. Is it perhaps the last merge base don my PR
> that causes this?

Funnily enough, this seems to be an old bug that now becomes active. Consider 
this code in calculate_max_limits_new():

        for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
                int mbar = dive->cylinder[cyl].start.mbar;
                if (mbar > maxpressure)
                        maxpressure = mbar;
                if (mbar < minpressure)
                        minpressure = mbar;
        }

If you have less than MAX_CYLINDERS cylinders (i.e. in 100% of cases), mbar 
will evaluate to 0. Thus, minpressure will be 0 in all cases. This code never 
worked.

What happens now is that this part of the code actually starts to work. But if 
you don't have an "air integrated" computer, you will not have pressure 
readings, so minpressure will remain the minimum start-pressure of any of your 
cylinders.

That gives the funky effect you see.

Possibility 1: if minpressure == maxpressure (meaning that we found no 
pressure reading), set minpressure to 0. This will restore the old behavior 
for non-air integrated computers.

Possibility 2: correctly determine the minimum pressure by looking at the 
profile data not the events.

Berthold


_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to