mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Profile: fix pressure scale
The determination of minimum pressure in calculate_max_limits_new() in profile.c was wrong for a long time. Since the loop went over all cylinders (even unused ones), the minimum pressure was always zero. Since we loop only over used cylinders, the minimum pressure was initialized to the lowest starting pressure of any cylinder. If there were no events with pressure change, the minimum pressure stayed unchanged, resulting in a funky scaling. Instead, let's initialize the minimum pressure to the lowest ending pressure. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ebaac21ef5
commit
b850384100
1 changed files with 6 additions and 5 deletions
|
@ -414,11 +414,12 @@ static void calculate_max_limits_new(struct dive *dive, struct divecomputer *giv
|
|||
|
||||
/* Get the per-cylinder maximum pressure if they are manual */
|
||||
for (cyl = 0; cyl < dive->cylinders.nr; cyl++) {
|
||||
int mbar = get_cylinder(dive, cyl)->start.mbar;
|
||||
if (mbar > maxpressure)
|
||||
maxpressure = mbar;
|
||||
if (mbar < minpressure)
|
||||
minpressure = mbar;
|
||||
int mbar_start = get_cylinder(dive, cyl)->start.mbar;
|
||||
int mbar_end = get_cylinder(dive, cyl)->end.mbar;
|
||||
if (mbar_start > maxpressure)
|
||||
maxpressure = mbar_start;
|
||||
if (mbar_end < minpressure)
|
||||
minpressure = mbar_end;
|
||||
}
|
||||
|
||||
/* Then do all the samples from all the dive computers */
|
||||
|
|
Loading…
Add table
Reference in a new issue