[PATCH 1/3] Save cylinder pressure from samples

Miika Turkia miika.turkia at gmail.com
Sat Nov 15 02:19:10 PST 2014


If start and end cylinder pressure is not explicitly set for secondary
cylinders, we must store the start and end pressures from the
sample_{start,end} attribute. Faulty behavior is obvious at least when
importing Poseidon logs.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
This seems to save the information as intended, but then again I am
quite clueless when it comes to this area of the code. E.g. I did not
spot, how come the start and end pressures were saved properly for the
main cylinder.
---
 save-xml.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/save-xml.c b/save-xml.c
index a128cf0..61740b3 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -177,8 +177,8 @@ static void save_cylinder_info(struct membuffer *b, struct dive *dive)
 		put_pressure(b, cylinder->type.workingpressure, " workpressure='", " bar'");
 		show_utf8(b, description, " description='", "'", 1);
 		put_gasmix(b, &cylinder->gasmix);
-		put_pressure(b, cylinder->start, " start='", " bar'");
-		put_pressure(b, cylinder->end, " end='", " bar'");
+		put_pressure(b, cylinder->start.mbar ? cylinder->start : cylinder->sample_start, " start='", " bar'");
+		put_pressure(b, cylinder->end.mbar ? cylinder->end : cylinder->sample_end, " end='", " bar'");
 		put_format(b, " />\n");
 	}
 }
-- 
1.9.1



More information about the subsurface mailing list