deco code rewrite

Jef Driesen jefdriesen at telenet.be
Thu Dec 6 12:51:16 PST 2012


On 06-12-12 16:03, Dirk Hohndel wrote:
> On Dec 6, 2012, at 4:42 AM, Jef Driesen wrote:
>> That's my fault. The predator stores the active gas on each sample, and generating the GASCHANGE2 event on each sample was the quick and easy solution for the first version. But later on, I completely forgot about that (or I was too concentrated on the new design, where the gaschange event will be dropped in favor of an active gas sample) :-)
>
> :-)
>
>> I'll fix this and only generate an event when the gas actually changes.
>
> Good.

Fixed.

>>> - also pO2, pN2 and pHe are wrong
>>
>> Currently only the OC gases are reported by libdivecomputer. I didn't really know how to deal with this. At first, I just wanted to pick either the OC or CC gas mixes, depending on the dive mode. But there is no such setting in the header, only in the samples. Apparently the user can switch from CC to OC during the dive (confirmed by Shearwater), so this is going to be a bit more tricky. Maybe the easiest is to just report both sets, until we have some better solution?
>
> I guess this is for bailout? Your CC fails, you switch to OC?

Yes.

> I think reporting all of the gases would work for now - things could still go wrong since in the current API design we still only get the O2% (or actually O2 & He%) and not a gas index. But it would certainly be an improvement.

Fixed too.

>> The percentages in the GASCHANGE2 event will always be correct, because the percentages are directly stored in the sample data. The OC/CC gases defined in the header are not used for the events.
>
> Subsurface would still like to match the gas with specific tanks so we can do SAC calculations, etc.

Matching gas mixes to tank is something that will have to be done at the 
application level. In most cases we don't have enough info to do this 
automatically at the libdivecomputer level.

For example an air integrated dive model with multiple gasmixes. Which gasmix 
should we assign to the tank for which we have pressure data? What if you have 
two tanks with the same mix. And so on.

In many case you can make a good guess with some simple rules, but only the end 
user has the correct info. For SAC calculations, the user likely needs to 
provide some additional info like the tank volume anyway.

>> PS: As I'm not a rebreather (or technical) diver, I can definitely use some help in that area, to make sure libdivecomputer will also supports those features that technical divers need.
>
> You and me, both :-)

:-)

Jef


More information about the subsurface mailing list