From fe2448e34fb4d58f167ede6ef54da22c3c58d13a Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 3 Jan 2015 17:07:38 -0800 Subject: [PATCH] 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 Signed-off-by: Dirk Hohndel --- 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 4d54652..afa99d6 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -21,8 +21,14 @@ #include #include +#include #include +/* Wow. MSC is truly crap */ +#ifdef _MSC_VER +#define snprintf _snprintf +#endif + #include #include "context-private.h" @@ -1121,6 +1127,15 @@ static int traverse_diving_fields(suunto_eonsteel_parser_t *eon, const struct ty if (!strcmp(name, "DiveMode")) return add_string(eon, "Dive Mode", data); + /* Signed byte of conservatism (-2 .. +2) */ + if (!strcmp(name, "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; }