diff options
| author | Keith Packard <keithp@keithp.com> | 2011-01-11 21:28:07 -0800 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2011-01-11 21:28:07 -0800 |
| commit | 440d52e34364fdeeddc76a2d744cc6d1c934364f (patch) | |
| tree | fd948bd731cae315f011357bee01f5153c280783 /altosui/AltosEepromBlock.java | |
| parent | 7ad419d81c90ef6a16656970466313767fef830f (diff) | |
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 <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosEepromBlock.java')
| -rw-r--r-- | altosui/AltosEepromBlock.java | 24 |
1 files changed, 23 insertions, 1 deletions
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<AltosEepromRecord> { 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<AltosEepromRecord> { 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<AltosEepromRecord> { 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); |
