[PATCH] Add average depth from OSTC/OSTC3 logbook

Jef Driesen jef at libdivecomputer.org
Wed Jan 21 00:50:53 PST 2015


On 2015-01-21 08:38, Anton Lundin wrote:
>  static const hw_ostc_layout_t hw_ostc_layout_ostc = {
>  	3,  /* datetime */
>  	8,  /* maxdepth */
> +	45, /* avgdepth */
>  	10, /* divetime */
>  	15, /* atmospheric */
>  	43, /* salinity */
> @@ -121,6 +123,7 @@ static const hw_ostc_layout_t hw_ostc_layout_ostc = 
> {
>  static const hw_ostc_layout_t hw_ostc_layout_frog = {
>  	9,  /* datetime */
>  	14, /* maxdepth */
> +	UNSUPPORTED, /* avgdepth */
>  	16, /* divetime */
>  	21, /* atmospheric */
>  	43, /* salinity */

This fails to compile because UNSUPPORTED isn't defined. According to 
the frog documentation the average depth is stored at offset 45, just 
like the ostc.

> +		case DC_FIELD_AVGDEPTH:
> +			if (version == 0x22)
> +				return DC_STATUS_UNSUPPORTED;
> +			*((double *) value) = array_uint16_le (data + layout->avgdepth) / 
> 100.0;
> +			break;

With the above info, you no longer need to special case the frog here.

PS: The average depth field is not implemented for any backend. I added 
the field because I thought it made sense at that time. But most 
applications seem to prefer to calculate avg depth from the profile 
(which has the advantage of being able to take into account preferences 
like ignore shallow samples, etc), so I just never bothered to implement 
this.

Jef


More information about the devel mailing list