From 440d52e34364fdeeddc76a2d744cc6d1c934364f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Jan 2011 21:28:07 -0800 Subject: altosui: Add support for parsing list of flights from the 'l' command This adds parsing support to enumerate the available flights, but does not yet provide any UI to use it. Signed-off-by: Keith Packard --- altosui/AltosEepromBlock.java | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'altosui/AltosEepromBlock.java') diff --git a/altosui/AltosEepromBlock.java b/altosui/AltosEepromBlock.java index 0c1a4a92..f223f3fb 100644 --- a/altosui/AltosEepromBlock.java +++ b/altosui/AltosEepromBlock.java @@ -38,6 +38,12 @@ public class AltosEepromBlock extends ArrayList { int state; boolean has_date; int year, month, day; + boolean has_lat; + double lat; + boolean has_lon; + double lon; + boolean has_time; + int hour, minute, second; public AltosEepromBlock (AltosSerial serial_line, int block) throws TimeoutException, InterruptedException { int addr; @@ -46,6 +52,9 @@ public class AltosEepromBlock extends ArrayList { has_flight = false; has_state = false; has_date = false; + has_lat = false; + has_lon = false; + has_time = false; serial_line.printf("e %x\n", block); for (addr = 0; !done && addr < 0x100;) { try { @@ -70,7 +79,20 @@ public class AltosEepromBlock extends ArrayList { day = (r.b & 0xff); has_date = true; } - + if (r.cmd == Altos.AO_LOG_GPS_TIME) { + hour = (r.a & 0xff); + minute = (r.a >> 8); + second = (r.b & 0xff); + has_time = true; + } + if (r.cmd == Altos.AO_LOG_GPS_LAT) { + lat = (double) (r.a | (r.b << 16)) / 1e7; + has_lat = true; + } + if (r.cmd == Altos.AO_LOG_GPS_LON) { + lon = (double) (r.a | (r.b << 16)) / 1e7; + has_lon = true; + } if (r.cmd == Altos.AO_LOG_STATE && r.a == Altos.ao_flight_landed) done = true; add(addr / 8, r); -- cgit v1.2.3