Individual O2 sensor readings
Jef Driesen
jef at libdivecomputer.org
Fri Jun 26 01:16:55 PDT 2015
On 2015-06-25 10:28, Anton Lundin wrote:
> Nowadays Subsurface have a way to represent individual o2 sensor
> values,
> but none of the libdivecomputer backends export such.
>
> The diverite_nitekq and shearwater_predator backends have support for
> exposing DC_SAMPLE_PPO2 samples, which looks to be the calculated /
> voted
> PPO2.
>
> The hwOS-based HW computers have such sensor values stored, and
> probably
> the Shearwater ext devices to. I was thinking about implementing
> support
> for the hwOS based devices, and was thinking if anyone have some
> preference on how such values should be represented in libdivecomputer?
>
>
> Should we go for DC_SAMPLE_PPO2_SENSOR1 or something like that to
> expose
> the individual sensor values? Or do anyone else have some other,
> better,
> idea?
The DC_SAMPLE_PPO2 sample is intended for o2 sensors. But when we added
this type, we didn't take into account the fact that there are typically
multiple o2 sensors on a rebreather. That's why I haven't implemented
this yet for the OSTC (I have the necessary code already lying around,
see attached patch).
In order to support multiple values, we have to introduce some new
structure that carries a sensor id (similar to DC_SAMPLE_PRESSURE):
struct ppo2 {
unsigned int sensor;
double value;
};
And then we can easily deliver multiple DC_SAMPLE_PPO2 values, each with
a different sensor id, to the application. But this obviously breaks
backwards compatibility.
The alternative is to keep the current "double ppo2" field, and just
relax the assumption that there can be only one DC_SAMPLE_PPO2 value per
sample. That's what I did in the attached patch. Applications that are
not prepared for multiple values, will automatically use only one of
them (probably the last one). So I think that's a reasonable solution
for now.
For the nitekq, I'm not 100% sure but I think it's indeed a
calculated/voted ppo2 value. For the shearwater it's the average ppo2.
I'm not sure whether that is an average over the o2 sensors, or a
calculated value. I have the impression it depends on the dive mode,
because the field contains a non-zero value for OC dives too.
The shearwaters do also record ppo2 data for up to three o2 sensors, but
the value is in millivolts, so it can't be directly interpreted as a
ppo2 value. I assume it's possible to convert from millivolts to a ppo2
value, because in the header there are several o2 sensor calibration
fields present for each sensor (e.g. "Calibration status", "Calibration
value" and "ADC Offset"). But I don't know how this calculation should
be done.
Jef
More information about the devel
mailing list