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@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2015-01-03 17:07:38 -08:00 committed by Dirk Hohndel
parent 7fd201a400
commit fe2448e34f

View File

@ -21,8 +21,14 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
/* Wow. MSC is truly crap */
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
#include <libdivecomputer/suunto_eonsteel.h>
#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;
}