On 09 April, 2017 - Joakim Bygdell wrote: > 9 April 2017 at 11:39, Joakim Bygdell <j.bygd...@gmail.com> wrote: > > > 9 April 2017 at 11:30, Davide DB <dbdav...@gmail.com> wrote: > > > >> On 9 April 2017 at 11:22, Joakim Bygdell <j.bygd...@gmail.com> wrote: > >> > 9 April 2017 at 11:01, Davide DB <dbdav...@gmail.com> wrote: > >> >> > >> >> I update my settings and nothing happens. > >> >> I have a Petrel 2 connected to a SF2 CCR with three sensors. I get > >> >> only one green line. > >> > > >> > > >> > I have data from both a Predator and a Petrel, in both cases only the > >> > consensus pO2 are reported > >> > together with the setpoint data. > >> > > >> > >> Hi Joakim and Steve, > >> > >> Thanks for the feedback.did you try with Shearwater desktop? > >> > > > > Not my DC so can't test. > > But according to the guy who owns the Predator it only shows one cell with > > Shearwaters software. > > > > At least the Petrel2 should report 3 sensors. > > Jef, how is on the backed side, how many sensors does libdivecomputer > supports for the Petrel series?
I sort if figured out now to extract po2 valeues for all sensors from Shearwater comptuers, but due to it being reverse-engineered code Jef wanted to ask some contacts at Shearwater about it, and as far as I know, we haven't yet had any answer from Shearwater. Attached is this 1.5 years old patch, which I think its time to apply. //Anton -- Anton Lundin +46702-161604
>From 0aa217a6f4253e12db3e440dde10647ca3a8a4c1 Mon Sep 17 00:00:00 2001 From: Anton Lundin <gla...@acc.umu.se> 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 <gla...@acc.umu.se> --- 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 subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface