Missing pO2 samples from CCR download [was: 4.7.8: a couple of questions]
Jef Driesen
jef at libdivecomputer.org
Fri May 25 06:55:06 PDT 2018
On 2018-05-23 16:47, Anton Lundin wrote:
> On 23 May, 2018 - Anton Lundin wrote:
>> The simple solution is to just emit the average/voted ppO2 when we
>> can't
>> find the calibration values.
>>
>> Its a graceful degradation of functionality, and way better than not
>> showing any ppO2 at all.
>>
>> It should be simple to write.
>
> Something simple like:
>
> diff --git i/src/shearwater_predator_parser.c
> w/src/shearwater_predator_parser.c
> index dda042c..e5194e8 100644
> --- i/src/shearwater_predator_parser.c
> +++ w/src/shearwater_predator_parser.c
> @@ -669,19 +669,19 @@ shearwater_predator_parser_samples_foreach
> (dc_parser_t *abstract, dc_sample_cal
> if ((status & OC) == 0) {
> // PPO2
> if ((status & PPO2_EXTERNAL) == 0) {
> -#ifdef SENSOR_AVERAGE
> - sample.ppo2 = data[offset + 6] / 100.0;
> - if (callback) callback
> (DC_SAMPLE_PPO2, sample, userdata);
> -#else
> - sample.ppo2 = data[offset + 12] *
> parser->calibration[0];
> - if (callback && (parser->calibrated &
> 0x01)) callback (DC_SAMPLE_PPO2, sample, userdata);
> -
> - sample.ppo2 = data[offset + 14] *
> parser->calibration[1];
> - if (callback && (parser->calibrated &
> 0x02)) callback (DC_SAMPLE_PPO2, sample, userdata);
> -
> - sample.ppo2 = data[offset + 15] *
> parser->calibration[2];
> - if (callback && (parser->calibrated &
> 0x04)) callback (DC_SAMPLE_PPO2, sample, userdata);
> -#endif
> + if (!parser->calibrated & 0x07) {
> + sample.ppo2 = data[offset + 6]
> / 100.0;
> + if (callback) callback
> (DC_SAMPLE_PPO2, sample, userdata);
> + } else {
> + sample.ppo2 = data[offset +
> 12] * parser->calibration[0];
> + if (callback &&
> (parser->calibrated & 0x01)) callback (DC_SAMPLE_PPO2, sample,
> userdata);
> +
> + sample.ppo2 = data[offset +
> 14] * parser->calibration[1];
> + if (callback &&
> (parser->calibrated & 0x02)) callback (DC_SAMPLE_PPO2, sample,
> userdata);
> +
> + sample.ppo2 = data[offset +
> 15] * parser->calibration[2];
> + if (callback &&
> (parser->calibrated & 0x04)) callback (DC_SAMPLE_PPO2, sample,
> userdata);
> + }
> }
>
> // Setpoint
>
> Should be enough.
The main disadvantage is that you'll no longer know which type of ppO2
(sensor or voted/average) you are getting. Especially if you only have
one sensor.
Jef
More information about the subsurface
mailing list