[PATCH 1/2] Add gas mixes to MK6 import

Miika Turkia miika.turkia at gmail.com
Fri Oct 31 14:06:37 PDT 2014


Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 file.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/file.c b/file.c
index 42f8ef6..ad5b035 100644
--- a/file.c
+++ b/file.c
@@ -444,7 +444,7 @@ int parse_txt_file(const char *filename, const char *csv)
 	 * make sure the input .txt looks like proper MkVI file, then start parsing the .csv.
 	 */
 	if (MATCH(memtxt.buffer, "MkVI_Config") == 0) {
-		int d, m, y;
+		int d, m, y, he;
 		int hh = 0, mm = 0, ss = 0;
 		int prev_depth = 0, cur_sampletime = 0, prev_setpoint = -1;
 		bool has_depth = false, has_setpoint = false;
@@ -476,11 +476,15 @@ int parse_txt_file(const char *filename, const char *csv)
 		dive->cylinder[cur_cylinder_index].type.size.mliter = 3000;
 		dive->cylinder[cur_cylinder_index].type.workingpressure.mbar = 200000;
 		dive->cylinder[cur_cylinder_index].type.description = strdup("3l Mk6");
+		dive->cylinder[cur_cylinder_index].gasmix.o2.permille = 1000;
 		cur_cylinder_index++;
 
 		dive->cylinder[cur_cylinder_index].type.size.mliter = 3000;
 		dive->cylinder[cur_cylinder_index].type.workingpressure.mbar = 200000;
 		dive->cylinder[cur_cylinder_index].type.description = strdup("3l Mk6");
+		he = atoi(parse_mkvi_value(memtxt.buffer, "Helium percentage"));
+		dive->cylinder[cur_cylinder_index].gasmix.o2.permille = (100 - atoi(parse_mkvi_value(memtxt.buffer, "Nitrogen percentage")) - he) * 10;
+		dive->cylinder[cur_cylinder_index].gasmix.he.permille = he * 10;
 		cur_cylinder_index++;
 
 		dc = &dive->dc;
-- 
1.9.1



More information about the subsurface mailing list