summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2017-07-30 21:05:48 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-30 21:28:34 -0700
commit56c206d19fba315a633404e54c16891db49a97ac (patch)
treed521169ab116ca6082f37b41bb7a58146dedaf38
parent8f0d71ce2b36bbd23e3e5d5d520bcb793797cad6 (diff)
downloadsubsurface-56c206d19fba315a633404e54c16891db49a97ac.tar.gz
For more manual gas pressure details
So the manual gas pressure case keeps showing issues, and in many ways it really is a fairly complex thing, since it needs interpolation of the intermediate pressures - possibly over several gas changes. So you might have beginning and ending pressures for one cylinder, but then use another cylinder in between. We've historically got all the code to do this, but the big rewrite for multiple cylinder pressures didn't get all the details right, and so here's a few more fixes for the case that was shown by a dive by Robert Helling. Hopefully we're approaching the old code situation, except now with concurrent gas pressure handling support. Reported-by: Robert Helling <helling@atdotde.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/gaspressures.c20
-rw-r--r--core/profile.c4
2 files changed, 13 insertions, 11 deletions
diff --git a/core/gaspressures.c b/core/gaspressures.c
index 13196b61f..ce88df047 100644
--- a/core/gaspressures.c
+++ b/core/gaspressures.c
@@ -409,16 +409,6 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s
current->end = pressure;
}
- // If we have no pressure information, we will need to
- // continue with or without a tracking entry. Mark any
- // existing tracking entry as non-dense, and remember
- // to fill in interpolated data.
- if (!pressure) {
- missing_pr = 1;
- dense = 0;
- continue;
- }
-
// We have a final pressure for 'current'
// If a gas switch has occurred, finish the
// current pressure track entry and continue
@@ -429,6 +419,16 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s
continue;
}
+ // If we have no pressure information, we will need to
+ // continue with or without a tracking entry. Mark any
+ // existing tracking entry as non-dense, and remember
+ // to fill in interpolated data.
+ if (current && !pressure) {
+ missing_pr = 1;
+ dense = 0;
+ continue;
+ }
+
// If we already have a pressure tracking entry, and
// it has not had any missing samples, just continue
// using it - there's nothing to interpolate yet.
diff --git a/core/profile.c b/core/profile.c
index 7b5827416..eccbb5612 100644
--- a/core/profile.c
+++ b/core/profile.c
@@ -816,13 +816,15 @@ static void add_plot_pressure(struct plot_info *pi, int time, int cyl, int mbar)
static void setup_gas_sensor_pressure(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)
{
- int prev = -1, i;
+ int prev, i;
struct event *ev;
unsigned int seen[MAX_CYLINDERS] = { 0, };
unsigned int first[MAX_CYLINDERS] = { 0, };
unsigned int last[MAX_CYLINDERS] = { 0, };
struct divecomputer *secondary;
+ prev = explicit_first_cylinder(dive, dc);
+ seen[prev] = 1;
for (i = 0; i < MAX_CYLINDERS; i++)
last[i] = INT_MAX;