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_1;
21 public class AltosTelemetryRecordMegaData extends AltosTelemetryRecordRaw {
38 public AltosTelemetryRecordMegaData(int[] in_bytes, int rssi) {
39 super(in_bytes, rssi);
48 for (int i = 0; i < 6; i++) {
49 sense[i] = int8(10 + i) << 4;
50 sense[i] |= sense[i] >> 8;
53 ground_pres = int32(16);
54 ground_accel = int16(20);
55 accel_plus_g = int16(22);
56 accel_minus_g = int16(24);
58 acceleration = int16(26);
63 public AltosRecord update_state(AltosRecord previous) {
64 AltosRecord n = super.update_state(previous);
67 if (!(n instanceof AltosRecordMM)) {
68 next = new AltosRecordMM(n);
70 next = (AltosRecordMM) n;
78 for (int i = 0; i < 6; i++)
79 next.sense[i] = sense[i];
81 next.ground_accel = ground_accel;
82 next.ground_pres = ground_pres;
83 next.accel_plus_g = accel_plus_g;
84 next.accel_minus_g = accel_minus_g;
86 next.kalman_acceleration = acceleration / 16.0;
87 next.kalman_speed = speed / 16.0;
88 next.kalman_height = height;
90 next.seen |= AltosRecord.seen_sensor | AltosRecord.seen_temp_volt;