2 * Copyright © 2011 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;
21 public class AltosTelemetryRecordSensor extends AltosTelemetryRecordRaw {
41 public AltosTelemetryRecordSensor(int[] in_bytes, int in_rssi) {
52 acceleration = int16(18);
56 ground_pres = int16(24);
57 ground_accel = int16(26);
58 accel_plus_g = int16(28);
59 accel_minus_g = int16(30);
64 public AltosRecord update_state(AltosRecord previous) {
65 AltosRecord next = super.update_state(previous);
68 if (type == packet_type_TM_sensor)
71 next.accel = AltosRecord.MISSING;
75 if (type == packet_type_TM_sensor || type == packet_type_Tm_sensor) {
76 next.drogue = sense_d;
79 next.drogue = AltosRecord.MISSING;
80 next.main = AltosRecord.MISSING;
83 next.acceleration = acceleration / 16.0;
84 next.speed = speed / 16.0;
87 next.ground_pres = ground_pres;
88 if (type == packet_type_TM_sensor) {
89 next.ground_accel = ground_accel;
90 next.accel_plus_g = accel_plus_g;
91 next.accel_minus_g = accel_minus_g;
93 next.ground_accel = AltosRecord.MISSING;
94 next.accel_plus_g = AltosRecord.MISSING;
95 next.accel_minus_g = AltosRecord.MISSING;
100 next.seen |= AltosRecord.seen_sensor | AltosRecord.seen_temp_volt;