2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.altoslib_1;
20 public class AltosRecordTM2 extends AltosRecord {
31 public int ground_accel;
32 public int ground_pres;
33 public int accel_plus_g;
34 public int accel_minus_g;
36 public int flight_accel;
37 public int flight_vel;
38 public int flight_pres;
40 static double adc(int raw) {
44 public double pressure() {
50 public double ground_pressure() {
51 if (ground_pres != MISSING)
56 public double battery_voltage() {
57 if (v_batt != MISSING)
58 return 3.3 * adc(v_batt) * (15.0 + 27.0) / 27.0;
62 static double pyro(int raw) {
64 return 3.3 * adc(raw) * (100.0 + 27.0) / 27.0;
68 public double main_voltage() {
72 public double drogue_voltage() {
76 public double temperature() {
82 double accel_counts_per_mss() {
83 double counts_per_g = Math.abs(accel_minus_g - accel_plus_g) / 2;
85 return counts_per_g / 9.80665;
88 public double acceleration() {
89 if (ground_accel == MISSING || accel == MISSING)
92 if (accel_minus_g == MISSING || accel_plus_g == MISSING)
95 return (ground_accel - accel) / accel_counts_per_mss();
98 public void copy (AltosRecordTM2 old) {
106 sense_a = old.sense_a;
107 sense_m = old.sense_m;
109 ground_accel = old.ground_accel;
110 ground_pres = old.ground_pres;
111 accel_plus_g = old.accel_plus_g;
112 accel_minus_g = old.accel_minus_g;
114 flight_accel = old.flight_accel;
115 flight_vel = old.flight_vel;
116 flight_pres = old.flight_pres;
119 public AltosRecordTM2 clone() {
120 return new AltosRecordTM2(this);
123 void make_missing() {
133 ground_accel = MISSING;
134 ground_pres = MISSING;
135 accel_plus_g = MISSING;
136 accel_minus_g = MISSING;
143 public AltosRecordTM2(AltosRecord old) {
148 public AltosRecordTM2(AltosRecordTM2 old) {
152 public AltosRecordTM2() {