Suunto DM4 import should fill the divecomputer fields

Writing to the dive fields for maxdepth, surface pressure, airtemp and
watertemp is not correct. In the case of duration the longer time should
go into the dive, the shorter time into the divecomputer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-14 21:34:54 -04:00
parent 6dfd16a1f5
commit bba99277a8

View file

@ -1718,8 +1718,10 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
* Duration = data[3]
* DiveTime = data[15]
*/
if (data[3])
cur_dive->duration.seconds = atoi(data[3]);
if (data[15])
cur_dive->duration.seconds = atoi(data[15]);
cur_dive->dc.duration.seconds = atoi(data[15]);
/*
* TODO: the deviceid hash should be calculated here.
@ -1736,11 +1738,11 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
settings_end();
if (data[6])
cur_dive->maxdepth.mm = atof(data[6]) * 1000;
cur_dive->dc.maxdepth.mm = atof(data[6]) * 1000;
if (data[8])
cur_dive->airtemp.mkelvin = (atoi(data[8]) + 273.15) * 1000;
cur_dive->dc.airtemp.mkelvin = (atoi(data[8]) + 273.15) * 1000;
if (data[9])
cur_dive->watertemp.mkelvin = (atoi(data[9]) + 273.15) * 1000;
cur_dive->dc.watertemp.mkelvin = (atoi(data[9]) + 273.15) * 1000;
/*
* TODO: handle multiple cylinders
@ -1765,7 +1767,7 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
cylinder_end();
if (data[14])
cur_dive->surface_pressure.mbar = (atoi(data[14]) * 1000);
cur_dive->dc.surface_pressure.mbar = (atoi(data[14]) * 1000);
interval = data[16] ? atoi(data[16]) : 0;
profileBlob = (float *)data[17];
@ -1777,7 +1779,7 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
if (profileBlob)
cur_sample->depth.mm = profileBlob[i] * 1000;
else
cur_sample->depth.mm = cur_dive->maxdepth.mm;
cur_sample->depth.mm = cur_dive->dc.maxdepth.mm;
if (tempBlob)
cur_sample->temperature.mkelvin = (tempBlob[i] + 273.15) * 1000;