On 22 January, 2017 - Dirk Hohndel wrote: > > > On Jan 22, 2017, at 2:32 AM, Anton Lundin <[email protected]> wrote: > >> Shearwater we have great relationships with (ok, they still owe me a > >> response on more details of the new BTLE communication, but hey, they > >> already sent me a Perdix AI). We used to have a contact at Mares, but he > >> left. Do they still produce new dive computers? > > > > I would love to get some feedback from them about their calibration > > values of their O2 sensors. I've reverse-engineered a patch which > > produces what looks to be the right values, but it would be great if > > someone with internal knowledge about how its thought could comment on my > > analysis. > > > > ( The short and curly: Shearwater stores their voted/computed/averaged > > ppO2, and the mV from the actual sensors in each sample. They also store > > a "calibration value" in the dive header of unknown unit. If I take that > > * about 1000 (1024?) the average of the sensors will produce the same > > ppO2 as they have stored in my sample data. Is that bogus math or is it > > the right<tm> way? ) > > Can you write this up with a bit more context and maybe the pertinent code > sample and send it to me? I'll be happy to poke them about this.
Here you go. The real questions are: What's the unit of the Sensor Calibration values? What's the unit of the Sensor ADC Offset? Is the Sensor ADC Offset already factored in into the stored Sensor millivolts? //Anton -- Anton Lundin +46702-161604
>From 0aa217a6f4253e12db3e440dde10647ca3a8a4c1 Mon Sep 17 00:00:00 2001 From: Anton Lundin <[email protected]> Date: Wed, 14 Oct 2015 19:49:25 +0200 Subject: [PATCH] shearwater: Report individual sensor values This reads the reported mV values from the sensors, and based on the calibration values converts it into a ppo2 value to report. Signed-off-by: Anton Lundin <[email protected]> --- src/shearwater_predator_parser.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c index fba5629..254af5b 100644 --- a/src/shearwater_predator_parser.c +++ b/src/shearwater_predator_parser.c @@ -69,6 +69,8 @@ struct shearwater_predator_parser_t { unsigned int helium[NGASMIXES]; unsigned int serial; dc_divemode_t mode; + unsigned int sensor_cal_value[3]; + signed char sensor_adc_offset[3]; }; static dc_status_t shearwater_predator_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size); @@ -297,6 +299,25 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser) offset += parser->samplesize; } + // Cache sensor calibration for later use + parser->sensor_cal_value[0] = array_uint16_be(data + 87); + parser->sensor_cal_value[1] = array_uint16_be(data + 89); + parser->sensor_cal_value[2] = array_uint16_be(data + 91); + // The Predator expects the mV output of the cells to be within 30mV to + // 70mV in 100% O2 at 1 atmosphere. + // If we add 1024 (1000?) to the cal value, then the sensors lines up + // and matches the average + parser->sensor_cal_value[0] += 1024; + parser->sensor_cal_value[1] += 1024; + parser->sensor_cal_value[2] += 1024; + + // Cache sensor adc offset for later use + // Unit is probably 0.025 mV + // Is this included in the stored value, or its it "raw"? + parser->sensor_adc_offset[0] = data[93]; + parser->sensor_adc_offset[1] = data[94]; + parser->sensor_adc_offset[2] = data[95]; + // Cache the data for later use. parser->headersize = headersize; parser->footersize = footersize; @@ -493,8 +514,19 @@ shearwater_predator_parser_samples_foreach (dc_parser_t *abstract, dc_sample_cal if ((status & OC) == 0) { // PPO2 -- only return PPO2 if we are in closed circuit mode +#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->sensor_cal_value[0] / 100000.0; + if (callback && (data[86] & 0x01)) callback (DC_SAMPLE_PPO2, sample, userdata); + + sample.ppo2 = data[offset + 14] * parser->sensor_cal_value[1] / 100000.0; + if (callback && (data[86] & 0x02)) callback (DC_SAMPLE_PPO2, sample, userdata); + + sample.ppo2 = data[offset + 15] * parser->sensor_cal_value[2] / 100000.0; + if (callback && (data[86] & 0x04)) callback (DC_SAMPLE_PPO2, sample, userdata); +#endif // Setpoint if (parser->petrel) { -- 2.9.3
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
