From bba99277a875f42ac1c5a895a8c3ed336bd90280 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 14 May 2013 21:34:54 -0400 Subject: [PATCH] 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 --- parse-xml.c | 14 ++++++++------ 1 file 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;