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 <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Patrick Valsecchi 2013-10-08 09:07:43 +02:00 committed by Dirk Hohndel
parent 7180c708e9
commit a13992a44b

View file

@ -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);