[PATCH] Air is special when we save the divelog

subsurface at henrik.synth.no subsurface at henrik.synth.no
Sun Jun 1 04:47:38 PDT 2014


From: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>

Leave out o2=20.9 when we save the divelog.  This will make the
log less cluttered for those who do most of their dives on air.

Signed-off-by: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>
---
 save-git.c | 3 ++-
 save-xml.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/save-git.c b/save-git.c
index 6abba60..a4e059e 100644
--- a/save-git.c
+++ b/save-git.c
@@ -128,8 +128,9 @@ static void save_cylinder_info(struct membuffer *b, struct dive *dive)
 		cylinder_t *cylinder = dive->cylinder + i;
 		int volume = cylinder->type.size.mliter;
 		const char *description = cylinder->type.description;
-		int o2 = cylinder->gasmix.o2.permille;
 		int he = cylinder->gasmix.he.permille;
+		// hide o2 entry if this is air:
+		int o2 = is_air(cylinder->gasmix.o2.permille, he) ? 0 : cylinder->gasmix.o2.permille;
 
 		put_string(b, "cylinder");
 		if (volume)
diff --git a/save-xml.c b/save-xml.c
index e52cfdf..2641765 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -196,8 +196,9 @@ static void save_cylinder_info(struct membuffer *b, struct dive *dive)
 		cylinder_t *cylinder = dive->cylinder + i;
 		int volume = cylinder->type.size.mliter;
 		const char *description = cylinder->type.description;
-		int o2 = cylinder->gasmix.o2.permille;
 		int he = cylinder->gasmix.he.permille;
+		// hide o2 entry if this is air:
+		int o2 = is_air(cylinder->gasmix.o2.permille, he) ? 0 : cylinder->gasmix.o2.permille;
 
 		put_format(b, "  <cylinder");
 		if (volume)
-- 
1.8.5.2 (Apple Git-48)



More information about the subsurface mailing list