summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-05-19 23:07:54 -0700
committerKeith Packard <keithp@keithp.com>2013-05-19 23:07:54 -0700
commit57b4d82dee10b142b820aa306028a288a85214f6 (patch)
tree9150c9a89e622e63aa9164d11c3127652bd553a4 /altosui
parent27e9b93f3d35890a49575b2ead1983ce3c2fc213 (diff)
Add Mini logging format. Use in EasyMinilpc
This is a 16-byte record that includes all of the sensor data in each sensor record, along with records for flight state changes. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui')
-rw-r--r--altosui/AltosDataChooser.java7
-rw-r--r--altosui/AltosEepromDownload.java50
-rw-r--r--altosui/AltosLanded.java3
-rw-r--r--altosui/AltosUI.java4
4 files changed, 63 insertions, 1 deletions
diff --git a/altosui/AltosDataChooser.java b/altosui/AltosDataChooser.java
index f914f138..c7b561d5 100644
--- a/altosui/AltosDataChooser.java
+++ b/altosui/AltosDataChooser.java
@@ -55,6 +55,9 @@ public class AltosDataChooser extends JFileChooser {
} else if (filename.endsWith("mega")) {
FileInputStream in = new FileInputStream(file);
return new AltosEepromMegaIterable(in);
+ } else if (filename.endsWith("mini")) {
+ FileInputStream in = new FileInputStream(file);
+ return new AltosEepromMiniIterable(in);
} else {
throw new FileNotFoundException();
}
@@ -77,8 +80,10 @@ public class AltosDataChooser extends JFileChooser {
"telem"));
setFileFilter(new FileNameExtensionFilter("TeleMega eeprom file",
"mega"));
+ setFileFilter(new FileNameExtensionFilter("EasyMini eeprom file",
+ "mini"));
setFileFilter(new FileNameExtensionFilter("Flight data file",
- "telem", "eeprom", "mega"));
+ "telem", "eeprom", "mega", "mini"));
setCurrentDirectory(AltosUIPreferences.logdir());
}
}
diff --git a/altosui/AltosEepromDownload.java b/altosui/AltosEepromDownload.java
index a0523b58..53d5433f 100644
--- a/altosui/AltosEepromDownload.java
+++ b/altosui/AltosEepromDownload.java
@@ -302,6 +302,53 @@ public class AltosEepromDownload implements Runnable {
CheckFile(false);
}
+ void LogMini(AltosEepromMini r) throws IOException {
+ if (r.cmd != Altos.AO_LOG_INVALID) {
+ String log_line = String.format("%c %4x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x\n",
+ r.cmd, r.tick,
+ r.data8[0], r.data8[1], r.data8[2], r.data8[3],
+ r.data8[4], r.data8[5], r.data8[6], r.data8[7],
+ r.data8[8], r.data8[9], r.data8[10], r.data8[11]);
+ if (eeprom_file != null)
+ eeprom_file.write(log_line);
+ else
+ eeprom_pending.add(log_line);
+ }
+ }
+
+ void CaptureMini(AltosEepromChunk eechunk) throws IOException {
+ boolean any_valid = false;
+
+ extension = "mini";
+ set_serial(flights.config_data.serial);
+ for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += AltosEepromMini.record_length) {
+ try {
+ AltosEepromMini r = new AltosEepromMini(eechunk, i);
+ if (r.cmd == Altos.AO_LOG_FLIGHT)
+ set_flight(r.data16(0));
+
+ /* Monitor state transitions to update display */
+ if (r.cmd == Altos.AO_LOG_STATE && r.data16(0) <= Altos.ao_flight_landed) {
+ state = r.data16(0);
+ if (state > Altos.ao_flight_pad)
+ want_file = true;
+ }
+
+ if (r.cmd == Altos.AO_LOG_STATE && r.data16(0) == Altos.ao_flight_landed)
+ done = true;
+ any_valid = true;
+ LogMini(r);
+ } catch (ParseException pe) {
+ if (parse_exception == null)
+ parse_exception = pe;
+ }
+ }
+ if (!any_valid)
+ done = true;
+
+ CheckFile(false);
+ }
+
void CaptureTelemetry(AltosEepromChunk eechunk) throws IOException {
}
@@ -369,6 +416,9 @@ public class AltosEepromDownload implements Runnable {
case AltosLib.AO_LOG_FORMAT_TELEMEGA:
extension = "mega";
CaptureMega(eechunk);
+ case AltosLib.AO_LOG_FORMAT_MINI:
+ extension = "mini";
+ CaptureMini(eechunk);
}
}
CheckFile(true);
diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java
index 1d209bda..9dab52c4 100644
--- a/altosui/AltosLanded.java
+++ b/altosui/AltosLanded.java
@@ -253,6 +253,9 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
} else if (filename.endsWith("mega")) {
FileInputStream in = new FileInputStream(file);
records = new AltosEepromMegaIterable(in);
+ } else if (filename.endsWith("mini")) {
+ FileInputStream in = new FileInputStream(file);
+ records = new AltosEepromMiniIterable(in);
} else {
throw new FileNotFoundException(filename);
}
diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java
index 9f8f6dda..4362e36c 100644
--- a/altosui/AltosUI.java
+++ b/altosui/AltosUI.java
@@ -354,6 +354,8 @@ public class AltosUI extends AltosUIFrame {
return new AltosEepromIterable(in);
else if (file.getName().endsWith("mega"))
return new AltosEepromMegaIterable(in);
+ else if (file.getName().endsWith("mini"))
+ return new AltosEepromMiniIterable(in);
else
return new AltosTelemetryIterable(in);
} catch (FileNotFoundException fe) {
@@ -441,6 +443,8 @@ public class AltosUI extends AltosUIFrame {
recs = new AltosEepromIterable(in);
} else if (file.getName().endsWith("mega")) {
recs = new AltosEepromMegaIterable(in);
+ } else if (file.getName().endsWith("mini")) {
+ recs = new AltosEepromMiniIterable(in);
} else {
recs = new AltosTelemetryIterable(in);
}