From df7aeeef01eab8a5275e86bc6185caa92e5b03dc Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 27 Aug 2019 11:58:08 -0700 Subject: [PATCH] Deepblu Cosmiq+: fix oxygen percentage reporting When I added more parsing of the dive data of the Cosmiq+ in commit 4dff291a1a53 ("Deepblu Cosmiq+: fill in some parsing details") I got the gasmix units completely wrong and clearly never tested it. The DC_FIELD_GASMIX reporting uses floating point percentages, not integer percentages, and instead of reporting 21% as 0.21, we used to report it as 21.0. It all looked fine in my profiles, because I'd only tested simulated air dives, and subsurface defaults to air even if somebody reports crazy impossible gases. Easy enough to fix, and now actually tested by doing a simulated nitrox dive. Reported-by: Michael Werle Signed-off-by: Linus Torvalds --- src/deepblu_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deepblu_parser.c b/src/deepblu_parser.c index 8dfdcef..6a4c778 100644 --- a/src/deepblu_parser.c +++ b/src/deepblu_parser.c @@ -189,7 +189,7 @@ deepblu_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsig case 2: // SCUBA - divetime in minutes divetime *= 60; - deepblu->cache.gasmix[0].oxygen = data[3]; + deepblu->cache.gasmix[0].oxygen = data[3] / 100.0; deepblu->cache.initialized |= 1u << DC_FIELD_GASMIX; ASSIGN_FIELD(GASMIX_COUNT, 1); ASSIGN_FIELD(DIVEMODE, DC_DIVEMODE_OC);