[PATCH] Correct bug: setpoint handling of Poseidon CCR dive logs

Willem Ferguson willemferguson at zoology.up.ac.za
Wed Oct 29 13:10:56 PDT 2014

On 29/10/2014 21:22, Dirk Hohndel wrote:
> On Wed, Oct 29, 2014 at 09:05:10PM +0200, Willem Ferguson wrote:
>> On 29/10/2014 20:36, Dirk Hohndel wrote:
>>> On Wed, Oct 29, 2014 at 07:57:38PM +0200, Willem Ferguson wrote:
>>>> @@ -1178,6 +1178,10 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
>>>>   				mintemp = temp;
>>>>   		}
>>>> +		// If there are consecutive identical O2 setpoint readings, throw away the redundant ones.
>>>> +		if (sample->setpoint.mbar == lastsetpoint)
>>>> +				sample->setpoint.mbar = 0;
>>> I believe we came to the conclusion that this was the wrong thing to do
>>> A setpoint of 0 indicates an OC dive...
>>> Can you explain why you need this?
>> An excellent question. In dive.c the criterion was whether a po2 partial
>> pressure is specified or not. If not, an OC dive is assumed. For instance
>> see function fill_pressures() in dive.c. Clearly there is some care required
>> here when zeroing out all the duplicate values. The setpoint values are
>> highly repetitive and, if not zeroed out, will really create a lot of
>> additional space requirement.
> Nonono. Of course they get zeroed out when WRITING them to XML. But they
> should NOT need to be zeroed out in memory. I will spare you the obvious
> jokes here...
>> On the other hand the pressures.o2 values are
>> not zeroed out since it is calculated much later in the process, after the
>> plotdata structures have been initialised. On the other hand, the raw sensor
>> values (from which pressures.o2 is calculated) are zeroed out. Hope this
>> argument sounds half-logical??
> No, it completely loses me, actually.
> I think in memory we should NOT set anything to 0. When the setpoint
> switches to 0 that means we are bailing out to OC...
> /D

In fixup_dive_dc() there has always been some zeroing out from the 
beginning, I m reasonably sure in the original code from Linus. But that 
related to tank pressures and temperature, not oxygen values. In that 
function I added some zeroing out of oxygen-related variables in an 
attempt to be consistent. Your argument makes good sense. Should I only 
remove zeroing out for the setpoint or should I do for all 
oxygen-related variables?
Kind regards,

More information about the subsurface mailing list