[PATCH] Profile support for multiple concurrent pressure sensors

Linus Torvalds torvalds at linux-foundation.org
Sun Jul 30 12:37:37 PDT 2017


On Sun, Jul 30, 2017 at 12:23 PM, Robert Helling <helling at atdotde.de> wrote:
>
> here is a dive from my log. The bulk part of the dive, I breath air from my
> D12 (but there is no initial gas change event), then during ascend switch to
> a stage bottle with some nitrox for a few minutes and finally back to air. I
> don’t have sensors, so all I logged were the initial and final pressures.
>
> The new code does not realise I am breathing air throughout most of the dive
> and attributes all the air gas use to the final segment after switching
> back.

Yes, so this is another bug in the manual gas thing.

And I thought it was trivial to fix, but when I do, it ends up
thinking that you're breathing both for a while.

Here's that trivial fix that does the odd "double breathing" thing.
I'll have to run out now, so no time to figure out why it didn't
properly break the thing when the gas switch happened.

The logic for breaking the segment is in
populate_pressure_information() in case somebody else ends yup looking
at this.

                 Linus
-------------- next part --------------
 core/profile.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/profile.c b/core/profile.c
index 7b582741..eccbb561 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;
 


More information about the subsurface mailing list