Incorrect tank info.

Dirk Hohndel dirk at hohndel.org
Thu Sep 20 13:56:15 PDT 2012


Jef Driesen <jefdriesen at telenet.be> writes:

> On 24-08-12 11:03, Jef Driesen wrote:
>> What exactly happens if you set the device to air mode? Can you still
>> configure the gasmixes, or is access to the gasmix settings 
>> completely
>> disabled? I'm just trying to understand the logic used by the device.
>> Then we can fix the libdivecomputer code to match that logic.
>>
>> Based on the comments so far, this seems to be what is happening:
>>
>> if (air) {
>>      Ignore the gasmix settings, and assume a single mix with air. 
>> The
>> gasmix settings retain their previous (non-air) values only as a
>> convenience, so you don't have to adjust the settings for your next
>> nitrox and/or multigas dive, but they are not used.
>> } else {
>>      Use the gasmix settings.
>> }
>
> I would like to fix this issue before the 0.2.0 release. I have 
> attached a work-in-progress patch that needs some testing. I think it's 
> correct for the older generation models (Vyper 2, D9, etc), but I 
> suspect that for the newer models (Helo2, D4i, D6i, D9tx, etc) the gas 
> model byte is stored at a different offset.
>
> Normally I can easily test this kind of stuff myself, but for some 
> reason the latest Suunto Dive Manager (SDM) doesn't accept arbitrary 
> serial ports anymore. I guess there is some kind of check for the USB 
> VID/PID, or the FTDI driver. I used to have a linux kernel module to 
> emulate an FTDI usb-serial chip (using the usb gadget interface), but it 
> doesn't compile anymore with recent kernels :-( So for now, I can't get 
> my test data into SDM to confirm the patch is correct, and thus I need 
> some testing with real hardware.

There's this guy on this mailing list who might be able to help you with
getting this to compile under the latest Linux kernel. Have you asked
him for help? :-)

Also, Linus, you have a Vyper Air. Anyone else with Suuntu computers who
could help test Jef's code?

Thanks

/D




> Jefdiff --git a/src/suunto_d9_parser.c b/src/suunto_d9_parser.c
> index fbbe2c7..132e472 100644
> --- a/src/suunto_d9_parser.c
> +++ b/src/suunto_d9_parser.c
> @@ -43,6 +43,10 @@
>  #define D6i      0x1A
>  #define D9tx     0x1B
>  
> +#define AIR    0
> +#define NITROX 1
> +#define GAUGE  2
> +
>  typedef struct suunto_d9_parser_t suunto_d9_parser_t;
>  
>  struct suunto_d9_parser_t {
> @@ -186,6 +190,9 @@ suunto_d9_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigne
>  	if (size < config)
>  		return DC_STATUS_DATAFORMAT;
>  
> +	// Gas model
> +	unsigned int gasmodel = data[0x1D - SKIP];
> +
>  	dc_gasmix_t *gasmix = (dc_gasmix_t *) value;
>  
>  	if (value) {
> @@ -204,7 +211,9 @@ suunto_d9_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigne
>  			*((double *) value) = array_uint16_le (data + 0x0D - SKIP) / 100.0;
>  			break;
>  		case DC_FIELD_GASMIX_COUNT:
> -			if (parser->model == HELO2) {
> +			if (gasmodel == AIR) {
> +				*((unsigned int *) value) = 1;
> +			} else if (parser->model == HELO2) {
>  				*((unsigned int *) value) = 8;
>  			} else if (parser->model == D9tx) {
>  				*((unsigned int *) value) = 8;
> @@ -217,7 +226,10 @@ suunto_d9_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigne
>  			}
>  			break;
>  		case DC_FIELD_GASMIX:
> -			if (parser->model == HELO2) {
> +			if (gasmodel == AIR) {
> +				gasmix->helium = 0.0;
> +				gasmix->oxygen = 0.21;
> +			} else if (parser->model == HELO2) {
>  				gasmix->helium = data[0x58 - SKIP + 6 * flags + 2] / 100.0;
>  				gasmix->oxygen = data[0x58 - SKIP + 6 * flags + 1] / 100.0;
>  			} else if (parser->model == D4i || parser->model == D6i || parser->model == D9tx) {


More information about the subsurface mailing list