summaryrefslogtreecommitdiff
path: root/altosui/AltosEepromIterable.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-03-30 11:48:03 -0700
committerKeith Packard <keithp@keithp.com>2011-03-30 11:48:03 -0700
commitf558cfa1df77c36a459168c1953d0945ee5a7f9f (patch)
tree4fbc53c7ab676252acde905c6d85518a9d341da7 /altosui/AltosEepromIterable.java
parenta9df9fc257eb2d7038d66ac7c2539aae4474bf12 (diff)
altosui: Only plot acceleration when present in data file
Eliminates a bogus axis and data line for devices which do not have an accelerometer. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosEepromIterable.java')
-rw-r--r--altosui/AltosEepromIterable.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/altosui/AltosEepromIterable.java b/altosui/AltosEepromIterable.java
index a7fd742f..624e1dd3 100644
--- a/altosui/AltosEepromIterable.java
+++ b/altosui/AltosEepromIterable.java
@@ -57,6 +57,11 @@ class AltosOrderedRecord extends AltosEepromRecord implements Comparable<AltosOr
index = in_index;
}
+ public String toString() {
+ return String.format("%d.%d %04x %04x %04x",
+ cmd, index, tick, a, b);
+ }
+
public int compareTo(AltosOrderedRecord o) {
int tick_diff = tick - o.tick;
if (tick_diff != 0)
@@ -75,7 +80,11 @@ public class AltosEepromIterable extends AltosRecordIterable {
static final int seen_gps_lat = 32;
static final int seen_gps_lon = 64;
- static final int seen_basic = seen_flight|seen_sensor|seen_temp_volt|seen_deploy;
+ static final int seen_basic = seen_flight|seen_sensor;
+
+ boolean has_accel;
+ boolean has_gps;
+ boolean has_ignite;
AltosEepromRecord flight_record;
AltosEepromRecord gps_date_record;
@@ -123,9 +132,10 @@ public class AltosEepromIterable extends AltosRecordIterable {
state.flight_vel += (state.accel_plus_g - state.accel);
}
eeprom.seen |= seen_sensor;
+ has_accel = true;
break;
case Altos.AO_LOG_HEIGHT:
- state.height = record.a;
+ state.height = (short) record.a;
eeprom.seen |= seen_sensor;
break;
case Altos.AO_LOG_TEMP_VOLT:
@@ -137,6 +147,7 @@ public class AltosEepromIterable extends AltosRecordIterable {
state.drogue = record.a;
state.main = record.b;
eeprom.seen |= seen_deploy;
+ has_ignite = true;
break;
case Altos.AO_LOG_STATE:
state.state = record.a;
@@ -161,6 +172,7 @@ public class AltosEepromIterable extends AltosRecordIterable {
state.gps.locked = (flags & Altos.AO_GPS_VALID) != 0;
state.gps.nsat = (flags & Altos.AO_GPS_NUM_SAT_MASK) >>
Altos.AO_GPS_NUM_SAT_SHIFT;
+ has_gps = true;
break;
case Altos.AO_LOG_GPS_LAT:
int lat32 = record.a | (record.b << 16);
@@ -254,6 +266,10 @@ public class AltosEepromIterable extends AltosRecordIterable {
return list.iterator();
}
+ public boolean has_gps() { return has_gps; }
+ public boolean has_accel() { return has_accel; }
+ public boolean has_ignite() { return has_ignite; }
+
public void write_comments(PrintStream out) {
Iterator<AltosOrderedRecord> iterator = records.iterator();
out.printf("# Comments\n");