diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-14 21:34:54 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-14 21:37:35 -0400 |
commit | bba99277a875f42ac1c5a895a8c3ed336bd90280 (patch) | |
tree | b8702b22f949d0296cafec6214e56a949df9c4d6 /parse-xml.c | |
parent | 6dfd16a1f51f20dfff180d0ae238af3ee8667605 (diff) | |
download | subsurface-bba99277a875f42ac1c5a895a8c3ed336bd90280.tar.gz |
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>
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/parse-xml.c b/parse-xml.c index ac6e63eba..d6c189cd2 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -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; |