summaryrefslogtreecommitdiff
path: root/altoslib/AltosFile.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-08-31 01:48:02 -0500
committerKeith Packard <keithp@keithp.com>2013-08-31 01:48:58 -0500
commitf07f6d55edf5b97020680b3ce1d9e00bb3df64a6 (patch)
treed701ad9e7a598d2436eb66d3cd958409c364a374 /altoslib/AltosFile.java
parentde8d9c5630ae46378c50faf97f7d2e97fe139e30 (diff)
altoslib/altosui: Get legacy telem working with new AltosState structure
Make AltosTelemetry work without AltosRecord Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosFile.java')
-rw-r--r--altoslib/AltosFile.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/altoslib/AltosFile.java b/altoslib/AltosFile.java
index 90dbc6db..54c54824 100644
--- a/altoslib/AltosFile.java
+++ b/altoslib/AltosFile.java
@@ -22,10 +22,17 @@ import java.util.*;
public class AltosFile extends File {
+ static String number(int n) {
+ if (n == AltosRecord.MISSING)
+ return "unk";
+ else
+ return String.format("%03d", n);
+ }
+
public AltosFile(int year, int month, int day, int serial, int flight, String extension) {
super (AltosPreferences.logdir(),
- String.format("%04d-%02d-%02d-serial-%03d-flight-%03d.%s",
- year, month, day, serial, flight, extension));
+ String.format("%04d-%02d-%02d-serial-%s-flight-%s.%s",
+ year, month, day, number(serial), number(flight), extension));
}
public AltosFile(int serial, int flight, String extension) {
@@ -37,7 +44,7 @@ public class AltosFile extends File {
extension);
}
- public AltosFile(AltosRecord telem) {
- this(telem.serial, telem.flight, "telem");
+ public AltosFile(AltosState state) {
+ this(state.serial, state.flight, "telem");
}
}