diff options
author | Bdale Garbee <bdale@gag.com> | 2014-01-22 20:55:41 -0700 |
---|---|---|
committer | Bdale Garbee <bdale@gag.com> | 2014-01-22 20:55:41 -0700 |
commit | 9884ca1449167a06bd2cebc7d28353eeac592493 (patch) | |
tree | 9fde328b3a5971c67954e669c1ba27042821fd8c /altoslib/AltosMag.java | |
parent | 8e669694a60d34e2ea0f8f6b189e0bc3605d94d7 (diff) | |
parent | 0ef0c50536e5eb6ad3455b5828983307edbab828 (diff) |
Merge branch 'branch-1.3' into debian
Diffstat (limited to 'altoslib/AltosMag.java')
-rw-r--r-- | altoslib/AltosMag.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/altoslib/AltosMag.java b/altoslib/AltosMag.java index 89e72bd6..d2bb9da6 100644 --- a/altoslib/AltosMag.java +++ b/altoslib/AltosMag.java @@ -15,14 +15,20 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_2; +package org.altusmetrum.altoslib_3; import java.util.concurrent.*; public class AltosMag implements Cloneable { - public int x; - public int y; - public int z; + public double x; + public double y; + public double z; + + public static double counts_per_gauss = 1090; + + public static double convert_gauss(int counts) { + return (double) counts / counts_per_gauss; + } public boolean parse_string(String line) { // if (line.startsWith("Syntax error")) { @@ -36,9 +42,9 @@ public class AltosMag implements Cloneable { String[] items = line.split("\\s+"); if (items.length >= 6) { - x = Integer.parseInt(items[1]); - y = Integer.parseInt(items[3]); - z = Integer.parseInt(items[5]); + x = convert_gauss(Integer.parseInt(items[1])); + y = convert_gauss(Integer.parseInt(items[3])); + z = convert_gauss(Integer.parseInt(items[5])); } return true; } |