From cac0eb7d812bb8ad383709a72be493e77f799bb7 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 3 Jun 2020 14:08:02 +0200 Subject: [PATCH] Remove the salinity compensation In recent hwos firmware versions, the depth is no longer stored as pressure (in millibar), but directly as depth (in meters) with the salinity and gravity factor already applied. --- src/hw_ostc_parser.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index 79920b9..117064b 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -617,14 +617,6 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call else samplerate = data[36]; - // Get the salinity factor. - unsigned int salinity = data[layout->salinity]; - if (version == 0x23 || version == 0x24) - salinity += 100; - if (salinity < 100 || salinity > 104) - salinity = 100; - double hydrostatic = GRAVITY * salinity * 10.0; - // Get the number of sample descriptors. unsigned int nconfig = 0; if (version == 0x23 || version == 0x24) @@ -728,9 +720,9 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call if (callback) callback (DC_SAMPLE_CNS, sample, userdata); } - // Depth (mbar). + // Depth (1/100 m). unsigned int depth = array_uint16_le (data + offset); - sample.depth = (depth * BAR / 1000.0) / hydrostatic; + sample.depth = depth / 100.0; if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata); offset += 2;