X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosTelemetryRecordLegacy.java;h=431897945549abdb521fcddca3f29497e64fc9dd;hb=fcb801b145e1ae6f1c0b3418a99245d34dbf5aa4;hp=8e3713cc4f8041af4c8d3cc93975b834f2111c15;hpb=69e6df07976a56b49e07c242cd6e5b2cbd2a578d;p=fw%2Faltos diff --git a/altoslib/AltosTelemetryRecordLegacy.java b/altoslib/AltosTelemetryRecordLegacy.java index 8e3713cc..43189794 100644 --- a/altoslib/AltosTelemetryRecordLegacy.java +++ b/altoslib/AltosTelemetryRecordLegacy.java @@ -17,9 +17,7 @@ package org.altusmetrum.AltosLib; -import java.lang.*; import java.text.*; -import java.util.HashMap; /* * Telemetry data contents @@ -232,7 +230,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { final static String AO_TELEM_SAT_SVID = "s_v"; final static String AO_TELEM_SAT_C_N_0 = "s_c"; - AltosRecord record; + AltosRecordTM record; private void parse_v4(String[] words, int i) throws ParseException { AltosTelemetryMap map = new AltosTelemetryMap(words, i); @@ -241,7 +239,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { record.serial = map.get_int(AO_TELEM_SERIAL, AltosRecord.MISSING); record.flight = map.get_int(AO_TELEM_FLIGHT, AltosRecord.MISSING); record.rssi = map.get_int(AO_TELEM_RSSI, AltosRecord.MISSING); - record.state = Altos.state(map.get_string(AO_TELEM_STATE, "invalid")); + record.state = AltosLib.state(map.get_string(AO_TELEM_STATE, "invalid")); record.tick = map.get_int(AO_TELEM_TICK, 0); /* raw sensor values */ @@ -259,9 +257,9 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { record.accel_minus_g = map.get_int(AO_TELEM_CAL_ACCEL_MINUS, AltosRecord.MISSING); /* flight computer values */ - record.acceleration = map.get_double(AO_TELEM_KALMAN_ACCEL, AltosRecord.MISSING, 1/16.0); - record.speed = map.get_double(AO_TELEM_KALMAN_SPEED, AltosRecord.MISSING, 1/16.0); - record.height = map.get_int(AO_TELEM_KALMAN_HEIGHT, AltosRecord.MISSING); + record.kalman_acceleration = map.get_double(AO_TELEM_KALMAN_ACCEL, AltosRecord.MISSING, 1/16.0); + record.kalman_speed = map.get_double(AO_TELEM_KALMAN_SPEED, AltosRecord.MISSING, 1/16.0); + record.kalman_height = map.get_int(AO_TELEM_KALMAN_HEIGHT, AltosRecord.MISSING); record.flight_accel = map.get_int(AO_TELEM_ADHOC_ACCEL, AltosRecord.MISSING); record.flight_vel = map.get_int(AO_TELEM_ADHOC_SPEED, AltosRecord.MISSING); @@ -300,7 +298,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { record.status = AltosParse.parse_hex(words[i++]); AltosParse.word(words[i++], "STATE"); - record.state = Altos.state(words[i++]); + record.state = AltosLib.state(words[i++]); record.tick = AltosParse.parse_int(words[i++]); @@ -336,9 +334,9 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { /* Old TeleDongle code with kalman-reporting TeleMetrum code */ if ((record.flight_vel & 0xffff0000) == 0x80000000) { - record.speed = ((short) record.flight_vel) / 16.0; - record.acceleration = record.flight_accel / 16.0; - record.height = record.flight_pres; + record.kalman_speed = ((short) record.flight_vel) / 16.0; + record.kalman_acceleration = record.flight_accel / 16.0; + record.kalman_height = record.flight_pres; record.flight_vel = AltosRecord.MISSING; record.flight_pres = AltosRecord.MISSING; record.flight_accel = AltosRecord.MISSING; @@ -366,7 +364,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { String[] words = line.split("\\s+"); int i = 0; - record = new AltosRecord(); + record = new AltosRecordTM(); if (words[i].equals("CRC") && words[i+1].equals("INVALID")) { i += 2; @@ -388,15 +386,17 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { } /* - * Given a hex dump of a legacy telemetry line, construct an AltosRecord from that + * Given a hex dump of a legacy telemetry line, construct an AltosRecordTM from that */ int[] bytes; int adjust; + /* private int int8(int i) { return AltosLib.int8(bytes, i + 1 + adjust); } + */ private int uint8(int i) { return AltosLib.uint8(bytes, i + 1 + adjust); } @@ -422,7 +422,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { static final int AO_GPS_COURSE_VALID = (1 << 7); public AltosTelemetryRecordLegacy(int[] in_bytes, int in_rssi, int in_status) { - record = new AltosRecord(); + record = new AltosRecordTM(); bytes = in_bytes; record.version = 4; @@ -455,9 +455,9 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { record.accel_minus_g = int16(19); if (uint16(11) == 0x8000) { - record.acceleration = int16(5); - record.speed = int16(9); - record.height = int16(13); + record.kalman_acceleration = int16(5); + record.kalman_speed = int16(9); + record.kalman_height = int16(13); record.flight_accel = AltosRecord.MISSING; record.flight_vel = AltosRecord.MISSING; record.flight_pres = AltosRecord.MISSING; @@ -465,9 +465,9 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { record.flight_accel = int16(5); record.flight_vel = uint32(9); record.flight_pres = int16(13); - record.acceleration = AltosRecord.MISSING; - record.speed = AltosRecord.MISSING; - record.height = AltosRecord.MISSING; + record.kalman_acceleration = AltosRecord.MISSING; + record.kalman_speed = AltosRecord.MISSING; + record.kalman_height = AltosRecord.MISSING; } record.gps = null; @@ -478,7 +478,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { record.gps = new AltosGPS(); record.new_gps = true; - record.seen |= record.seen_gps_time | record.seen_gps_lat | record.seen_gps_lon; + record.seen |= AltosRecord.seen_gps_time | AltosRecord.seen_gps_lat | AltosRecord.seen_gps_lon; record.gps.nsat = (gps_flags & AO_GPS_NUM_SAT_MASK); record.gps.locked = (gps_flags & AO_GPS_VALID) != 0; record.gps.connected = true;