Patch: Mares Nemo Nitrox/Air detection

Björn Spruck bjoern at spruck.net
Tue Mar 27 19:32:17 UTC 2012


--- /tmp/tmp183gxE-meld/src/mares_nemo_parser.c
+++ /home/bjoern/Dokumente/libdivecomputer/src/mares_nemo_parser.c
@@ -248,7 +248,20 @@
                 break;
             case FIELD_TYPE_GASMIX:
                 gasmix->helium = 0.0;
-                gasmix->oxygen = p[53 - 43] / 100.0;
+                switch(p[53-1]){
+                  default:/// Mode unknown
+                      return PARSER_STATUS_UNSUPPORTED;
+                  case 2: /// FREE, can not happen!!
+                      return PARSER_STATUS_UNSUPPORTED;
+                  case 3: /// Bottom timer... no idea what to do...
lets unsupport it
+                      return PARSER_STATUS_UNSUPPORTED;
+                  case 0: /// AIR
+                      gasmix->oxygen = 0.21;
+                      break;
+                  case 1:
+                      gasmix->oxygen = p[53 - 43] / 100.0;
+                      break;
+                }
                 gasmix->nitrogen = 1.0 - gasmix->oxygen - gasmix->helium;
                 break;
             default:





More information about the Devel mailing list