+ public static double pa_to_psi(double pa) {
+ return pa / 6894.76;
+ }
+
+ public static double n_to_lb(double n) {
+ return n * 0.22480894;
+ }
+
+ public static double lb_to_n(double lb) {
+ return lb / 0.22480894;
+ }
+
+ public static double acceleration_from_sensor(double sensor, double plus_g, double minus_g, double ground) {
+
+ if (sensor == AltosLib.MISSING)
+ return AltosLib.MISSING;
+
+ if (plus_g == AltosLib.MISSING || minus_g == AltosLib.MISSING)
+ return AltosLib.MISSING;
+
+ if (ground == AltosLib.MISSING)
+ ground = plus_g;
+
+ double counts_per_g = (plus_g - minus_g) / 2.0;
+ double counts_per_mss = counts_per_g / gravity;
+
+ if (counts_per_mss == 0)
+ return AltosLib.MISSING;
+
+ return (sensor - ground) / counts_per_mss;
+ }
+