[PATCH] Predator: don't report PPO2 unless in CC mode

Dirk Hohndel dirk at hohndel.org
Sat Feb 7 10:31:38 PST 2015


This should of course say "Shearwater Petrel/Predator".
I looked through the sources and the only other dive computer that
supports DC_SAMPLE_PPO2 is the Diverite Nitekq and that one already only
sends this event when a sample is explicitly marked as CC sample... so
this change is consistent with behavior elsewhere.

/D

On Sat, Feb 07, 2015 at 10:28:33AM -0800, Dirk Hohndel wrote:
> Sending this in OC mode is redundant and might confuse applications that
> assume they only get PPO2 data in CC mode.
> 
> Signed-off-by: Dirk Hohndel <dirk at hohndel.org>
> ---
>  src/shearwater_predator_parser.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c
> index 32200f1ef552..eac3a3b21fe7 100644
> --- a/src/shearwater_predator_parser.c
> +++ b/src/shearwater_predator_parser.c
> @@ -325,9 +325,11 @@ shearwater_predator_parser_samples_foreach (dc_parser_t *abstract, dc_sample_cal
>  			sample.temperature = temperature;
>  		if (callback) callback (DC_SAMPLE_TEMPERATURE, sample, userdata);
>  
> -		// PPO2
> -		sample.ppo2 = data[offset + 6] / 100.0;
> -		if (callback) callback (DC_SAMPLE_PPO2, sample, userdata);
> +		// PPO2 -- only return PPO2 if we are in closed circuit mode
> +		if (data[offset + 11] & 0x10 == 0) {
> +			sample.ppo2 = data[offset + 6] / 100.0;
> +			if (callback) callback (DC_SAMPLE_PPO2, sample, userdata);
> +		}
>  
>  		// Gaschange.
>  		unsigned int o2 = data[offset + 7];
> -- 
> 1.8.0.rc0.18.gf84667d
> 
> _______________________________________________
> devel mailing list
> devel at libdivecomputer.org
> http://libdivecomputer.org/cgi-bin/mailman/listinfo/devel


More information about the devel mailing list