On Thu, Nov 13, 2014 at 9:09 PM, Willem Ferguson < [email protected]> wrote:
> Miika, > There is a small problem in the Poseidon CSV import. It is evident not > while doing a CSV import, but when exporting the dive to xml. I understand > the cause but not the solution. In the CSV import, cylinder start and end > pressures are stored in cyl->sample_start and cyl->sample_end. When writing > to xml, the start and end pressures for cylinder 0 (oxygen), have not been > transfered to cyl->start and cyl->end: these latter values are both zero > and are used for writing to xml. Consequently the start and end pressures > of the oxygen cylinder are not written to xml. For the diluent cylinder > everything is ok, the pressures have been transfered for cyl->sample_start > and sample_end to cyl->start and cyl->end. > > Probably half of my dives are multi-cylinder, and when reading my divelog > with multiple cylinders from xml, the cyl->start and cyl->end values are > always set up correctly for all cylinders. I have spent quite a bit of time > looking around for a solution, but have only found a workaround or two, not > a solution. Do you have any ideas? > Will this do the trick? I am not entirely sure about the pressure handling, but this seems reasonable way to store the cylinder start and end pressures. miika
From 3223f3e7129376b3f0cc9d2376a12adf218b4d57 Mon Sep 17 00:00:00 2001 From: Miika Turkia <[email protected]> Date: Sat, 15 Nov 2014 07:35:56 +0200 Subject: [PATCH] Save cylinder pressure from samples 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 <[email protected]> --- 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
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
