From a13992a44b6b4e6d36623e1e7d0cd0b94d284d34 Mon Sep 17 00:00:00 2001 From: Patrick Valsecchi Date: Tue, 8 Oct 2013 09:07:43 +0200 Subject: [PATCH] Fixed conversion error when downloading salinity from DC libdivecomputer doesn't give the salinity in kg/l, but in g/l and subsurface works with g/10l. So the salinity was too big by a factor of 1000. Signed-off-by: Patrick Valsecchi Signed-off-by: Dirk Hohndel --- libdivecomputer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdivecomputer.c b/libdivecomputer.c index 0569689ec..9f4500d03 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -453,7 +453,7 @@ static int dive_cb(const unsigned char *data, unsigned int size, // Check if the libdivecomputer version already supports salinity & atmospheric dc_salinity_t salinity = { .type = DC_WATER_SALT, - .density = 1.03 + .density = SEAWATER_SALINITY/10.0 }; rc = dc_parser_get_field(parser, DC_FIELD_SALINITY, 0, &salinity); if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) { @@ -461,7 +461,7 @@ static int dive_cb(const unsigned char *data, unsigned int size, dc_parser_destroy(parser); return rc; } - dive->dc.salinity = salinity.density * 10000.0 + 0.5; + dive->dc.salinity = salinity.density * 10.0 + 0.5; double surface_pressure = 1.0; rc = dc_parser_get_field(parser, DC_FIELD_ATMOSPHERIC, 0, &surface_pressure);