summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-02-19 23:02:32 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-19 19:45:32 -0800
commit1301cb9664e432133b6ea5fdc99eb7b084a5f127 (patch)
tree8c9ca416407d167d9fd2c7a1b37a4da1175c1b07 /parse-xml.c
parent5d18876e786175dc6d54668ae3ce760cc6200c4f (diff)
downloadsubsurface-1301cb9664e432133b6ea5fdc99eb7b084a5f127.tar.gz
Use 12 liter default on DM5 import
As the comment says, default to 12 liters if cylinder size is zero. This is done only when cylinder has start pressure given. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/parse-xml.c b/parse-xml.c
index de51c3efc..fcd61eb70 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -2074,7 +2074,13 @@ extern int dm5_cylinders(void *handle, int columns, char **data, char **column)
if (data[8] && atoi(data[8]) > 0 && atoi(data[8]) < 350000)
cur_dive->cylinder[cur_cylinder_index].end.mbar = (atoi(data[8]));
if (data[6])
- cur_dive->cylinder[cur_cylinder_index].type.size.mliter = (atof(data[6])) * 1000;
+ /* DM5 shows tank size of 12 liters when the actual
+ * value is 0 (and using metric units). So we just use
+ * the same 12 liters when size is not available */
+ if (atof(data[6]) == 0.0 && cur_dive->cylinder[cur_cylinder_index].start.mbar)
+ cur_dive->cylinder[cur_cylinder_index].type.size.mliter = 12000;
+ else
+ cur_dive->cylinder[cur_cylinder_index].type.size.mliter = (atof(data[6])) * 1000;
if (data[2])
cur_dive->cylinder[cur_cylinder_index].gasmix.o2.permille = atoi(data[2]) * 10;
if (data[3])