[PATCH] Skip unconnected ppo2 sensors

Jef Driesen jef at libdivecomputer.org
Wed Sep 9 05:34:42 PDT 2015


On 2015-09-09 14:12, Anton Lundin wrote:
> On 04 September, 2015 - Jef Driesen wrote:
> 
>> On 2015-09-04 08:28, Jef Driesen wrote:
>> >What I meant was something like the attached patch: If all three
>> >values are zero, there are probably no sensors, and we ignore all
>> >three ppo2 samples. But if there is at least one non-zero value, we
>> >report all three values.
>> 
>> Now with the patch attached!
> 
> Yea, this one is a bit better than the quite blunt one i suggested, but
> still it behaves weirdly in the case you would have one cell who is
> unconnected (floating connection?) in the beginning and gets connected
> a couple of samples in. Then the sensors would be re-numbered.
> 
> This would be solved with having sensor id's =)

I'm probably misunderstanding, but my patch should avoid the renumbering 
problem. Assume we have 3 sensors, and one of them is disconnected, then 
we get something like this:

    ppO2: 0 Y Z   (Sensor 1 disconnected)
    ppO2: X 0 Z   (Sensor 2 disconnected)
    ppO2: X Y 0   (Sensor 3 disconnected)

if it gets reconnected again later:

    ppO2: X Y Z   (All sensors connected)

Thus the order is always preserved. The i-th sample value is always from 
the i-th sensor. Thus although there is no explicit sensor id, it's 
implicit in the sample index. Only when all three sensors are 
disconnected, we drop the ppO2 sample completely.

Am I missing something else?

Jef


More information about the devel mailing list