[PATCH] Re: Beta Testing - Dive Planner

Dirk Hohndel dirk at hohndel.org
Mon Sep 14 07:42:39 PDT 2015


I understand that this is all my fault... and we keep saying that we need
to fix this and never do.

Either way - the code below has me a bit unhappy as we start the loop with
sample pointing at the very first sample.

So simply accessing sample[-1]? Probably not a good solution.

Which begs the question, do we need this transition for the first step
(which starts at the surface)?

Can you think this through for the beginning of the loop and send an
updated patch, please?

/D

On Mon, Sep 14, 2015 at 11:30:01AM +0200, Robert Helling wrote:
> From 3619c2b741f6e654706e508099b71401e5bae9dd Mon Sep 17 00:00:00 2001
> From: "Robert C. Helling" <helling at atdotde.de>
> Date: Mon, 14 Sep 2015 11:22:32 +0200
> Subject: [PATCH] Use the correct setpoint in planner
> 
> There is an unfortunate convention that the sample structure contains a setpoint
> at its end rather than during its duration which causes the expression
> sample[-1].setpoint in several places. This adds another one for the planner
> to use the correct setpoint during the manually entered leg of the dive.
> 
> Signed-off-by: Robert C. Helling <helling at atdotde.de>
> ---
>  planner.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/planner.c b/planner.c
> index 2cf4054..eeae5e9 100644
> --- a/planner.c
> +++ b/planner.c
> @@ -165,7 +165,7 @@ void tissue_at_end(struct dive *dive, char **cached_datap)
>  				max_bottom_ceiling_pressure.mbar = ceiling_pressure.mbar;
>  		}
>  
> -		interpolate_transition(dive, t0, t1, lastdepth, sample->depth, &gas, sample->setpoint);
> +		interpolate_transition(dive, t0, t1, lastdepth, sample->depth, &gas, sample[-1].setpoint);
>  		psample = sample;
>  		t0 = t1;
>  	}
> -- 
> 2.3.2 (Apple Git-55)
> 



More information about the subsurface mailing list