projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Shorten help strings
[fw/altos]
/
altosui
/
AltosTelemetryIterable.java
diff --git
a/altosui/AltosTelemetryIterable.java
b/altosui/AltosTelemetryIterable.java
index 44e5ad8f8d9c2fe9977cd0550abf8ab67c8d9dc0..278cbfb75b9e2e28ebceff7aa5f0621f84c60cb2 100644
(file)
--- a/
altosui/AltosTelemetryIterable.java
+++ b/
altosui/AltosTelemetryIterable.java
@@
-22,7
+22,7
@@
import java.util.*;
import java.text.*;
public class AltosTelemetryIterable extends AltosRecordIterable {
import java.text.*;
public class AltosTelemetryIterable extends AltosRecordIterable {
-
LinkedList<AltosRecord>
records;
+
TreeSet<AltosRecord>
records;
public Iterator<AltosRecord> iterator () {
return records.iterator();
public Iterator<AltosRecord> iterator () {
return records.iterator();
@@
-40,7
+40,8
@@
public class AltosTelemetryIterable extends AltosRecordIterable {
int current_tick = 0;
int boost_tick = 0;
int current_tick = 0;
int boost_tick = 0;
- records = new LinkedList<AltosRecord> ();
+ AltosRecord previous = null;
+ records = new TreeSet<AltosRecord> ();
try {
for (;;) {
try {
for (;;) {
@@
-49,14
+50,14
@@
public class AltosTelemetryIterable extends AltosRecordIterable {
break;
}
try {
break;
}
try {
- Altos
Telemetry record = new AltosTelemetry(line
);
+ Altos
Record record = AltosTelemetry.parse(line, previous
);
if (record == null)
break;
if (records.isEmpty()) {
current_tick = record.tick;
} else {
if (record == null)
break;
if (records.isEmpty()) {
current_tick = record.tick;
} else {
- int tick = record.tick
| (current_tick & ~ 0xffff)
;
-
if
(tick < current_tick - 0x1000)
+ int tick = record.tick;
+
while
(tick < current_tick - 0x1000)
tick += 0x10000;
current_tick = tick;
record.tick = current_tick;
tick += 0x10000;
current_tick = tick;
record.tick = current_tick;
@@
-72,7
+73,9
@@
public class AltosTelemetryIterable extends AltosRecordIterable {
has_gps = true;
if (record.main != AltosRecord.MISSING)
has_ignite = true;
has_gps = true;
if (record.main != AltosRecord.MISSING)
has_ignite = true;
- records.add(record);
+ if (previous != null && previous.tick != record.tick)
+ records.add(previous);
+ previous = record;
} catch (ParseException pe) {
System.out.printf("parse exception %s\n", pe.getMessage());
} catch (AltosCRCException ce) {
} catch (ParseException pe) {
System.out.printf("parse exception %s\n", pe.getMessage());
} catch (AltosCRCException ce) {
@@
-82,6
+85,9
@@
public class AltosTelemetryIterable extends AltosRecordIterable {
System.out.printf("io exception\n");
}
System.out.printf("io exception\n");
}
+ if (previous != null)
+ records.add(previous);
+
/* adjust all tick counts to be relative to boost time */
for (AltosRecord r : this)
r.time = (r.tick - boost_tick) / 100.0;
/* adjust all tick counts to be relative to boost time */
for (AltosRecord r : this)
r.time = (r.tick - boost_tick) / 100.0;