[PATCH 1/2] Add EON Steel personal adjustment parsing

Linus Torvalds torvalds at linux-foundation.org
Sat Jan 3 17:31:41 PST 2015


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Sat, 3 Jan 2015 17:07:38 -0800
Subject: [PATCH 1/2] Add EON Steel personal adjustment parsing

Suunto calls it "Conservatism" in the dump, but "Personal adjustment" in
at least some of the documentation. That's what we expose it as.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

So a "Personal adjustment" of "P-2" looks a bit odd, but that's how Suunto 
shows it on the dive computer (with the explanation "More aggressive"), 
and it matches older Suunto computers that called their personal 
adjustments P0 .. P2.

 src/suunto_eonsteel_parser.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c
index d5fe9f8ca7f2..6296b2642ba0 100644
--- a/src/suunto_eonsteel_parser.c
+++ b/src/suunto_eonsteel_parser.c
@@ -21,6 +21,12 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
+
+/* Wow. MSC is truly crap */
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
 
 #include <libdivecomputer/suunto_eonsteel.h>
 
@@ -756,6 +762,15 @@ static int traverse_header_fields(suunto_eonsteel_parser_t *eon, const char *nam
 	if (!strcmp(name, "Diving.DiveMode"))
 		return add_string(eon, "Dive Mode", data);
 
+	/* Signed byte of conservatism (-2 .. +2) */
+	if (!strcmp(name, "Diving.Conservatism")) {
+		char buffer[10];
+		int val = *(signed char *)data;
+
+		snprintf(buffer, sizeof(buffer), "P%d", val);
+		return add_string(eon, "Personal Adjustment", buffer);
+	}
+
 	return 0;
 }
 
-- 
2.2.1.212.gc5b9256



More information about the subsurface mailing list