summaryrefslogtreecommitdiff
path: root/altosui/AltosTelemetryRecordLegacy.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-07-16 17:38:00 -0700
committerKeith Packard <keithp@keithp.com>2011-07-16 17:48:51 -0700
commit941b90a4905e34936d24a25ca90ac04eb6f5a792 (patch)
tree7a0e7000b813db31ab607fec4b781e4609839788 /altosui/AltosTelemetryRecordLegacy.java
parent7ef786276b5d5c7d17c3fe4f36aa41db61a9742f (diff)
altosui: Generalize and centralize telemetry constants, parse v0.8 telemetry
Move telemetry constants to Altos class, adding functions to compute names and lengths. Generalize users of these values to use all of the known values. Add support for v0.8 TeleMetrum telemetry Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosTelemetryRecordLegacy.java')
-rw-r--r--altosui/AltosTelemetryRecordLegacy.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/altosui/AltosTelemetryRecordLegacy.java b/altosui/AltosTelemetryRecordLegacy.java
index e3751ee7..756f3ec9 100644
--- a/altosui/AltosTelemetryRecordLegacy.java
+++ b/altosui/AltosTelemetryRecordLegacy.java
@@ -385,24 +385,25 @@ public class AltosTelemetryRecordLegacy extends AltosRecord implements AltosTele
*/
int[] bytes;
+ int adjust;
private int int8(int i) {
- return Altos.int8(bytes, i + 1);
+ return Altos.int8(bytes, i + 1 + adjust);
}
private int uint8(int i) {
- return Altos.uint8(bytes, i + 1);
+ return Altos.uint8(bytes, i + 1 + adjust);
}
private int int16(int i) {
- return Altos.int16(bytes, i + 1);
+ return Altos.int16(bytes, i + 1 + adjust);
}
private int uint16(int i) {
- return Altos.uint16(bytes, i + 1);
+ return Altos.uint16(bytes, i + 1 + adjust);
}
private int uint32(int i) {
- return Altos.uint32(bytes, i + 1);
+ return Altos.uint32(bytes, i + 1 + adjust);
}
private String string(int i, int l) {
- return Altos.string(bytes, i + 1, l);
+ return Altos.string(bytes, i + 1 + adjust, l);
}
static final int AO_GPS_NUM_SAT_MASK = (0xf << 0);
@@ -428,8 +429,13 @@ public class AltosTelemetryRecordLegacy extends AltosRecord implements AltosTele
}
}
version = 4;
- callsign = string(62, 8);
+ adjust = 0;
serial = uint16(0);
+
+ if (bytes.length == Altos.ao_telemetry_0_8_len + 4)
+ adjust = -1;
+
+ callsign = string(62, 8);
flight = uint16(2);
rssi = in_rssi;
status = in_status;