altoslib: Force ms5611 mode altosui-ms5611
authorKeith Packard <keithp@keithp.com>
Sun, 18 Nov 2012 01:34:01 +0000 (17:34 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 18 Nov 2012 01:34:01 +0000 (17:34 -0800)
Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosMs5607.java

index 268e89f6fd85fa0908945b431ccc633138f00a35..3a30fc74dcf66e46bb01a85a94013bee973dc16e 100644 (file)
@@ -32,6 +32,8 @@ public class AltosMs5607 {
        public int      pa;
        public int      cc;
 
+       static final boolean    ms5611 = true;
+
        void convert() {
                int     dT;
                int TEMP;
@@ -43,9 +45,15 @@ public class AltosMs5607 {
        
                TEMP = (int) (2000 + (((long) dT * tempsens) >> 23));
 
-               OFF = ((long) off << 17) + (((long) tco * dT) >> 6);
+               if (ms5611) {
+                       OFF = ((long) off << 16) + (((long) tco * dT) >> 7);
+
+                       SENS = ((long) sens << 15) + (((long) tcs * dT) >> 8);
+               } else {
+                       OFF = ((long) off << 17) + (((long) tco * dT) >> 6);
 
-               SENS = ((long) sens << 16) + (((long) tcs * dT) >> 7);
+                       SENS = ((long) sens << 16) + (((long) tcs * dT) >> 7);
+               } 
 
                if (TEMP < 2000) {
                        int     T2 = (int) (((long) dT * (long) dT) >> 31);