summaryrefslogtreecommitdiff
path: root/altoslib
diff options
context:
space:
mode:
Diffstat (limited to 'altoslib')
-rw-r--r--altoslib/AltosAccel.java2
-rw-r--r--altoslib/AltosCRCException.java2
-rw-r--r--altoslib/AltosCompanion.java2
-rw-r--r--altoslib/AltosConfigData.java2
-rw-r--r--altoslib/AltosConfigValues.java2
-rw-r--r--altoslib/AltosConvert.java22
-rw-r--r--altoslib/AltosDebug.java2
-rw-r--r--altoslib/AltosDistance.java2
-rw-r--r--altoslib/AltosEeprom.java2
-rw-r--r--altoslib/AltosEepromBody.java2
-rw-r--r--altoslib/AltosEepromBodyIterable.java2
-rw-r--r--altoslib/AltosEepromChunk.java2
-rw-r--r--altoslib/AltosEepromFile.java7
-rw-r--r--altoslib/AltosEepromGPS.java2
-rw-r--r--altoslib/AltosEepromHeader.java2
-rw-r--r--altoslib/AltosEepromHeaderIterable.java2
-rw-r--r--altoslib/AltosEepromIterable.java2
-rw-r--r--altoslib/AltosEepromLog.java6
-rw-r--r--altoslib/AltosEepromMega.java2
-rw-r--r--altoslib/AltosEepromMegaIterable.java2
-rw-r--r--altoslib/AltosEepromMetrum.java2
-rw-r--r--altoslib/AltosEepromMetrum2.java2
-rw-r--r--altoslib/AltosEepromMetrumIterable.java2
-rw-r--r--altoslib/AltosEepromMini.java9
-rw-r--r--altoslib/AltosEepromMiniIterable.java2
-rw-r--r--altoslib/AltosEepromOldIterable.java2
-rw-r--r--altoslib/AltosEepromRecord.java135
-rw-r--r--altoslib/AltosEepromTM.java2
-rw-r--r--altoslib/AltosEepromTeleScience.java57
-rw-r--r--altoslib/AltosFile.java4
-rw-r--r--altoslib/AltosFlash.java2
-rw-r--r--altoslib/AltosFlashListener.java2
-rw-r--r--altoslib/AltosFlightReader.java4
-rw-r--r--altoslib/AltosFrequency.java2
-rw-r--r--altoslib/AltosGPS.java107
-rw-r--r--altoslib/AltosGPSQuery.java97
-rw-r--r--altoslib/AltosGPSSat.java2
-rw-r--r--altoslib/AltosGreatCircle.java2
-rw-r--r--altoslib/AltosHeight.java2
-rw-r--r--altoslib/AltosHexfile.java2
-rw-r--r--altoslib/AltosIMU.java56
-rw-r--r--altoslib/AltosIMUQuery.java46
-rw-r--r--altoslib/AltosIdle.java (renamed from altoslib/AltosRecordIterable.java)26
-rw-r--r--altoslib/AltosIdleFetch.java149
-rw-r--r--altoslib/AltosIdleMonitor.java115
-rw-r--r--altoslib/AltosIdleMonitorListener.java2
-rw-r--r--altoslib/AltosIgnite.java2
-rw-r--r--altoslib/AltosLib.java4
-rw-r--r--altoslib/AltosLine.java2
-rw-r--r--altoslib/AltosLink.java13
-rw-r--r--altoslib/AltosListenerState.java4
-rw-r--r--altoslib/AltosLog.java2
-rw-r--r--altoslib/AltosMag.java48
-rw-r--r--altoslib/AltosMma655x.java69
-rw-r--r--altoslib/AltosMs5607.java57
-rw-r--r--altoslib/AltosMs5607Query.java36
-rw-r--r--altoslib/AltosOrderedMegaRecord.java52
-rw-r--r--altoslib/AltosOrderedMetrumRecord.java2
-rw-r--r--altoslib/AltosOrderedMiniRecord.java52
-rw-r--r--altoslib/AltosOrderedRecord.java63
-rw-r--r--altoslib/AltosParse.java2
-rw-r--r--altoslib/AltosPreferences.java2
-rw-r--r--altoslib/AltosPreferencesBackend.java2
-rw-r--r--altoslib/AltosPyro.java2
-rw-r--r--altoslib/AltosRecord.java179
-rw-r--r--altoslib/AltosRecordCompanion.java38
-rw-r--r--altoslib/AltosRecordMM.java178
-rw-r--r--altoslib/AltosRecordMini.java133
-rw-r--r--altoslib/AltosRecordNone.java38
-rw-r--r--altoslib/AltosRecordTM.java186
-rw-r--r--altoslib/AltosRecordTM2.java2
-rw-r--r--altoslib/AltosReplayReader.java2
-rw-r--r--altoslib/AltosRomconfig.java2
-rw-r--r--altoslib/AltosSelfFlash.java2
-rw-r--r--altoslib/AltosSensorEMini.java70
-rw-r--r--altoslib/AltosSensorMM.java2
-rw-r--r--altoslib/AltosSensorMega.java109
-rw-r--r--altoslib/AltosSensorMetrum.java13
-rw-r--r--altoslib/AltosSensorTM.java36
-rw-r--r--altoslib/AltosSpeed.java2
-rw-r--r--altoslib/AltosState.java321
-rw-r--r--altoslib/AltosStateIterable.java2
-rw-r--r--altoslib/AltosStateUpdate.java2
-rw-r--r--altoslib/AltosTelemetry.java2
-rw-r--r--altoslib/AltosTelemetryConfiguration.java2
-rw-r--r--altoslib/AltosTelemetryFile.java7
-rw-r--r--altoslib/AltosTelemetryIterable.java65
-rw-r--r--altoslib/AltosTelemetryLegacy.java66
-rw-r--r--altoslib/AltosTelemetryLocation.java2
-rw-r--r--altoslib/AltosTelemetryMap.java2
-rw-r--r--altoslib/AltosTelemetryMegaData.java2
-rw-r--r--altoslib/AltosTelemetryMegaSensor.java2
-rw-r--r--altoslib/AltosTelemetryMetrumData.java2
-rw-r--r--altoslib/AltosTelemetryMetrumSensor.java2
-rw-r--r--altoslib/AltosTelemetryRaw.java2
-rw-r--r--altoslib/AltosTelemetryReader.java5
-rw-r--r--altoslib/AltosTelemetryRecord.java2
-rw-r--r--altoslib/AltosTelemetryRecordCompanion.java2
-rw-r--r--altoslib/AltosTelemetryRecordConfiguration.java2
-rw-r--r--altoslib/AltosTelemetryRecordGeneral.java2
-rw-r--r--altoslib/AltosTelemetryRecordLegacy.java58
-rw-r--r--altoslib/AltosTelemetryRecordLocation.java2
-rw-r--r--altoslib/AltosTelemetryRecordMegaData.java2
-rw-r--r--altoslib/AltosTelemetryRecordMegaSensor.java2
-rw-r--r--altoslib/AltosTelemetryRecordMetrumData.java2
-rw-r--r--altoslib/AltosTelemetryRecordMetrumSensor.java2
-rw-r--r--altoslib/AltosTelemetryRecordMini.java2
-rw-r--r--altoslib/AltosTelemetryRecordRaw.java2
-rw-r--r--altoslib/AltosTelemetryRecordSatellite.java2
-rw-r--r--altoslib/AltosTelemetryRecordSensor.java14
-rw-r--r--altoslib/AltosTelemetrySatellite.java2
-rw-r--r--altoslib/AltosTelemetrySensor.java2
-rw-r--r--altoslib/AltosTelemetryStandard.java2
-rw-r--r--altoslib/AltosTemperature.java2
-rw-r--r--altoslib/AltosUnits.java2
-rw-r--r--altoslib/AltosUnitsListener.java2
-rw-r--r--altoslib/Makefile.am26
117 files changed, 1154 insertions, 1774 deletions
diff --git a/altoslib/AltosAccel.java b/altoslib/AltosAccel.java
index d02b3238..08eba359 100644
--- a/altoslib/AltosAccel.java
+++ b/altoslib/AltosAccel.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosAccel extends AltosUnits {
diff --git a/altoslib/AltosCRCException.java b/altoslib/AltosCRCException.java
index 76e79add..be2ec4fe 100644
--- a/altoslib/AltosCRCException.java
+++ b/altoslib/AltosCRCException.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosCRCException extends Exception {
public int rssi;
diff --git a/altoslib/AltosCompanion.java b/altoslib/AltosCompanion.java
index 1572fdae..57bb21af 100644
--- a/altoslib/AltosCompanion.java
+++ b/altoslib/AltosCompanion.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosCompanion {
public final static int board_id_telescience = 0x0a;
diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java
index 2ca5a7a5..d92f42c3 100644
--- a/altoslib/AltosConfigData.java
+++ b/altoslib/AltosConfigData.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.util.*;
import java.text.*;
diff --git a/altoslib/AltosConfigValues.java b/altoslib/AltosConfigValues.java
index 027d10f4..fd5584c2 100644
--- a/altoslib/AltosConfigValues.java
+++ b/altoslib/AltosConfigValues.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public interface AltosConfigValues {
/* set and get all of the dialog values */
diff --git a/altoslib/AltosConvert.java b/altoslib/AltosConvert.java
index cf2bc59f..760d9eb9 100644
--- a/altoslib/AltosConvert.java
+++ b/altoslib/AltosConvert.java
@@ -18,7 +18,7 @@
/*
* Sensor data conversion functions
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosConvert {
/*
@@ -207,15 +207,27 @@ public class AltosConvert {
}
static public double mega_battery_voltage(int v_batt) {
- if (v_batt != AltosRecord.MISSING)
+ if (v_batt != AltosLib.MISSING)
return 3.3 * mega_adc(v_batt) * (15.0 + 27.0) / 27.0;
- return AltosRecord.MISSING;
+ return AltosLib.MISSING;
}
static double mega_pyro_voltage(int raw) {
- if (raw != AltosRecord.MISSING)
+ if (raw != AltosLib.MISSING)
return 3.3 * mega_adc(raw) * (100.0 + 27.0) / 27.0;
- return AltosRecord.MISSING;
+ return AltosLib.MISSING;
+ }
+
+ static double tele_mini_voltage(int sensor) {
+ double supply = 3.3;
+
+ return sensor / 32767.0 * supply * 127/27;
+ }
+
+ static double easy_mini_voltage(int sensor) {
+ double supply = 3.0;
+
+ return sensor / 32767.0 * supply * 127/27;
}
public static double radio_to_frequency(int freq, int setting, int cal, int channel) {
diff --git a/altoslib/AltosDebug.java b/altoslib/AltosDebug.java
index 4d8e3ae7..76c13d57 100644
--- a/altoslib/AltosDebug.java
+++ b/altoslib/AltosDebug.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
diff --git a/altoslib/AltosDistance.java b/altoslib/AltosDistance.java
index 25028ac7..56257165 100644
--- a/altoslib/AltosDistance.java
+++ b/altoslib/AltosDistance.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosDistance extends AltosUnits {
diff --git a/altoslib/AltosEeprom.java b/altoslib/AltosEeprom.java
index 3a996ae0..dd5993c7 100644
--- a/altoslib/AltosEeprom.java
+++ b/altoslib/AltosEeprom.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromBody.java b/altoslib/AltosEepromBody.java
index 60aa8881..444102ce 100644
--- a/altoslib/AltosEepromBody.java
+++ b/altoslib/AltosEepromBody.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromBodyIterable.java b/altoslib/AltosEepromBodyIterable.java
index 33dc0ac8..4d32c66a 100644
--- a/altoslib/AltosEepromBodyIterable.java
+++ b/altoslib/AltosEepromBodyIterable.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromChunk.java b/altoslib/AltosEepromChunk.java
index 1709352b..918481fa 100644
--- a/altoslib/AltosEepromChunk.java
+++ b/altoslib/AltosEepromChunk.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
import java.util.concurrent.*;
diff --git a/altoslib/AltosEepromFile.java b/altoslib/AltosEepromFile.java
index 082c23ca..f87bf916 100644
--- a/altoslib/AltosEepromFile.java
+++ b/altoslib/AltosEepromFile.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
@@ -100,6 +100,7 @@ public class AltosEepromFile extends AltosStateIterable {
AltosState state = start.clone();
for (AltosEeprom eeprom : body) {
eeprom.update_state(state);
+ state.finish_update();
if (state.state >= AltosLib.ao_flight_boost) {
start.set_boost_tick(state.tick);
break;
@@ -111,8 +112,10 @@ public class AltosEepromFile extends AltosStateIterable {
AltosState state = start.clone();
Iterator<AltosEeprom> i = body.iterator();
- while (i.hasNext() && !state.valid())
+ while (i.hasNext() && !state.valid()) {
i.next().update_state(state);
+ state.finish_update();
+ }
return new AltosEepromIterator(state, i);
}
} \ No newline at end of file
diff --git a/altoslib/AltosEepromGPS.java b/altoslib/AltosEepromGPS.java
index f97fbbf9..43ed3392 100644
--- a/altoslib/AltosEepromGPS.java
+++ b/altoslib/AltosEepromGPS.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromHeader.java b/altoslib/AltosEepromHeader.java
index 35a03a12..0aeb78dd 100644
--- a/altoslib/AltosEepromHeader.java
+++ b/altoslib/AltosEepromHeader.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromHeaderIterable.java b/altoslib/AltosEepromHeaderIterable.java
index 01953f0e..920a4382 100644
--- a/altoslib/AltosEepromHeaderIterable.java
+++ b/altoslib/AltosEepromHeaderIterable.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromIterable.java b/altoslib/AltosEepromIterable.java
index 1e0f7f75..fc793579 100644
--- a/altoslib/AltosEepromIterable.java
+++ b/altoslib/AltosEepromIterable.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromLog.java b/altoslib/AltosEepromLog.java
index 20026c6d..95c0c3f6 100644
--- a/altoslib/AltosEepromLog.java
+++ b/altoslib/AltosEepromLog.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
import java.util.concurrent.*;
@@ -72,9 +72,9 @@ public class AltosEepromLog {
for (block = in_start_block; block < in_end_block; block++) {
AltosEepromChunk eechunk = new AltosEepromChunk(link, block, block == in_start_block);
- for (int i = 0; i < AltosEepromChunk.chunk_size; i += AltosEepromRecord.record_length) {
+ for (int i = 0; i < AltosEepromChunk.chunk_size; i += AltosEepromTM.record_length) {
try {
- AltosEepromRecord r = new AltosEepromRecord(eechunk, i);
+ AltosEepromTM r = new AltosEepromTM(eechunk, i);
if (r.cmd == AltosLib.AO_LOG_FLIGHT) {
flight = r.b;
diff --git a/altoslib/AltosEepromMega.java b/altoslib/AltosEepromMega.java
index b85c04bf..7a4ee52d 100644
--- a/altoslib/AltosEepromMega.java
+++ b/altoslib/AltosEepromMega.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromMegaIterable.java b/altoslib/AltosEepromMegaIterable.java
index 5736f937..8243aa88 100644
--- a/altoslib/AltosEepromMegaIterable.java
+++ b/altoslib/AltosEepromMegaIterable.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromMetrum.java b/altoslib/AltosEepromMetrum.java
index e035e5fd..7b2fcb3c 100644
--- a/altoslib/AltosEepromMetrum.java
+++ b/altoslib/AltosEepromMetrum.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
diff --git a/altoslib/AltosEepromMetrum2.java b/altoslib/AltosEepromMetrum2.java
index ea38edf2..c1d62c0c 100644
--- a/altoslib/AltosEepromMetrum2.java
+++ b/altoslib/AltosEepromMetrum2.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromMetrumIterable.java b/altoslib/AltosEepromMetrumIterable.java
index 0387319e..de4cc919 100644
--- a/altoslib/AltosEepromMetrumIterable.java
+++ b/altoslib/AltosEepromMetrumIterable.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromMini.java b/altoslib/AltosEepromMini.java
index e0eedb73..a09a62ce 100644
--- a/altoslib/AltosEepromMini.java
+++ b/altoslib/AltosEepromMini.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
@@ -42,13 +42,10 @@ public class AltosEepromMini extends AltosEeprom {
public int v_batt() { return data16(10); }
double voltage(AltosState state, int sensor) {
- double supply;
-
if (state.log_format == AltosLib.AO_LOG_FORMAT_EASYMINI)
- supply = 3.0;
+ return AltosConvert.easy_mini_voltage(sensor);
else
- supply = 3.3;
- return sensor / 32767.0 * supply * 127/27;
+ return AltosConvert.tele_mini_voltage(sensor);
}
public void update_state(AltosState state) {
diff --git a/altoslib/AltosEepromMiniIterable.java b/altoslib/AltosEepromMiniIterable.java
index 495495eb..31e667d8 100644
--- a/altoslib/AltosEepromMiniIterable.java
+++ b/altoslib/AltosEepromMiniIterable.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromOldIterable.java b/altoslib/AltosEepromOldIterable.java
index ef82828b..43b2362b 100644
--- a/altoslib/AltosEepromOldIterable.java
+++ b/altoslib/AltosEepromOldIterable.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromRecord.java b/altoslib/AltosEepromRecord.java
deleted file mode 100644
index 70ac1113..00000000
--- a/altoslib/AltosEepromRecord.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-import java.text.*;
-
-public class AltosEepromRecord {
- public int cmd;
- public int tick;
- public int a;
- public int b;
- public String data;
- public boolean tick_valid;
-
- public static final int record_length = 8;
-
- public AltosEepromRecord (AltosEepromChunk chunk, int start) throws ParseException {
-
- cmd = chunk.data(start);
- tick_valid = true;
-
- tick_valid = !chunk.erased(start, record_length);
- if (tick_valid) {
- if (AltosConvert.checksum(chunk.data, start, record_length) != 0)
- throw new ParseException(String.format("invalid checksum at 0x%x",
- chunk.address + start), 0);
- } else {
- cmd = AltosLib.AO_LOG_INVALID;
- }
-
- tick = chunk.data16(start + 2);
- a = chunk.data16(start + 4);
- b = chunk.data16(start + 6);
-
- data = null;
- }
-
- public AltosEepromRecord (String line) {
- tick_valid = false;
- tick = 0;
- a = 0;
- b = 0;
- data = null;
- if (line == null) {
- cmd = AltosLib.AO_LOG_INVALID;
- data = "";
- } else {
- try {
- String[] tokens = line.split("\\s+");
-
- if (tokens[0].length() == 1) {
- if (tokens.length != 4) {
- cmd = AltosLib.AO_LOG_INVALID;
- data = line;
- } else {
- cmd = tokens[0].codePointAt(0);
- tick = Integer.parseInt(tokens[1],16);
- tick_valid = true;
- a = Integer.parseInt(tokens[2],16);
- b = Integer.parseInt(tokens[3],16);
- }
- } else if (tokens[0].equals("Config") && tokens[1].equals("version:")) {
- cmd = AltosLib.AO_LOG_CONFIG_VERSION;
- data = tokens[2];
- } else if (tokens[0].equals("Main") && tokens[1].equals("deploy:")) {
- cmd = AltosLib.AO_LOG_MAIN_DEPLOY;
- a = Integer.parseInt(tokens[2]);
- } else if (tokens[0].equals("Apogee") && tokens[1].equals("delay:")) {
- cmd = AltosLib.AO_LOG_APOGEE_DELAY;
- a = Integer.parseInt(tokens[2]);
- } else if (tokens[0].equals("Radio") && tokens[1].equals("channel:")) {
- cmd = AltosLib.AO_LOG_RADIO_CHANNEL;
- a = Integer.parseInt(tokens[2]);
- } else if (tokens[0].equals("Callsign:")) {
- cmd = AltosLib.AO_LOG_CALLSIGN;
- data = tokens[1].replaceAll("\"","");
- } else if (tokens[0].equals("Accel") && tokens[1].equals("cal")) {
- cmd = AltosLib.AO_LOG_ACCEL_CAL;
- a = Integer.parseInt(tokens[3]);
- b = Integer.parseInt(tokens[5]);
- } else if (tokens[0].equals("Radio") && tokens[1].equals("cal:")) {
- cmd = AltosLib.AO_LOG_RADIO_CAL;
- a = Integer.parseInt(tokens[2]);
- } else if (tokens[0].equals("Max") && tokens[1].equals("flight") && tokens[2].equals("log:")) {
- cmd = AltosLib.AO_LOG_MAX_FLIGHT_LOG;
- a = Integer.parseInt(tokens[3]);
- } else if (tokens[0].equals("manufacturer")) {
- cmd = AltosLib.AO_LOG_MANUFACTURER;
- data = tokens[1];
- } else if (tokens[0].equals("product")) {
- cmd = AltosLib.AO_LOG_PRODUCT;
- data = tokens[1];
- } else if (tokens[0].equals("serial-number")) {
- cmd = AltosLib.AO_LOG_SERIAL_NUMBER;
- a = Integer.parseInt(tokens[1]);
- } else if (tokens[0].equals("log-format")) {
- cmd = AltosLib.AO_LOG_LOG_FORMAT;
- a = Integer.parseInt(tokens[1]);
- } else if (tokens[0].equals("software-version")) {
- cmd = AltosLib.AO_LOG_SOFTWARE_VERSION;
- data = tokens[1];
- } else {
- cmd = AltosLib.AO_LOG_INVALID;
- data = line;
- }
- } catch (NumberFormatException ne) {
- cmd = AltosLib.AO_LOG_INVALID;
- data = line;
- }
- }
- }
-
- public AltosEepromRecord(int in_cmd, int in_tick, int in_a, int in_b) {
- tick_valid = true;
- cmd = in_cmd;
- tick = in_tick;
- a = in_a;
- b = in_b;
- }
-}
diff --git a/altoslib/AltosEepromTM.java b/altoslib/AltosEepromTM.java
index 2bb9d974..a38c2dae 100644
--- a/altoslib/AltosEepromTM.java
+++ b/altoslib/AltosEepromTM.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosEepromTeleScience.java b/altoslib/AltosEepromTeleScience.java
deleted file mode 100644
index bacd66b5..00000000
--- a/altoslib/AltosEepromTeleScience.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-import java.text.*;
-
-public class AltosEepromTeleScience {
- public int type;
- public int tick;
- public int tm_state;
- public int tm_tick;
- public int[] data;
- public boolean valid;
-
- public static final int AO_LOG_TELESCIENCE_START = 's';
- public static final int AO_LOG_TELESCIENCE_DATA = 'd';
-
- static final int max_data = 12;
- public static final int record_length = 32;
-
- public int record_length() { return record_length; }
-
- public AltosEepromTeleScience (AltosEepromChunk chunk, int start) throws ParseException {
- type = chunk.data(start);
-
- valid = !chunk.erased(start, record_length);
- if (valid) {
- if (AltosConvert.checksum(chunk.data, start, record_length) != 0)
- throw new ParseException(String.format("invalid checksum at 0x%x",
- chunk.address + start), 0);
- } else {
- type = AltosLib.AO_LOG_INVALID;
- }
-
- tick = chunk.data16(start+2);
- tm_tick = chunk.data16(start+4);
- tm_state = chunk.data(start+6);
- data = new int[max_data];
- for (int i = 0; i < max_data; i++)
- data[i] = chunk.data16(start + 8 + i * 2);
- }
-}
diff --git a/altoslib/AltosFile.java b/altoslib/AltosFile.java
index 54c54824..9802f883 100644
--- a/altoslib/AltosFile.java
+++ b/altoslib/AltosFile.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.File;
import java.util.*;
@@ -23,7 +23,7 @@ import java.util.*;
public class AltosFile extends File {
static String number(int n) {
- if (n == AltosRecord.MISSING)
+ if (n == AltosLib.MISSING)
return "unk";
else
return String.format("%03d", n);
diff --git a/altoslib/AltosFlash.java b/altoslib/AltosFlash.java
index 010274b9..d8069157 100644
--- a/altoslib/AltosFlash.java
+++ b/altoslib/AltosFlash.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
diff --git a/altoslib/AltosFlashListener.java b/altoslib/AltosFlashListener.java
index ab50b74a..777ae635 100644
--- a/altoslib/AltosFlashListener.java
+++ b/altoslib/AltosFlashListener.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public interface AltosFlashListener {
public void position(String label, int percent);
diff --git a/altoslib/AltosFlightReader.java b/altoslib/AltosFlightReader.java
index 5a415274..4a722e42 100644
--- a/altoslib/AltosFlightReader.java
+++ b/altoslib/AltosFlightReader.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
import java.io.*;
@@ -48,5 +48,5 @@ public class AltosFlightReader {
public boolean has_monitor_battery() { return false; }
- public double monitor_battery() { return AltosRecord.MISSING; }
+ public double monitor_battery() { return AltosLib.MISSING; }
}
diff --git a/altoslib/AltosFrequency.java b/altoslib/AltosFrequency.java
index 484a2fd9..ece7525a 100644
--- a/altoslib/AltosFrequency.java
+++ b/altoslib/AltosFrequency.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosFrequency {
public double frequency;
diff --git a/altoslib/AltosGPS.java b/altoslib/AltosGPS.java
index a8c19e4a..1d5b0755 100644
--- a/altoslib/AltosGPS.java
+++ b/altoslib/AltosGPS.java
@@ -15,13 +15,14 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
+import java.util.concurrent.*;
public class AltosGPS implements Cloneable {
- public final static int MISSING = AltosRecord.MISSING;
+ public final static int MISSING = AltosLib.MISSING;
public int nsat;
public boolean locked;
@@ -65,8 +66,8 @@ public class AltosGPS implements Cloneable {
}
public void ClearGPSTime() {
- year = month = day = AltosRecord.MISSING;
- hour = minute = second = AltosRecord.MISSING;
+ year = month = day = AltosLib.MISSING;
+ hour = minute = second = AltosLib.MISSING;
}
public AltosGPS(AltosTelemetryMap map) throws ParseException {
@@ -91,9 +92,9 @@ public class AltosGPS implements Cloneable {
second = map.get_int(AltosTelemetryLegacy.AO_TELEM_GPS_SECOND, 0);
ground_speed = map.get_double(AltosTelemetryLegacy.AO_TELEM_GPS_HORIZONTAL_SPEED,
- AltosRecord.MISSING, 1/100.0);
+ AltosLib.MISSING, 1/100.0);
course = map.get_int(AltosTelemetryLegacy.AO_TELEM_GPS_COURSE,
- AltosRecord.MISSING);
+ AltosLib.MISSING);
hdop = map.get_double(AltosTelemetryLegacy.AO_TELEM_GPS_HDOP, MISSING, 1.0);
vdop = map.get_double(AltosTelemetryLegacy.AO_TELEM_GPS_VDOP, MISSING, 1.0);
h_error = map.get_int(AltosTelemetryLegacy.AO_TELEM_GPS_HERROR, MISSING);
@@ -107,6 +108,62 @@ public class AltosGPS implements Cloneable {
}
}
+ public boolean parse_string (String line, boolean says_done) {
+ String[] bits = line.split("\\s+");
+ if (bits.length == 0)
+ return false;
+ if (line.startsWith("Date:")) {
+ if (bits.length < 2)
+ return false;
+ String[] d = bits[1].split("/");
+ if (d.length < 3)
+ return false;
+ year = Integer.parseInt(d[0]) + 2000;
+ month = Integer.parseInt(d[1]);
+ day = Integer.parseInt(d[2]);
+ } else if (line.startsWith("Time:")) {
+ if (bits.length < 2)
+ return false;
+ String[] d = bits[1].split(":");
+ if (d.length < 3)
+ return false;
+ hour = Integer.parseInt(d[0]);
+ minute = Integer.parseInt(d[1]);
+ second = Integer.parseInt(d[2]);
+ } else if (line.startsWith("Lat/Lon:")) {
+ if (bits.length < 3)
+ return false;
+ lat = Integer.parseInt(bits[1]) * 1.0e-7;
+ lon = Integer.parseInt(bits[2]) * 1.0e-7;
+ } else if (line.startsWith("Alt:")) {
+ if (bits.length < 2)
+ return false;
+ alt = Integer.parseInt(bits[1]);
+ } else if (line.startsWith("Flags:")) {
+ if (bits.length < 2)
+ return false;
+ int status = Integer.decode(bits[1]);
+ connected = (status & AltosLib.AO_GPS_RUNNING) != 0;
+ locked = (status & AltosLib.AO_GPS_VALID) != 0;
+ if (!says_done)
+ return false;
+ } else if (line.startsWith("Sats:")) {
+ if (bits.length < 2)
+ return false;
+ nsat = Integer.parseInt(bits[1]);
+ cc_gps_sat = new AltosGPSSat[nsat];
+ for (int i = 0; i < nsat; i++) {
+ int svid = Integer.parseInt(bits[2+i*2]);
+ int cc_n0 = Integer.parseInt(bits[3+i*2]);
+ cc_gps_sat[i] = new AltosGPSSat(svid, cc_n0);
+ }
+ } else if (line.startsWith("done")) {
+ return false;
+ } else
+ return false;
+ return true;
+ }
+
public AltosGPS(String[] words, int i, int version) throws ParseException {
AltosParse.word(words[i++], "GPS");
nsat = AltosParse.parse_int(words[i++]);
@@ -212,9 +269,9 @@ public class AltosGPS implements Cloneable {
}
public AltosGPS() {
- lat = AltosRecord.MISSING;
- lon = AltosRecord.MISSING;
- alt = AltosRecord.MISSING;
+ lat = AltosLib.MISSING;
+ lon = AltosLib.MISSING;
+ alt = AltosLib.MISSING;
ClearGPSTime();
cc_gps_sat = null;
}
@@ -283,11 +340,37 @@ public class AltosGPS implements Cloneable {
}
}
} else {
- lat = AltosRecord.MISSING;
- lon = AltosRecord.MISSING;
- alt = AltosRecord.MISSING;
+ lat = AltosLib.MISSING;
+ lon = AltosLib.MISSING;
+ alt = AltosLib.MISSING;
ClearGPSTime();
cc_gps_sat = null;
}
}
+
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosGPS gps = new AltosGPS(link, config_data);
+
+ if (gps != null) {
+ state.set_gps(gps, state.gps_sequence++);
+ return;
+ }
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ state.set_gps(null, 0);
+ }
+
+ public AltosGPS (AltosLink link, AltosConfigData config_data) throws TimeoutException, InterruptedException {
+ boolean says_done = config_data.compare_version("1.0") >= 0;
+ link.printf("g\n");
+ for (;;) {
+ String line = link.get_reply_no_dialog(5000);
+ if (line == null)
+ throw new TimeoutException();
+ if (!parse_string(line, says_done))
+ break;
+ }
+ }
}
diff --git a/altoslib/AltosGPSQuery.java b/altoslib/AltosGPSQuery.java
deleted file mode 100644
index deb9d201..00000000
--- a/altoslib/AltosGPSQuery.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-import java.util.concurrent.*;
-
-class AltosGPSQuery extends AltosGPS {
- public AltosGPSQuery (AltosLink link, AltosConfigData config_data)
- throws TimeoutException, InterruptedException {
- boolean says_done = config_data.compare_version("1.0") >= 0;
- link.printf("g\n");
- for (;;) {
- String line = link.get_reply_no_dialog(5000);
- if (line == null)
- throw new TimeoutException();
- String[] bits = line.split("\\s+");
- if (bits.length == 0)
- continue;
- if (line.startsWith("Date:")) {
- if (bits.length < 2)
- continue;
- String[] d = bits[1].split(":");
- if (d.length < 3)
- continue;
- year = Integer.parseInt(d[0]) + 2000;
- month = Integer.parseInt(d[1]);
- day = Integer.parseInt(d[2]);
- continue;
- }
- if (line.startsWith("Time:")) {
- if (bits.length < 2)
- continue;
- String[] d = bits[1].split("/");
- if (d.length < 3)
- continue;
- hour = Integer.parseInt(d[0]);
- minute = Integer.parseInt(d[1]);
- second = Integer.parseInt(d[2]);
- continue;
- }
- if (line.startsWith("Lat/Lon:")) {
- if (bits.length < 3)
- continue;
- lat = Integer.parseInt(bits[1]) * 1.0e-7;
- lon = Integer.parseInt(bits[2]) * 1.0e-7;
- continue;
- }
- if (line.startsWith("Alt:")) {
- if (bits.length < 2)
- continue;
- alt = Integer.parseInt(bits[1]);
- continue;
- }
- if (line.startsWith("Flags:")) {
- if (bits.length < 2)
- continue;
- int status = Integer.decode(bits[1]);
- connected = (status & AltosLib.AO_GPS_RUNNING) != 0;
- locked = (status & AltosLib.AO_GPS_VALID) != 0;
- if (!says_done)
- break;
- continue;
- }
- if (line.startsWith("Sats:")) {
- if (bits.length < 2)
- continue;
- nsat = Integer.parseInt(bits[1]);
- cc_gps_sat = new AltosGPSSat[nsat];
- for (int i = 0; i < nsat; i++) {
- int svid = Integer.parseInt(bits[2+i*2]);
- int cc_n0 = Integer.parseInt(bits[3+i*2]);
- cc_gps_sat[i] = new AltosGPSSat(svid, cc_n0);
- }
- }
- if (line.startsWith("done"))
- break;
- if (line.startsWith("Syntax error"))
- break;
- }
- }
-}
-
diff --git a/altoslib/AltosGPSSat.java b/altoslib/AltosGPSSat.java
index 8714dd8a..0e17d7f2 100644
--- a/altoslib/AltosGPSSat.java
+++ b/altoslib/AltosGPSSat.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosGPSSat {
public int svid;
diff --git a/altoslib/AltosGreatCircle.java b/altoslib/AltosGreatCircle.java
index 770c3c6c..2c84bf4a 100644
--- a/altoslib/AltosGreatCircle.java
+++ b/altoslib/AltosGreatCircle.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.lang.Math;
diff --git a/altoslib/AltosHeight.java b/altoslib/AltosHeight.java
index 96f5722b..1d2e4dbc 100644
--- a/altoslib/AltosHeight.java
+++ b/altoslib/AltosHeight.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosHeight extends AltosUnits {
diff --git a/altoslib/AltosHexfile.java b/altoslib/AltosHexfile.java
index 2140228a..90352927 100644
--- a/altoslib/AltosHexfile.java
+++ b/altoslib/AltosHexfile.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.LinkedList;
diff --git a/altoslib/AltosIMU.java b/altoslib/AltosIMU.java
index c5ebbb16..c231dda7 100644
--- a/altoslib/AltosIMU.java
+++ b/altoslib/AltosIMU.java
@@ -15,7 +15,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
+
+import java.util.concurrent.*;
public class AltosIMU implements Cloneable {
public int accel_x;
@@ -26,6 +28,23 @@ public class AltosIMU implements Cloneable {
public int gyro_y;
public int gyro_z;
+ public boolean parse_string(String line) {
+ if (!line.startsWith("Accel:"))
+ return false;
+
+ String[] items = line.split("\\s+");
+
+ if (items.length >= 8) {
+ accel_x = Integer.parseInt(items[1]);
+ accel_y = Integer.parseInt(items[2]);
+ accel_z = Integer.parseInt(items[3]);
+ gyro_x = Integer.parseInt(items[5]);
+ gyro_y = Integer.parseInt(items[6]);
+ gyro_z = Integer.parseInt(items[7]);
+ }
+ return true;
+ }
+
public AltosIMU clone() {
AltosIMU n = new AltosIMU();
@@ -38,5 +57,38 @@ public class AltosIMU implements Cloneable {
n.gyro_z = gyro_z;
return n;
}
+
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosIMU imu = new AltosIMU(link);
+
+ if (imu != null)
+ state.set_imu(imu);
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ public AltosIMU() {
+ accel_x = AltosLib.MISSING;
+ accel_y = AltosLib.MISSING;
+ accel_z = AltosLib.MISSING;
+
+ gyro_x = AltosLib.MISSING;
+ gyro_y = AltosLib.MISSING;
+ gyro_z = AltosLib.MISSING;
+ }
+
+ public AltosIMU(AltosLink link) throws InterruptedException, TimeoutException {
+ this();
+ link.printf("I\n");
+ for (;;) {
+ String line = link.get_reply_no_dialog(5000);
+ if (line == null) {
+ throw new TimeoutException();
+ }
+ if (parse_string(line))
+ break;
+ }
+ }
}
- \ No newline at end of file
diff --git a/altoslib/AltosIMUQuery.java b/altoslib/AltosIMUQuery.java
deleted file mode 100644
index 4ea5d963..00000000
--- a/altoslib/AltosIMUQuery.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-import java.util.concurrent.TimeoutException;
-
-class AltosIMUQuery extends AltosIMU {
-
- public AltosIMUQuery (AltosLink link) throws InterruptedException, TimeoutException {
- link.printf("I\n");
- for (;;) {
- String line = link.get_reply_no_dialog(5000);
- if (line == null) {
- throw new TimeoutException();
- }
- if (!line.startsWith("Accel:"))
- continue;
- String[] items = line.split("\\s+");
- if (items.length >= 8) {
- accel_x = Integer.parseInt(items[1]);
- accel_y = Integer.parseInt(items[2]);
- accel_z = Integer.parseInt(items[3]);
- gyro_x = Integer.parseInt(items[5]);
- gyro_y = Integer.parseInt(items[6]);
- gyro_z = Integer.parseInt(items[7]);
- }
- break;
- }
- }
-}
-
diff --git a/altoslib/AltosRecordIterable.java b/altoslib/AltosIdle.java
index 62dbdfe3..456a9247 100644
--- a/altoslib/AltosRecordIterable.java
+++ b/altoslib/AltosIdle.java
@@ -1,5 +1,5 @@
/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
+ * Copyright © 2013 Keith Packard <keithp@keithp.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,15 +15,25 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
+import java.text.*;
+import java.util.concurrent.*;
-public abstract class AltosRecordIterable implements Iterable<AltosRecord> {
- public abstract Iterator<AltosRecord> iterator();
- public void write_comments(PrintStream out) { }
- public boolean has_accel() { return false; }
- public boolean has_gps() { return false; }
- public boolean has_ignite() { return false; };
+public abstract class AltosIdle {
+ AltosLink link;
+ AltosConfigData config_data;
+
+ public void printf(String format, Object ... arguments) {
+ link.printf(format, arguments);
+ }
+
+ public abstract void update_state(AltosState state) throws InterruptedException, TimeoutException;
+
+ public AltosIdle(AltosLink link, AltosConfigData config_data) {
+ this.link = link;
+ this.config_data = config_data;
+ }
}
diff --git a/altoslib/AltosIdleFetch.java b/altoslib/AltosIdleFetch.java
new file mode 100644
index 00000000..42943c07
--- /dev/null
+++ b/altoslib/AltosIdleFetch.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright © 2013 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altoslib_2;
+
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.util.concurrent.*;
+
+class AltosIdler {
+ String prefix;
+ int[] idlers;
+
+ static final int idle_gps = 0;
+ static final int idle_imu = 1;
+ static final int idle_mag = 2;
+ static final int idle_ms5607 = 3;
+ static final int idle_mma655x = 4;
+
+
+ static final int idle_sensor_tm = 10;
+ static final int idle_sensor_metrum = 11;
+ static final int idle_sensor_mega = 12;
+ static final int idle_sensor_emini = 13;
+
+ public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) throws InterruptedException, TimeoutException {
+ for (int idler : idlers) {
+ AltosIdle idle = null;
+ switch (idler) {
+ case idle_gps:
+ AltosGPS.update_state(state, link, config_data);
+ break;
+ case idle_imu:
+ AltosIMU.update_state(state, link, config_data);
+ break;
+ case idle_mag:
+ AltosMag.update_state(state, link, config_data);
+ break;
+ case idle_ms5607:
+ AltosMs5607.update_state(state, link, config_data);
+ break;
+ case idle_mma655x:
+ AltosMma655x.update_state(state, link, config_data);
+ break;
+ case idle_sensor_tm:
+ AltosSensorTM.update_state(state, link, config_data);
+ break;
+ case idle_sensor_metrum:
+ AltosSensorMetrum.update_state(state, link, config_data);
+ break;
+ case idle_sensor_mega:
+ AltosSensorMega.update_state(state, link, config_data);
+ break;
+ case idle_sensor_emini:
+ AltosSensorEMini.update_state(state, link, config_data);
+ break;
+ }
+ if (idle != null)
+ idle.update_state(state);
+ }
+ }
+
+ public boolean matches(AltosConfigData config_data) {
+ return config_data.product.startsWith(prefix);
+ }
+
+ public AltosIdler(String prefix, int ... idlers) {
+ this.prefix = prefix;
+ this.idlers = idlers;
+ }
+}
+
+
+public class AltosIdleFetch implements AltosStateUpdate {
+
+ static final AltosIdler[] idlers = {
+
+ new AltosIdler("EasyMini",
+ AltosIdler.idle_ms5607,
+ AltosIdler.idle_sensor_emini),
+
+ new AltosIdler("TeleMini-v1",
+ AltosIdler.idle_sensor_tm),
+
+ new AltosIdler("TeleMini-v2",
+ AltosIdler.idle_ms5607,
+ AltosIdler.idle_sensor_tm),
+
+ new AltosIdler("TeleMetrum-v1",
+ AltosIdler.idle_gps,
+ AltosIdler.idle_sensor_tm),
+
+ new AltosIdler("TeleMetrum-v2",
+ AltosIdler.idle_gps,
+ AltosIdler.idle_ms5607, AltosIdler.idle_mma655x,
+ AltosIdler.idle_sensor_metrum),
+
+ new AltosIdler("TeleMega",
+ AltosIdler.idle_gps,
+ AltosIdler.idle_ms5607, AltosIdler.idle_mma655x,
+ AltosIdler.idle_imu, AltosIdler.idle_mag,
+ AltosIdler.idle_sensor_mega),
+ };
+
+ AltosLink link;
+
+ double frequency;
+ String callsign;
+
+ public void update_state(AltosState state) {
+ try {
+ AltosConfigData config_data = new AltosConfigData(link);
+ state.set_state(AltosLib.ao_flight_startup);
+ state.set_serial(config_data.serial);
+ state.set_callsign(config_data.callsign);
+ state.set_ground_accel(config_data.accel_cal_plus);
+ state.set_accel_g(config_data.accel_cal_plus, config_data.accel_cal_minus);
+ for (AltosIdler idler : idlers) {
+ if (idler.matches(config_data)) {
+ idler.update_state(state, link, config_data);
+ break;
+ }
+ }
+ state.set_received_time(System.currentTimeMillis());
+ } catch (InterruptedException ie) {
+ } catch (TimeoutException te) {
+ }
+
+ }
+
+ public AltosIdleFetch(AltosLink link) {
+ this.link = link;
+ }
+}
diff --git a/altoslib/AltosIdleMonitor.java b/altoslib/AltosIdleMonitor.java
index b3ce5b20..d858845a 100644
--- a/altoslib/AltosIdleMonitor.java
+++ b/altoslib/AltosIdleMonitor.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.concurrent.*;
@@ -24,11 +24,13 @@ import java.util.concurrent.*;
public class AltosIdleMonitor extends Thread {
AltosLink link;
AltosIdleMonitorListener listener;
- AltosState state;
+
+ AltosIdleFetch fetch;
+
boolean remote;
double frequency;
String callsign;
- AltosState previous_state;
+
AltosListenerState listener_state;
AltosConfigData config_data;
AltosGPS gps;
@@ -47,86 +49,35 @@ public class AltosIdleMonitor extends Thread {
return rssi;
}
- boolean has_sensor_tm(AltosConfigData config_data) {
- return config_data.product.startsWith("TeleMetrum") || config_data.product.startsWith("TeleMini");
- }
-
- boolean has_sensor_mm(AltosConfigData config_data) {
- return config_data.product.startsWith("TeleMega");
- }
-
- boolean has_gps(AltosConfigData config_data) {
- return config_data.product.startsWith("TeleMetrum") || config_data.product.startsWith("TeleMega");
+ void start_link() throws InterruptedException, TimeoutException {
+ if (remote) {
+ link.set_radio_frequency(frequency);
+ link.set_callsign(callsign);
+ link.start_remote();
+ } else
+ link.flush_input();
}
- AltosRecord sensor_mm(AltosConfigData config_data) throws InterruptedException, TimeoutException {
- AltosRecordMM record_mm = new AltosRecordMM();
- AltosSensorMM sensor = new AltosSensorMM(link);
- AltosMs5607 ms5607 = new AltosMs5607Query(link);
- AltosIMU imu = new AltosIMUQuery(link);
-
- record_mm.accel_plus_g = config_data.accel_cal_plus;
- record_mm.accel_minus_g = config_data.accel_cal_minus;
-
- record_mm.ground_accel = sensor.accel;
- record_mm.accel = sensor.accel;
- record_mm.ground_pres = ms5607.pa;
- record_mm.pres = ms5607.pa;
- record_mm.temp = ms5607.cc;
-
- record_mm.v_batt = sensor.v_batt;
- record_mm.v_pyro = sensor.v_pyro;
- record_mm.sense = sensor.sense;
-
- record_mm.imu = imu;
-
- return record_mm;
+ void stop_link() throws InterruptedException, TimeoutException {
+ if (remote)
+ link.stop_remote();
}
- void update_state() throws InterruptedException, TimeoutException {
- AltosRecord record = null;
+ void update_state(AltosState state) throws InterruptedException, TimeoutException {
+ boolean worked = false;
try {
- if (remote) {
- link.set_radio_frequency(frequency);
- link.set_callsign(callsign);
- link.start_remote();
- } else
- link.flush_input();
- config_data = new AltosConfigData(link);
-
- if (has_sensor_tm(config_data))
- record = new AltosSensorTM(link, config_data);
- else if (has_sensor_mm(config_data))
- record = sensor_mm(config_data);
- else
- record = new AltosRecordNone();
-
- if (has_gps(config_data))
- gps = new AltosGPSQuery(link, config_data);
-
- record.version = 0;
- record.callsign = config_data.callsign;
- record.serial = config_data.serial;
- record.flight = config_data.log_available() > 0 ? 255 : 0;
- record.status = 0;
- record.state = AltosLib.ao_flight_idle;
- record.gps = gps;
- record.gps_sequence++;
- state = new AltosState (record, state);
+ start_link();
+ fetch.update_state(state);
+ worked = true;
} finally {
- if (remote) {
- link.stop_remote();
- if (record != null) {
- record.rssi = link.rssi();
- listener_state.battery = link.monitor_battery();
- }
- } else {
- if (record != null)
- record.rssi = 0;
+ stop_link();
+ if (worked) {
+ if (remote)
+ state.set_rssi(link.rssi(), 0);
+ listener_state.battery = link.monitor_battery();
}
}
-
}
public void set_frequency(double in_frequency) {
@@ -139,10 +90,6 @@ public class AltosIdleMonitor extends Thread {
link.abort_reply();
}
- public void post_state() {
- listener.update(state, listener_state);
- }
-
public void abort() {
if (isAlive()) {
interrupt();
@@ -155,18 +102,20 @@ public class AltosIdleMonitor extends Thread {
}
public void run() {
+ AltosState state = new AltosState();
try {
- for (;;) {
+ while (!link.has_error) {
try {
- update_state();
- post_state();
+ link.config_data();
+ update_state(state);
+ listener.update(state, listener_state);
} catch (TimeoutException te) {
}
Thread.sleep(1000);
}
} catch (InterruptedException ie) {
- link.close();
}
+ link.close();
}
public AltosIdleMonitor(AltosIdleMonitorListener in_listener, AltosLink in_link, boolean in_remote)
@@ -174,7 +123,7 @@ public class AltosIdleMonitor extends Thread {
listener = in_listener;
link = in_link;
remote = in_remote;
- state = null;
listener_state = new AltosListenerState();
+ fetch = new AltosIdleFetch(link);
}
}
diff --git a/altoslib/AltosIdleMonitorListener.java b/altoslib/AltosIdleMonitorListener.java
index 27e36dea..0b03b897 100644
--- a/altoslib/AltosIdleMonitorListener.java
+++ b/altoslib/AltosIdleMonitorListener.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public interface AltosIdleMonitorListener {
public void update(AltosState state, AltosListenerState listener_state);
diff --git a/altoslib/AltosIgnite.java b/altoslib/AltosIgnite.java
index 85905900..42169989 100644
--- a/altoslib/AltosIgnite.java
+++ b/altoslib/AltosIgnite.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.concurrent.*;
diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java
index d6d78ca8..f8a3974a 100644
--- a/altoslib/AltosLib.java
+++ b/altoslib/AltosLib.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.util.*;
import java.io.*;
@@ -63,6 +63,8 @@ public class AltosLib {
public static final int AO_LOG_SOFTWARE_VERSION = 9999;
+ public final static int MISSING = 0x7fffffff;
+
/* Added to flag invalid records */
public static final int AO_LOG_INVALID = -1;
diff --git a/altoslib/AltosLine.java b/altoslib/AltosLine.java
index b3bd20f9..e5dd13fc 100644
--- a/altoslib/AltosLine.java
+++ b/altoslib/AltosLine.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosLine {
public String line;
diff --git a/altoslib/AltosLink.java b/altoslib/AltosLink.java
index 159ebfe1..b1bf525b 100644
--- a/altoslib/AltosLink.java
+++ b/altoslib/AltosLink.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.concurrent.*;
@@ -32,6 +32,9 @@ public abstract class AltosLink implements Runnable {
public static boolean debug = false;
public static void set_debug(boolean in_debug) { debug = in_debug; }
+
+ public boolean has_error;
+
LinkedList<String> pending_output = new LinkedList<String>();
public LinkedList<LinkedBlockingQueue<AltosLine>> monitors = new LinkedList<LinkedBlockingQueue<AltosLine>> ();;
@@ -107,6 +110,7 @@ public abstract class AltosLink implements Runnable {
if (c == ERROR) {
if (debug)
System.out.printf("ERROR\n");
+ has_error = true;
add_telem (new AltosLine());
add_reply (new AltosLine());
break;
@@ -399,7 +403,7 @@ public abstract class AltosLink implements Runnable {
}
public double monitor_battery() {
- int monitor_batt = AltosRecord.MISSING;
+ int monitor_batt = AltosLib.MISSING;
if (config_data.has_monitor_battery()) {
try {
@@ -416,12 +420,13 @@ public abstract class AltosLink implements Runnable {
} catch (TimeoutException te) {
}
}
- if (monitor_batt == AltosRecord.MISSING)
- return AltosRecord.MISSING;
+ if (monitor_batt == AltosLib.MISSING)
+ return AltosLib.MISSING;
return AltosConvert.cc_battery_to_voltage(monitor_batt);
}
public AltosLink() {
callsign = "";
+ has_error = false;
}
}
diff --git a/altoslib/AltosListenerState.java b/altoslib/AltosListenerState.java
index 2fb4673e..01dd7afb 100644
--- a/altoslib/AltosListenerState.java
+++ b/altoslib/AltosListenerState.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosListenerState {
public int crc_errors;
@@ -23,6 +23,6 @@ public class AltosListenerState {
public AltosListenerState() {
crc_errors = 0;
- battery = AltosRecord.MISSING;
+ battery = AltosLib.MISSING;
}
}
diff --git a/altoslib/AltosLog.java b/altoslib/AltosLog.java
index 7f69bb65..17b04970 100644
--- a/altoslib/AltosLog.java
+++ b/altoslib/AltosLog.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.text.ParseException;
diff --git a/altoslib/AltosMag.java b/altoslib/AltosMag.java
index cb6826f3..56add8f3 100644
--- a/altoslib/AltosMag.java
+++ b/altoslib/AltosMag.java
@@ -15,13 +15,29 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
+
+import java.util.concurrent.*;
public class AltosMag implements Cloneable {
public int x;
public int y;
public int z;
+ public boolean parse_string(String line) {
+ if (!line.startsWith("X:"))
+ return false;
+
+ String[] items = line.split("\\s+");
+
+ if (items.length >= 6) {
+ x = Integer.parseInt(items[1]);
+ y = Integer.parseInt(items[3]);
+ z = Integer.parseInt(items[5]);
+ }
+ return true;
+ }
+
public AltosMag clone() {
AltosMag n = new AltosMag();
@@ -30,5 +46,35 @@ public class AltosMag implements Cloneable {
n.z = z;
return n;
}
+
+ public AltosMag() {
+ x = AltosLib.MISSING;
+ y = AltosLib.MISSING;
+ z = AltosLib.MISSING;
+ }
+
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosMag mag = new AltosMag(link);
+
+ if (mag != null)
+ state.set_mag(mag);
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ public AltosMag(AltosLink link) throws InterruptedException, TimeoutException {
+ this();
+ link.printf("M\n");
+ for (;;) {
+ String line = link.get_reply_no_dialog(5000);
+ if (line == null) {
+ throw new TimeoutException();
+ }
+ if (parse_string(line))
+ break;
+ }
+ }
}
\ No newline at end of file
diff --git a/altoslib/AltosMma655x.java b/altoslib/AltosMma655x.java
new file mode 100644
index 00000000..8dc947db
--- /dev/null
+++ b/altoslib/AltosMma655x.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altoslib_2;
+
+import java.util.concurrent.*;
+
+public class AltosMma655x implements Cloneable {
+
+ int accel;
+
+ public boolean parse_line(String line) {
+ String[] items = line.split("\\s+");
+ if (line.startsWith("MMA655X value:")) {
+ if (items.length >= 3)
+ accel = Integer.parseInt(items[1]);
+ } else
+ return false;
+ return true;
+ }
+
+ public AltosMma655x() {
+ accel = AltosLib.MISSING;
+ }
+
+ public AltosMma655x clone() {
+ AltosMma655x n = new AltosMma655x();
+
+ n.accel = accel;
+ return n;
+ }
+
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosMma655x mma655x = new AltosMma655x(link);
+
+ if (mma655x != null)
+ state.set_accel(mma655x.accel);
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ public AltosMma655x(AltosLink link) throws InterruptedException, TimeoutException {
+ this();
+ link.printf("A\n");
+ for (;;) {
+ String line = link.get_reply_no_dialog(5000);
+ if (line == null)
+ throw new TimeoutException();
+ if (!parse_line(line))
+ break;
+ }
+ }
+}
diff --git a/altoslib/AltosMs5607.java b/altoslib/AltosMs5607.java
index 606916b7..b29fa9ae 100644
--- a/altoslib/AltosMs5607.java
+++ b/altoslib/AltosMs5607.java
@@ -15,7 +15,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
+
+import java.util.concurrent.*;
public class AltosMs5607 {
public int reserved;
@@ -83,10 +85,13 @@ public class AltosMs5607 {
}
public boolean parse_line(String line) {
+ System.out.printf ("parse %s\n", line);
String[] items = line.split("\\s+");
if (line.startsWith("Pressure:")) {
- if (items.length >= 2)
+ if (items.length >= 2) {
raw_pres = Integer.parseInt(items[1]);
+ System.out.printf ("raw_pres %d\n", raw_pres);
+ }
} else if (line.startsWith("Temperature:")) {
if (items.length >= 2)
raw_temp = Integer.parseInt(items[1]);
@@ -94,8 +99,11 @@ public class AltosMs5607 {
if (items.length >= 3)
reserved = Integer.parseInt(items[2]);
} else if (line.startsWith("ms5607 sens:")) {
- if (items.length >= 3)
+ System.out.printf ("found sens length %d\n", items.length);
+ if (items.length >= 3) {
sens = Integer.parseInt(items[2]);
+ System.out.printf ("sens %d\n", sens);
+ }
} else if (line.startsWith("ms5607 off:")) {
if (items.length >= 3)
off = Integer.parseInt(items[2]);
@@ -114,15 +122,48 @@ public class AltosMs5607 {
} else if (line.startsWith("ms5607 crc:")) {
if (items.length >= 3)
crc = Integer.parseInt(items[2]);
- } else if (line.startsWith("Altitude"))
+ } else if (line.startsWith("Altitude:")) {
return false;
+ }
return true;
}
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosMs5607 ms5607 = new AltosMs5607(link);
+
+ if (ms5607 != null) {
+ state.set_ms5607(ms5607);
+ return;
+ }
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
+
public AltosMs5607() {
- raw_pres = AltosRecord.MISSING;
- raw_temp = AltosRecord.MISSING;
- pa = AltosRecord.MISSING;
- cc = AltosRecord.MISSING;
+ raw_pres = AltosLib.MISSING;
+ raw_temp = AltosLib.MISSING;
+ pa = AltosLib.MISSING;
+ cc = AltosLib.MISSING;
+ }
+
+ public AltosMs5607 (AltosLink link) throws InterruptedException, TimeoutException {
+ this();
+ link.printf("c s\nB\n");
+ for (;;) {
+ String line = link.get_reply_no_dialog(5000);
+ if (line == null) {
+ throw new TimeoutException();
+ }
+ if (!parse_line(line)) {
+ System.out.printf ("stop parsing at %s\n", line);
+ break;
+ }
+ }
+ System.out.printf ("sens %d off %d tcs %d tco %d tref %d tempsens %d crc %d pres %d temp %d\n",
+ sens, off, tcs, tco, tref, tempsens, crc, raw_pres, raw_temp);
+ convert();
+ System.out.printf ("pa %d cc %d\n", pa, cc);
}
}
diff --git a/altoslib/AltosMs5607Query.java b/altoslib/AltosMs5607Query.java
deleted file mode 100644
index d39dbf26..00000000
--- a/altoslib/AltosMs5607Query.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-import java.util.concurrent.TimeoutException;
-
-class AltosMs5607Query extends AltosMs5607 {
- public AltosMs5607Query (AltosLink link) throws InterruptedException, TimeoutException {
- link.printf("v\nB\n");
- for (;;) {
- String line = link.get_reply_no_dialog(5000);
- if (line == null) {
- throw new TimeoutException();
- }
- if (!parse_line(line))
- break;
- }
- convert();
- }
-}
-
diff --git a/altoslib/AltosOrderedMegaRecord.java b/altoslib/AltosOrderedMegaRecord.java
deleted file mode 100644
index b20a5bbd..00000000
--- a/altoslib/AltosOrderedMegaRecord.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-import java.text.ParseException;
-
-/*
- * AltosRecords with an index field so they can be sorted by tick while preserving
- * the original ordering for elements with matching ticks
- */
-class AltosOrderedMegaRecord extends AltosEepromMega implements Comparable<AltosOrderedMegaRecord> {
-
- public int index;
-
- public AltosOrderedMegaRecord(String line, int in_index, int prev_tick, boolean prev_tick_valid)
- throws ParseException {
- super(line);
- if (prev_tick_valid) {
- tick |= (prev_tick & ~0xffff);
- if (tick < prev_tick) {
- if (prev_tick - tick > 0x8000)
- tick += 0x10000;
- } else {
- if (tick - prev_tick > 0x8000)
- tick -= 0x10000;
- }
- }
- index = in_index;
- }
-
- public int compareTo(AltosOrderedMegaRecord o) {
- int tick_diff = tick - o.tick;
- if (tick_diff != 0)
- return tick_diff;
- return index - o.index;
- }
-}
diff --git a/altoslib/AltosOrderedMetrumRecord.java b/altoslib/AltosOrderedMetrumRecord.java
index 02cdf1fe..cc034bff 100644
--- a/altoslib/AltosOrderedMetrumRecord.java
+++ b/altoslib/AltosOrderedMetrumRecord.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.ParseException;
diff --git a/altoslib/AltosOrderedMiniRecord.java b/altoslib/AltosOrderedMiniRecord.java
deleted file mode 100644
index 96888941..00000000
--- a/altoslib/AltosOrderedMiniRecord.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-import java.text.ParseException;
-
-/*
- * AltosRecords with an index field so they can be sorted by tick while preserving
- * the original ordering for elements with matching ticks
- */
-class AltosOrderedMiniRecord extends AltosEepromMini implements Comparable<AltosOrderedMiniRecord> {
-
- public int index;
-
- public AltosOrderedMiniRecord(String line, int in_index, int prev_tick, boolean prev_tick_valid)
- throws ParseException {
- super(line);
- if (prev_tick_valid) {
- tick |= (prev_tick & ~0xffff);
- if (tick < prev_tick) {
- if (prev_tick - tick > 0x8000)
- tick += 0x10000;
- } else {
- if (tick - prev_tick > 0x8000)
- tick -= 0x10000;
- }
- }
- index = in_index;
- }
-
- public int compareTo(AltosOrderedMiniRecord o) {
- int tick_diff = tick - o.tick;
- if (tick_diff != 0)
- return tick_diff;
- return index - o.index;
- }
-}
diff --git a/altoslib/AltosOrderedRecord.java b/altoslib/AltosOrderedRecord.java
deleted file mode 100644
index 63507d39..00000000
--- a/altoslib/AltosOrderedRecord.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-import java.text.ParseException;
-
-/*
- * AltosRecords with an index field so they can be sorted by tick while preserving
- * the original ordering for elements with matching ticks
- */
-class AltosOrderedRecord extends AltosEepromRecord implements Comparable<AltosOrderedRecord> {
-
- public int index;
-
- public AltosOrderedRecord(String line, int in_index, int prev_tick, boolean prev_tick_valid)
- throws ParseException {
- super(line);
- if (prev_tick_valid) {
- tick |= (prev_tick & ~0xffff);
- if (tick < prev_tick) {
- if (prev_tick - tick > 0x8000)
- tick += 0x10000;
- } else {
- if (tick - prev_tick > 0x8000)
- tick -= 0x10000;
- }
- }
- index = in_index;
- }
-
- public AltosOrderedRecord(int in_cmd, int in_tick, int in_a, int in_b, int in_index) {
- super(in_cmd, in_tick, in_a, in_b);
- 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)
- return tick_diff;
- return index - o.index;
- }
-}
-
diff --git a/altoslib/AltosParse.java b/altoslib/AltosParse.java
index 66bbeed5..ca96a8f9 100644
--- a/altoslib/AltosParse.java
+++ b/altoslib/AltosParse.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
diff --git a/altoslib/AltosPreferences.java b/altoslib/AltosPreferences.java
index 088ca3d7..c4051f9b 100644
--- a/altoslib/AltosPreferences.java
+++ b/altoslib/AltosPreferences.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosPreferencesBackend.java b/altoslib/AltosPreferencesBackend.java
index fb8a235a..1ea28b01 100644
--- a/altoslib/AltosPreferencesBackend.java
+++ b/altoslib/AltosPreferencesBackend.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.File;
diff --git a/altoslib/AltosPyro.java b/altoslib/AltosPyro.java
index 4dbb4223..0142eac8 100644
--- a/altoslib/AltosPyro.java
+++ b/altoslib/AltosPyro.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.util.*;
import java.text.*;
diff --git a/altoslib/AltosRecord.java b/altoslib/AltosRecord.java
deleted file mode 100644
index 0c8e1db9..00000000
--- a/altoslib/AltosRecord.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-public class AltosRecord implements Comparable <AltosRecord>, Cloneable {
-
- public static final int seen_flight = 1;
- public static final int seen_sensor = 2;
- public static final int seen_temp_volt = 4;
- public static final int seen_deploy = 8;
- public static final int seen_gps_time = 16;
- public static final int seen_gps_lat = 32;
- public static final int seen_gps_lon = 64;
- public static final int seen_companion = 128;
-
- public int seen;
-
- public final static int MISSING = 0x7fffffff;
-
- /* Every AltosRecord implementation provides these fields */
-
- public int version;
- public String callsign;
- public int serial;
- public int flight;
- public int rssi;
- public int status;
- public int state;
- public int tick;
-
- public AltosGPS gps;
- public int gps_sequence;
-
- public double time; /* seconds since boost */
-
- public int device_type;
- public int config_major;
- public int config_minor;
- public int apogee_delay;
- public int main_deploy;
- public int flight_log_max;
- public String firmware_version;
-
- public double accel_plus_g, accel_minus_g;
- public double ground_accel;
- public double accel;
-
- public AltosRecordCompanion companion;
-
- /* Telemetry sources have these values recorded from the flight computer */
- public double kalman_height;
- public double kalman_speed;
- public double kalman_acceleration;
-
- /*
- * Abstract methods that convert record data
- * to standard units:
- *
- * pressure: Pa
- * voltage: V
- * acceleration: m/s²
- * speed: m/s
- * height: m
- * temperature: °C
- */
-
- public double pressure() { return MISSING; }
- public double ground_pressure() { return MISSING; }
- public double acceleration() { return MISSING; }
-
- public double altitude() {
- double p = pressure();
-
- if (p == MISSING)
- return MISSING;
- return AltosConvert.pressure_to_altitude(p);
- }
-
- public double ground_altitude() {
- double p = ground_pressure();
-
- if (p == MISSING)
- return MISSING;
- return AltosConvert.pressure_to_altitude(p);
- }
-
- public double height() {
- double g = ground_altitude();
- double a = altitude();
-
- if (g == MISSING)
- return MISSING;
- if (a == MISSING)
- return MISSING;
- return a - g;
- }
-
- public double battery_voltage() { return MISSING; }
-
- public double main_voltage() { return MISSING; }
-
- public double drogue_voltage() { return MISSING; }
-
- public double temperature() { return MISSING; }
-
- public AltosIMU imu() { return null; }
-
- public AltosMag mag() { return null; }
-
- public String state() {
- return AltosLib.state_name(state);
- }
-
- public int compareTo(AltosRecord o) {
- return tick - o.tick;
- }
-
- public AltosRecord clone() {
- AltosRecord n = new AltosRecord();
- n.copy(this);
- return n;
- }
-
- public void copy(AltosRecord old) {
- seen = old.seen;
- version = old.version;
- callsign = old.callsign;
- serial = old.serial;
- flight = old.flight;
- rssi = old.rssi;
- status = old.status;
- state = old.state;
- tick = old.tick;
- gps = new AltosGPS(old.gps);
- gps_sequence = old.gps_sequence;
- companion = old.companion;
- kalman_acceleration = old.kalman_acceleration;
- kalman_speed = old.kalman_speed;
- kalman_height = old.kalman_height;
- }
-
- public AltosRecord() {
- seen = 0;
- version = 0;
- callsign = "N0CALL";
- serial = MISSING;
- flight = MISSING;
- rssi = 0;
- status = 0;
- state = AltosLib.ao_flight_startup;
- tick = 0;
- gps = null;
- gps_sequence = 0;
- companion = null;
-
- kalman_acceleration = MISSING;
- kalman_speed = MISSING;
- kalman_height = MISSING;
-
- accel_plus_g = MISSING;
- accel_minus_g = MISSING;
-
- }
-}
diff --git a/altoslib/AltosRecordCompanion.java b/altoslib/AltosRecordCompanion.java
deleted file mode 100644
index b153fb5b..00000000
--- a/altoslib/AltosRecordCompanion.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-public class AltosRecordCompanion {
- public final static int board_id_telescience = 0x0a;
- public final static int MAX_CHANNELS = 12;
-
- public int tick;
- public int board_id;
- public int update_period;
- public int channels;
- public int[] companion_data;
-
- public AltosRecordCompanion(int in_channels) {
- channels = in_channels;
- if (channels < 0)
- channels = 0;
- if (channels > MAX_CHANNELS)
- channels = MAX_CHANNELS;
- companion_data = new int[channels];
- }
-}
diff --git a/altoslib/AltosRecordMM.java b/altoslib/AltosRecordMM.java
deleted file mode 100644
index d697111c..00000000
--- a/altoslib/AltosRecordMM.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-public class AltosRecordMM extends AltosRecord {
-
- /* Sensor values */
- public int accel;
- public int pres;
- public int temp;
-
- public int v_batt;
- public int v_pyro;
- public int sense[];
-
- public int ground_accel;
- public int ground_pres;
- public int accel_plus_g;
- public int accel_minus_g;
-
- public int flight_accel;
- public int flight_vel;
- public int flight_pres;
-
- public final static int num_sense = 6;
-
- public AltosIMU imu;
- public AltosMag mag;
-
- static double adc(int raw) {
- return raw / 4095.0;
- }
-
- public double pressure() {
- if (pres != MISSING)
- return pres;
- return MISSING;
- }
-
- public double ground_pressure() {
- if (ground_pres != MISSING)
- return ground_pres;
- return MISSING;
- }
-
- public double battery_voltage() {
- if (v_batt != MISSING)
- return 3.3 * adc(v_batt) * (15.0 + 27.0) / 27.0;
- return MISSING;
- }
-
- static double pyro(int raw) {
- if (raw != MISSING)
- return 3.3 * adc(raw) * (100.0 + 27.0) / 27.0;
- return MISSING;
- }
-
- public double main_voltage() {
- return pyro(sense[5]);
- }
-
- public double drogue_voltage() {
- return pyro(sense[4]);
- }
-
- public double temperature() {
- if (temp != MISSING)
- return temp / 100.0;
- return MISSING;
- }
-
- public AltosIMU imu() { return imu; }
-
- public AltosMag mag() { return mag; }
-
- double accel_counts_per_mss() {
- double counts_per_g = Math.abs(accel_minus_g - accel_plus_g) / 2;
-
- return counts_per_g / 9.80665;
- }
-
- public double acceleration() {
- if (ground_accel == MISSING || accel == MISSING)
- return MISSING;
-
- if (accel_minus_g == MISSING || accel_plus_g == MISSING)
- return MISSING;
-
- return (ground_accel - accel) / accel_counts_per_mss();
- }
-
- public void copy (AltosRecordMM old) {
- super.copy(old);
-
- accel = old.accel;
- pres = old.pres;
- temp = old.temp;
-
- v_batt = old.v_batt;
- v_pyro = old.v_pyro;
- sense = new int[num_sense];
-
- for (int i = 0; i < num_sense; i++)
- sense[i] = old.sense[i];
-
- ground_accel = old.ground_accel;
- ground_pres = old.ground_pres;
- accel_plus_g = old.accel_plus_g;
- accel_minus_g = old.accel_minus_g;
-
- flight_accel = old.flight_accel;
- flight_vel = old.flight_vel;
- flight_pres = old.flight_pres;
-
- imu = old.imu;
- mag = old.mag;
- }
-
-
-
- public AltosRecordMM clone() {
- return new AltosRecordMM(this);
- }
-
- void make_missing() {
-
- accel = MISSING;
- pres = MISSING;
- temp = MISSING;
-
- v_batt = MISSING;
- v_pyro = MISSING;
- sense = new int[num_sense];
- for (int i = 0; i < num_sense; i++)
- sense[i] = MISSING;
-
- ground_accel = MISSING;
- ground_pres = MISSING;
- accel_plus_g = MISSING;
- accel_minus_g = MISSING;
-
- flight_accel = 0;
- flight_vel = 0;
- flight_pres = 0;
-
- imu = new AltosIMU();
- mag = new AltosMag();
- }
-
- public AltosRecordMM(AltosRecord old) {
- super.copy(old);
- make_missing();
- }
-
- public AltosRecordMM(AltosRecordMM old) {
- copy(old);
- }
-
- public AltosRecordMM() {
- super();
- make_missing();
- }
-}
diff --git a/altoslib/AltosRecordMini.java b/altoslib/AltosRecordMini.java
deleted file mode 100644
index dacd89b8..00000000
--- a/altoslib/AltosRecordMini.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-public class AltosRecordMini extends AltosRecord {
-
- /* Sensor values */
- public int pres;
- public int temp;
-
- public int sense_a;
- public int sense_m;
- public int v_batt;
-
- public int ground_pres;
-
- public int flight_accel;
- public int flight_vel;
- public int flight_height;
-
- public int flight_pres;
-
- static double adc(int raw) {
- return raw / 4095.0;
- }
-
- public double pressure() {
- if (pres != MISSING)
- return pres;
- return MISSING;
- }
-
- public double temperature() {
- if (temp != MISSING)
- return temp;
- return MISSING;
- }
-
- public double ground_pressure() {
- if (ground_pres != MISSING)
- return ground_pres;
- return MISSING;
- }
-
- public double battery_voltage() {
- if (v_batt != MISSING)
- return 3.3 * adc(v_batt) * (15.0 + 27.0) / 27.0;
- return MISSING;
- }
-
- static double pyro(int raw) {
- if (raw != MISSING)
- return 3.3 * adc(raw) * (100.0 + 27.0) / 27.0;
- return MISSING;
- }
-
- public double main_voltage() {
- return pyro(sense_m);
- }
-
- public double apogee_voltage() {
- return pyro(sense_a);
- }
-
- public void copy (AltosRecordMini old) {
- super.copy(old);
-
- pres = old.pres;
- temp = old.temp;
-
- sense_a = old.sense_a;
- sense_m = old.sense_m;
- v_batt = old.v_batt;
-
- ground_pres = old.ground_pres;
-
- flight_accel = old.flight_accel;
- flight_vel = old.flight_vel;
- flight_height = old.flight_height;
- flight_pres = old.flight_pres;
- }
-
-
-
- public AltosRecordMini clone() {
- return new AltosRecordMini(this);
- }
-
- void make_missing() {
-
- pres = MISSING;
-
- sense_a = MISSING;
- sense_m = MISSING;
- v_batt = MISSING;
-
- ground_pres = MISSING;
-
- flight_accel = 0;
- flight_vel = 0;
- flight_height = 0;
- flight_pres = 0;
- }
-
- public AltosRecordMini(AltosRecord old) {
- super.copy(old);
- make_missing();
- }
-
- public AltosRecordMini(AltosRecordMini old) {
- copy(old);
- }
-
- public AltosRecordMini() {
- super();
- make_missing();
- }
-}
diff --git a/altoslib/AltosRecordNone.java b/altoslib/AltosRecordNone.java
deleted file mode 100644
index a95b6a9c..00000000
--- a/altoslib/AltosRecordNone.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-public class AltosRecordNone extends AltosRecord {
-
- public double pressure() { return MISSING; }
- public double ground_pressure() { return MISSING; }
- public double temperature() { return MISSING; }
- public double acceleration() { return MISSING; }
-
- public AltosRecordNone(AltosRecord old) {
- super.copy(old);
- }
-
- public AltosRecordNone clone() {
- return new AltosRecordNone(this);
- }
-
- public AltosRecordNone() {
- super();
- }
-}
diff --git a/altoslib/AltosRecordTM.java b/altoslib/AltosRecordTM.java
deleted file mode 100644
index c6cf3646..00000000
--- a/altoslib/AltosRecordTM.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_1;
-
-public class AltosRecordTM extends AltosRecord {
-
- /* Sensor values */
- public int accel;
- public int pres;
- public int temp;
- public int batt;
- public int drogue;
- public int main;
-
- public int ground_accel;
- public int ground_pres;
- public int accel_plus_g;
- public int accel_minus_g;
-
- public int flight_accel;
- public int flight_vel;
- public int flight_pres;
-
- /*
- * Values for our MP3H6115A pressure sensor
- *
- * From the data sheet:
- *
- * Pressure range: 15-115 kPa
- * Voltage at 115kPa: 2.82
- * Output scale: 27mV/kPa
- *
- *
- * 27 mV/kPa * 2047 / 3300 counts/mV = 16.75 counts/kPa
- * 2.82V * 2047 / 3.3 counts/V = 1749 counts/115 kPa
- */
-
- static final double counts_per_kPa = 27 * 2047 / 3300;
- static final double counts_at_101_3kPa = 1674.0;
-
- static double
- barometer_to_pressure(double count)
- {
- return ((count / 16.0) / 2047.0 + 0.095) / 0.009 * 1000.0;
- }
-
- public double pressure() {
- if (pres == MISSING)
- return MISSING;
- return barometer_to_pressure(pres);
- }
-
- public double ground_pressure() {
- if (ground_pres == MISSING)
- return MISSING;
- return barometer_to_pressure(ground_pres);
- }
-
- public double battery_voltage() {
- if (batt == MISSING)
- return MISSING;
- return AltosConvert.cc_battery_to_voltage(batt);
- }
-
- public double main_voltage() {
- if (main == MISSING)
- return MISSING;
- return AltosConvert.cc_ignitor_to_voltage(main);
- }
-
- public double drogue_voltage() {
- if (drogue == MISSING)
- return MISSING;
- return AltosConvert.cc_ignitor_to_voltage(drogue);
- }
-
- /* Value for the CC1111 built-in temperature sensor
- * Output voltage at 0°C = 0.755V
- * Coefficient = 0.00247V/°C
- * Reference voltage = 1.25V
- *
- * temp = ((value / 32767) * 1.25 - 0.755) / 0.00247
- * = (value - 19791.268) / 32768 * 1.25 / 0.00247
- */
-
- static double
- thermometer_to_temperature(double thermo)
- {
- return (thermo - 19791.268) / 32728.0 * 1.25 / 0.00247;
- }
-
- public double temperature() {
- if (temp == MISSING)
- return MISSING;
- return thermometer_to_temperature(temp);
- }
-
- double accel_counts_per_mss() {
- double counts_per_g = Math.abs(accel_minus_g - accel_plus_g) / 2;
-
- return counts_per_g / 9.80665;
- }
-
- public double acceleration() {
- if (ground_accel == MISSING || accel == MISSING)
- return MISSING;
- return (ground_accel - accel) / accel_counts_per_mss();
- }
-
- public void copy(AltosRecordTM old) {
- super.copy(old);
-
- version = old.version;
- callsign = old.callsign;
- serial = old.serial;
- flight = old.flight;
- rssi = old.rssi;
- status = old.status;
- state = old.state;
- tick = old.tick;
- accel = old.accel;
- pres = old.pres;
- temp = old.temp;
- batt = old.batt;
- drogue = old.drogue;
- main = old.main;
- flight_accel = old.flight_accel;
- ground_accel = old.ground_accel;
- flight_vel = old.flight_vel;
- flight_pres = old.flight_pres;
- ground_pres = old.ground_pres;
- accel_plus_g = old.accel_plus_g;
- accel_minus_g = old.accel_minus_g;
- }
-
- public AltosRecordTM clone() {
- return new AltosRecordTM(this);
- }
-
- void make_missing() {
- accel = MISSING;
- pres = MISSING;
- temp = MISSING;
- batt = MISSING;
- drogue = MISSING;
- main = MISSING;
-
- flight_accel = MISSING;
- flight_vel = MISSING;
- flight_pres = MISSING;
-
- ground_accel = MISSING;
- ground_pres = MISSING;
- accel_plus_g = MISSING;
- accel_minus_g = MISSING;
- }
-
- public AltosRecordTM(AltosRecord old) {
- super.copy(old);
- make_missing();
- }
-
- public AltosRecordTM(AltosRecordTM old) {
- copy(old);
- }
-
- public AltosRecordTM() {
- super();
- make_missing();
- }
-}
diff --git a/altoslib/AltosRecordTM2.java b/altoslib/AltosRecordTM2.java
index 0cd54f2c..da2d948c 100644
--- a/altoslib/AltosRecordTM2.java
+++ b/altoslib/AltosRecordTM2.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosRecordTM2 extends AltosRecord {
diff --git a/altoslib/AltosReplayReader.java b/altoslib/AltosReplayReader.java
index 0c14dee4..f65caaa0 100644
--- a/altoslib/AltosReplayReader.java
+++ b/altoslib/AltosReplayReader.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosRomconfig.java b/altoslib/AltosRomconfig.java
index 0800a2c4..e9d3147e 100644
--- a/altoslib/AltosRomconfig.java
+++ b/altoslib/AltosRomconfig.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
diff --git a/altoslib/AltosSelfFlash.java b/altoslib/AltosSelfFlash.java
index 07917d5d..0ae797a0 100644
--- a/altoslib/AltosSelfFlash.java
+++ b/altoslib/AltosSelfFlash.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
diff --git a/altoslib/AltosSensorEMini.java b/altoslib/AltosSensorEMini.java
new file mode 100644
index 00000000..cbc65143
--- /dev/null
+++ b/altoslib/AltosSensorEMini.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altoslib_2;
+
+import java.util.concurrent.TimeoutException;
+
+public class AltosSensorEMini {
+ public int tick;
+ public int apogee;
+ public int main;
+ public int batt;
+
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosSensorEMini sensor_emini = new AltosSensorEMini(link);
+
+ if (sensor_emini == null)
+ return;
+ state.set_battery_voltage(AltosConvert.easy_mini_voltage(sensor_emini.batt));
+ state.set_apogee_voltage(AltosConvert.easy_mini_voltage(sensor_emini.apogee));
+ state.set_main_voltage(AltosConvert.easy_mini_voltage(sensor_emini.main));
+
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ public AltosSensorEMini(AltosLink link) throws InterruptedException, TimeoutException {
+ String[] items = link.adc();
+ for (int i = 0; i < items.length;) {
+ if (items[i].equals("tick:")) {
+ tick = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("apogee:")) {
+ apogee = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("main:")) {
+ main = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("batt:")) {
+ batt = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ i++;
+ }
+ }
+}
+
diff --git a/altoslib/AltosSensorMM.java b/altoslib/AltosSensorMM.java
index 6d1b61c0..0ef42cf6 100644
--- a/altoslib/AltosSensorMM.java
+++ b/altoslib/AltosSensorMM.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.util.concurrent.TimeoutException;
diff --git a/altoslib/AltosSensorMega.java b/altoslib/AltosSensorMega.java
new file mode 100644
index 00000000..3afb8a64
--- /dev/null
+++ b/altoslib/AltosSensorMega.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright © 2013 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altoslib_2;
+
+import java.util.concurrent.TimeoutException;
+
+class AltosSensorMega {
+ int tick;
+ int[] sense;
+ int v_batt;
+ int v_pbatt;
+ int temp;
+
+ public AltosSensorMega() {
+ sense = new int[6];
+ }
+
+ public AltosSensorMega(AltosLink link) throws InterruptedException, TimeoutException {
+ this();
+ String[] items = link.adc();
+ for (int i = 0; i < items.length;) {
+ if (items[i].equals("tick:")) {
+ tick = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("A:")) {
+ sense[0] = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("B:")) {
+ sense[1] = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("C:")) {
+ sense[2] = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("D:")) {
+ sense[3] = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("drogue:")) {
+ sense[4] = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("main:")) {
+ sense[5] = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("batt:")) {
+ v_batt = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("pbatt:")) {
+ v_pbatt = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("temp:")) {
+ temp = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ i++;
+ }
+ }
+
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosSensorMega sensor_mega = new AltosSensorMega(link);
+
+ state.set_battery_voltage(AltosConvert.mega_battery_voltage(sensor_mega.v_batt));
+ state.set_apogee_voltage(AltosConvert.mega_pyro_voltage(sensor_mega.sense[4]));
+ state.set_main_voltage(AltosConvert.mega_pyro_voltage(sensor_mega.sense[5]));
+
+ double[] ignitor_voltage = new double[4];
+ for (int i = 0; i < 4; i++)
+ ignitor_voltage[i] = AltosConvert.mega_pyro_voltage(sensor_mega.sense[i]);
+ state.set_ignitor_voltage(ignitor_voltage);
+
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
+}
+
diff --git a/altoslib/AltosSensorMetrum.java b/altoslib/AltosSensorMetrum.java
index 686c78a8..4a51d492 100644
--- a/altoslib/AltosSensorMetrum.java
+++ b/altoslib/AltosSensorMetrum.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.util.concurrent.TimeoutException;
@@ -51,5 +51,16 @@ class AltosSensorMetrum {
i++;
}
}
+
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosSensorMetrum sensor_metrum = new AltosSensorMetrum(link);
+ state.set_battery_voltage(AltosConvert.mega_battery_voltage(sensor_metrum.v_batt));
+ state.set_apogee_voltage(AltosConvert.mega_pyro_voltage(sensor_metrum.sense_a));
+ state.set_main_voltage(AltosConvert.mega_pyro_voltage(sensor_metrum.sense_m));
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
}
diff --git a/altoslib/AltosSensorTM.java b/altoslib/AltosSensorTM.java
index 754dc5bb..2696a308 100644
--- a/altoslib/AltosSensorTM.java
+++ b/altoslib/AltosSensorTM.java
@@ -15,14 +15,38 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.util.concurrent.TimeoutException;
-class AltosSensorTM extends AltosRecordTM {
+public class AltosSensorTM {
+ public int tick;
+ public int accel;
+ public int pres;
+ public int temp;
+ public int batt;
+ public int drogue;
+ public int main;
- public AltosSensorTM(AltosLink link, AltosConfigData config_data) throws InterruptedException, TimeoutException {
- super();
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosSensorTM sensor_tm = new AltosSensorTM(link);
+
+ if (sensor_tm == null)
+ return;
+ state.set_accel(sensor_tm.accel);
+ state.set_pressure(AltosConvert.barometer_to_pressure(sensor_tm.pres));
+ state.set_temperature(AltosConvert.thermometer_to_temperature(sensor_tm.temp));
+ state.set_battery_voltage(AltosConvert.cc_battery_to_voltage(sensor_tm.batt));
+ state.set_apogee_voltage(AltosConvert.cc_ignitor_to_voltage(sensor_tm.drogue));
+ state.set_main_voltage(AltosConvert.cc_ignitor_to_voltage(sensor_tm.main));
+
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ public AltosSensorTM(AltosLink link) throws InterruptedException, TimeoutException {
String[] items = link.adc();
for (int i = 0; i < items.length;) {
if (items[i].equals("tick:")) {
@@ -62,10 +86,6 @@ class AltosSensorTM extends AltosRecordTM {
}
i++;
}
- ground_accel = config_data.accel_cal_plus;
- ground_pres = pres;
- accel_plus_g = config_data.accel_cal_plus;
- accel_minus_g = config_data.accel_cal_minus;
}
}
diff --git a/altoslib/AltosSpeed.java b/altoslib/AltosSpeed.java
index 6fb624fb..9b9f7240 100644
--- a/altoslib/AltosSpeed.java
+++ b/altoslib/AltosSpeed.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosSpeed extends AltosUnits {
diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java
index 1c400bab..dba9bff8 100644
--- a/altoslib/AltosState.java
+++ b/altoslib/AltosState.java
@@ -19,10 +19,9 @@
* Track flight state from telemetry or eeprom data stream
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosState implements Cloneable {
- public AltosRecord record;
public static final int set_position = 1;
public static final int set_gps = 2;
@@ -53,9 +52,9 @@ public class AltosState implements Cloneable {
private double max_rate = 1000.0;
void set(double new_value, double time) {
- if (new_value != AltosRecord.MISSING) {
+ if (new_value != AltosLib.MISSING) {
value = new_value;
- if (max_value == AltosRecord.MISSING || value > max_value) {
+ if (max_value == AltosLib.MISSING || value > max_value) {
max_value = value;
}
set_time = time;
@@ -63,7 +62,7 @@ public class AltosState implements Cloneable {
}
void set_filtered(double new_value, double time) {
- if (prev_value != AltosRecord.MISSING)
+ if (prev_value != AltosLib.MISSING)
new_value = (prev_value * 15.0 + new_value) / 16.0;
set(new_value, time);
}
@@ -81,25 +80,25 @@ public class AltosState implements Cloneable {
}
double change() {
- if (value != AltosRecord.MISSING && prev_value != AltosRecord.MISSING)
+ if (value != AltosLib.MISSING && prev_value != AltosLib.MISSING)
return value - prev_value;
- return AltosRecord.MISSING;
+ return AltosLib.MISSING;
}
double rate() {
double c = change();
double t = set_time - prev_set_time;
- if (c != AltosRecord.MISSING && t != 0)
+ if (c != AltosLib.MISSING && t != 0)
return c / t;
- return AltosRecord.MISSING;
+ return AltosLib.MISSING;
}
double integrate() {
- if (value == AltosRecord.MISSING)
- return AltosRecord.MISSING;
- if (prev_value == AltosRecord.MISSING)
- return AltosRecord.MISSING;
+ if (value == AltosLib.MISSING)
+ return AltosLib.MISSING;
+ if (prev_value == AltosLib.MISSING)
+ return AltosLib.MISSING;
return (value + prev_value) / 2 * (set_time - prev_set_time);
}
@@ -111,13 +110,13 @@ public class AltosState implements Cloneable {
void set_derivative(AltosValue in) {
double n = in.rate();
- if (n == AltosRecord.MISSING)
+ if (n == AltosLib.MISSING)
return;
double p = prev_value;
double pt = prev_set_time;
- if (p == AltosRecord.MISSING) {
+ if (p == AltosLib.MISSING) {
p = 0;
pt = in.time() - 0.01;
}
@@ -150,9 +149,9 @@ public class AltosState implements Cloneable {
void set_integral(AltosValue in) {
double change = in.integrate();
- if (change != AltosRecord.MISSING) {
+ if (change != AltosLib.MISSING) {
double prev = prev_value;
- if (prev == AltosRecord.MISSING)
+ if (prev == AltosLib.MISSING)
prev = 0;
set(prev + change, in.time());
}
@@ -166,10 +165,15 @@ public class AltosState implements Cloneable {
max_value = old.max_value;
}
+ void finish_update() {
+ prev_value = value;
+ prev_set_time = set_time;
+ }
+
AltosValue() {
- value = AltosRecord.MISSING;
- prev_value = AltosRecord.MISSING;
- max_value = AltosRecord.MISSING;
+ value = AltosLib.MISSING;
+ prev_value = AltosLib.MISSING;
+ max_value = AltosLib.MISSING;
}
}
@@ -179,45 +183,45 @@ public class AltosState implements Cloneable {
double value() {
double v = measured.value();
- if (v != AltosRecord.MISSING)
+ if (v != AltosLib.MISSING)
return v;
return computed.value();
}
boolean is_measured() {
- return measured.value() != AltosRecord.MISSING;
+ return measured.value() != AltosLib.MISSING;
}
double max() {
double m = measured.max();
- if (m != AltosRecord.MISSING)
+ if (m != AltosLib.MISSING)
return m;
return computed.max();
}
double prev_value() {
- if (measured.value != AltosRecord.MISSING && measured.prev_value != AltosRecord.MISSING)
+ if (measured.value != AltosLib.MISSING && measured.prev_value != AltosLib.MISSING)
return measured.prev_value;
return computed.prev_value;
}
AltosValue altos_value() {
- if (measured.value() != AltosRecord.MISSING)
+ if (measured.value() != AltosLib.MISSING)
return measured;
return computed;
}
double change() {
double c = measured.change();
- if (c == AltosRecord.MISSING)
+ if (c == AltosLib.MISSING)
c = computed.change();
return c;
}
double rate() {
double r = measured.rate();
- if (r == AltosRecord.MISSING)
+ if (r == AltosLib.MISSING)
r = computed.rate();
return r;
}
@@ -251,6 +255,11 @@ public class AltosState implements Cloneable {
computed.copy(old.computed);
}
+ void finish_update() {
+ measured.finish_update();
+ computed.finish_update();
+ }
+
AltosCValue() {
measured = new AltosValue();
computed = new AltosValue();
@@ -273,8 +282,8 @@ public class AltosState implements Cloneable {
public int flight_log_max;
private double pressure_to_altitude(double p) {
- if (p == AltosRecord.MISSING)
- return AltosRecord.MISSING;
+ if (p == AltosLib.MISSING)
+ return AltosLib.MISSING;
return AltosConvert.pressure_to_altitude(p);
}
@@ -334,18 +343,18 @@ public class AltosState implements Cloneable {
public double altitude() {
double a = altitude.value();
- if (a != AltosRecord.MISSING)
+ if (a != AltosLib.MISSING)
return a;
if (gps != null)
return gps.alt;
- return AltosRecord.MISSING;
+ return AltosLib.MISSING;
}
public double max_altitude() {
double a = altitude.max();
- if (a != AltosRecord.MISSING)
+ if (a != AltosLib.MISSING)
return a;
- return AltosRecord.MISSING;
+ return AltosLib.MISSING;
}
public void set_altitude(double new_altitude) {
@@ -374,26 +383,26 @@ public class AltosState implements Cloneable {
public double height() {
double k = kalman_height.value();
- if (k != AltosRecord.MISSING)
+ if (k != AltosLib.MISSING)
return k;
double a = altitude();
double g = ground_altitude();
- if (a != AltosRecord.MISSING && g != AltosRecord.MISSING)
+ if (a != AltosLib.MISSING && g != AltosLib.MISSING)
return a - g;
- return AltosRecord.MISSING;
+ return AltosLib.MISSING;
}
public double max_height() {
double k = kalman_height.max();
- if (k != AltosRecord.MISSING)
+ if (k != AltosLib.MISSING)
return k;
double a = altitude.max();
double g = ground_altitude();
- if (a != AltosRecord.MISSING && g != AltosRecord.MISSING)
+ if (a != AltosLib.MISSING && g != AltosLib.MISSING)
return a - g;
- return AltosRecord.MISSING;
+ return AltosLib.MISSING;
}
class AltosSpeed extends AltosCValue {
@@ -421,10 +430,16 @@ public class AltosState implements Cloneable {
private AltosSpeed speed;
public double speed() {
+ double v = kalman_speed.value();
+ if (v != AltosLib.MISSING)
+ return v;
return speed.value();
}
public double max_speed() {
+ double v = kalman_speed.max();
+ if (v != AltosLib.MISSING)
+ return v;
return speed.max();
}
@@ -503,7 +518,7 @@ public class AltosState implements Cloneable {
public AltosMs5607 baro;
- public AltosRecordCompanion companion;
+ public AltosCompanion companion;
public void set_npad(int npad) {
this.npad = npad;
@@ -514,29 +529,27 @@ public class AltosState implements Cloneable {
}
public void init() {
- record = null;
-
set = 0;
received_time = System.currentTimeMillis();
- time = AltosRecord.MISSING;
- time_change = AltosRecord.MISSING;
- prev_time = AltosRecord.MISSING;
- tick = AltosRecord.MISSING;
- prev_tick = AltosRecord.MISSING;
- boost_tick = AltosRecord.MISSING;
+ time = AltosLib.MISSING;
+ time_change = AltosLib.MISSING;
+ prev_time = AltosLib.MISSING;
+ tick = AltosLib.MISSING;
+ prev_tick = AltosLib.MISSING;
+ boost_tick = AltosLib.MISSING;
state = AltosLib.ao_flight_invalid;
- flight = AltosRecord.MISSING;
+ flight = AltosLib.MISSING;
landed = false;
boost = false;
- rssi = AltosRecord.MISSING;
+ rssi = AltosLib.MISSING;
status = 0;
- device_type = AltosRecord.MISSING;
- config_major = AltosRecord.MISSING;
- config_minor = AltosRecord.MISSING;
- apogee_delay = AltosRecord.MISSING;
- main_deploy = AltosRecord.MISSING;
- flight_log_max = AltosRecord.MISSING;
+ device_type = AltosLib.MISSING;
+ config_major = AltosLib.MISSING;
+ config_minor = AltosLib.MISSING;
+ apogee_delay = AltosLib.MISSING;
+ main_deploy = AltosLib.MISSING;
+ flight_log_max = AltosLib.MISSING;
ground_altitude = new AltosCValue();
ground_pressure = new AltosGroundPressure();
@@ -545,11 +558,11 @@ public class AltosState implements Cloneable {
speed = new AltosSpeed();
acceleration = new AltosAccel();
- temperature = AltosRecord.MISSING;
- battery_voltage = AltosRecord.MISSING;
- pyro_voltage = AltosRecord.MISSING;
- apogee_voltage = AltosRecord.MISSING;
- main_voltage = AltosRecord.MISSING;
+ temperature = AltosLib.MISSING;
+ battery_voltage = AltosLib.MISSING;
+ pyro_voltage = AltosLib.MISSING;
+ apogee_voltage = AltosLib.MISSING;
+ main_voltage = AltosLib.MISSING;
ignitor_voltage = null;
kalman_height = new AltosValue();
@@ -569,36 +582,48 @@ public class AltosState implements Cloneable {
ngps = 0;
from_pad = null;
- elevation = AltosRecord.MISSING;
- range = AltosRecord.MISSING;
- gps_height = AltosRecord.MISSING;
+ elevation = AltosLib.MISSING;
+ range = AltosLib.MISSING;
+ gps_height = AltosLib.MISSING;
- pad_lat = AltosRecord.MISSING;
- pad_lon = AltosRecord.MISSING;
- pad_alt = AltosRecord.MISSING;
+ pad_lat = AltosLib.MISSING;
+ pad_lon = AltosLib.MISSING;
+ pad_alt = AltosLib.MISSING;
- speak_tick = AltosRecord.MISSING;
- speak_altitude = AltosRecord.MISSING;
+ speak_tick = AltosLib.MISSING;
+ speak_altitude = AltosLib.MISSING;
callsign = null;
- accel_plus_g = AltosRecord.MISSING;
- accel_minus_g = AltosRecord.MISSING;
- accel = AltosRecord.MISSING;
+ accel_plus_g = AltosLib.MISSING;
+ accel_minus_g = AltosLib.MISSING;
+ accel = AltosLib.MISSING;
- ground_accel = AltosRecord.MISSING;
- ground_accel_avg = AltosRecord.MISSING;
+ ground_accel = AltosLib.MISSING;
+ ground_accel_avg = AltosLib.MISSING;
- log_format = AltosRecord.MISSING;
- serial = AltosRecord.MISSING;
+ log_format = AltosLib.MISSING;
+ serial = AltosLib.MISSING;
baro = null;
companion = null;
}
- void copy(AltosState old) {
+ void finish_update() {
+ prev_tick = tick;
- record = null;
+ ground_altitude.finish_update();
+ altitude.finish_update();
+ pressure.finish_update();
+ speed.finish_update();
+ acceleration.finish_update();
+
+ kalman_height.finish_update();
+ kalman_speed.finish_update();
+ kalman_acceleration.finish_update();
+ }
+
+ void copy(AltosState old) {
if (old == null) {
init();
@@ -718,25 +743,25 @@ public class AltosState implements Cloneable {
/* Track consecutive 'good' gps reports, waiting for 10 of them */
if (state == AltosLib.ao_flight_pad) {
set_npad(npad+1);
- if (pad_lat != AltosRecord.MISSING) {
+ if (pad_lat != AltosLib.MISSING) {
pad_lat = (pad_lat * 31 + gps.lat) / 32;
pad_lon = (pad_lon * 31 + gps.lon) / 32;
pad_alt = (pad_alt * 31 + gps.alt) / 32;
}
}
- if (pad_lat == AltosRecord.MISSING) {
+ if (pad_lat == AltosLib.MISSING) {
pad_lat = gps.lat;
pad_lon = gps.lon;
pad_alt = gps.alt;
}
}
if (gps.lat != 0 && gps.lon != 0 &&
- pad_lat != AltosRecord.MISSING &&
- pad_lon != AltosRecord.MISSING)
+ pad_lat != AltosLib.MISSING &&
+ pad_lon != AltosLib.MISSING)
{
double h = height();
- if (h == AltosRecord.MISSING)
+ if (h == AltosLib.MISSING)
h = 0;
from_pad = new AltosGreatCircle(pad_lat, pad_lon, 0, gps.lat, gps.lon, h);
elevation = from_pad.elevation;
@@ -746,9 +771,9 @@ public class AltosState implements Cloneable {
}
public void set_tick(int new_tick) {
- if (new_tick != AltosRecord.MISSING) {
- if (prev_tick != AltosRecord.MISSING) {
- while (new_tick < prev_tick - 32767) {
+ if (new_tick != AltosLib.MISSING) {
+ if (prev_tick != AltosLib.MISSING) {
+ while (new_tick < prev_tick - 1000) {
new_tick += 65536;
}
}
@@ -758,7 +783,7 @@ public class AltosState implements Cloneable {
}
public void set_boost_tick(int boost_tick) {
- if (boost_tick != AltosRecord.MISSING)
+ if (boost_tick != AltosLib.MISSING)
this.boost_tick = boost_tick;
}
@@ -799,8 +824,8 @@ public class AltosState implements Cloneable {
public void set_flight(int flight) {
/* When the flight changes, reset the state */
- if (flight != AltosRecord.MISSING) {
- if (this.flight != AltosRecord.MISSING &&
+ if (flight != AltosLib.MISSING && flight != 0) {
+ if (this.flight != AltosLib.MISSING &&
this.flight != flight) {
init();
}
@@ -810,8 +835,8 @@ public class AltosState implements Cloneable {
public void set_serial(int serial) {
/* When the serial changes, reset the state */
- if (serial != AltosRecord.MISSING) {
- if (this.serial != AltosRecord.MISSING &&
+ if (serial != AltosLib.MISSING) {
+ if (this.serial != AltosLib.MISSING &&
this.serial != serial) {
init();
}
@@ -820,13 +845,13 @@ public class AltosState implements Cloneable {
}
public int rssi() {
- if (rssi == AltosRecord.MISSING)
+ if (rssi == AltosLib.MISSING)
return 0;
return rssi;
}
public void set_rssi(int rssi, int status) {
- if (rssi != AltosRecord.MISSING) {
+ if (rssi != AltosLib.MISSING) {
this.rssi = rssi;
this.status = status;
}
@@ -845,9 +870,29 @@ public class AltosState implements Cloneable {
}
}
- public void make_baro() {
+ public void set_imu(AltosIMU imu) {
+ if (imu != null)
+ imu = imu.clone();
+ this.imu = imu;
+ }
+
+ public void set_mag(AltosMag mag) {
+ this.mag = mag.clone();
+ }
+
+ public AltosMs5607 make_baro() {
if (baro == null)
baro = new AltosMs5607();
+ return baro;
+ }
+
+ public void set_ms5607(AltosMs5607 ms5607) {
+ baro = ms5607;
+
+ if (baro != null) {
+ set_pressure(baro.pa);
+ set_temperature(baro.cc / 100.0);
+ }
}
public void set_ms5607(int pres, int temp) {
@@ -861,25 +906,25 @@ public class AltosState implements Cloneable {
public void make_companion (int nchannels) {
if (companion == null)
- companion = new AltosRecordCompanion(nchannels);
+ companion = new AltosCompanion(nchannels);
}
- public void set_companion(AltosRecordCompanion companion) {
+ public void set_companion(AltosCompanion companion) {
this.companion = companion;
}
void update_accel() {
double ground = ground_accel;
- if (ground == AltosRecord.MISSING)
+ if (ground == AltosLib.MISSING)
ground = ground_accel_avg;
- if (accel == AltosRecord.MISSING)
+ if (accel == AltosLib.MISSING)
return;
- if (ground == AltosRecord.MISSING)
+ if (ground == AltosLib.MISSING)
return;
- if (accel_plus_g == AltosRecord.MISSING)
+ if (accel_plus_g == AltosLib.MISSING)
return;
- if (accel_minus_g == AltosRecord.MISSING)
+ if (accel_minus_g == AltosLib.MISSING)
return;
double counts_per_g = (accel_minus_g - accel_plus_g) / 2.0;
@@ -888,7 +933,7 @@ public class AltosState implements Cloneable {
}
public void set_accel_g(double accel_plus_g, double accel_minus_g) {
- if (accel_plus_g != AltosRecord.MISSING) {
+ if (accel_plus_g != AltosLib.MISSING) {
this.accel_plus_g = accel_plus_g;
this.accel_minus_g = accel_minus_g;
update_accel();
@@ -896,17 +941,17 @@ public class AltosState implements Cloneable {
}
public void set_ground_accel(double ground_accel) {
- if (ground_accel != AltosRecord.MISSING) {
+ if (ground_accel != AltosLib.MISSING) {
this.ground_accel = ground_accel;
update_accel();
}
}
public void set_accel(double accel) {
- if (accel != AltosRecord.MISSING) {
+ if (accel != AltosLib.MISSING) {
this.accel = accel;
if (state == AltosLib.ao_flight_pad) {
- if (ground_accel_avg == AltosRecord.MISSING)
+ if (ground_accel_avg == AltosLib.MISSING)
ground_accel_avg = accel;
else
ground_accel_avg = (ground_accel_avg * 7 + accel) / 8;
@@ -916,35 +961,35 @@ public class AltosState implements Cloneable {
}
public void set_temperature(double temperature) {
- if (temperature != AltosRecord.MISSING) {
+ if (temperature != AltosLib.MISSING) {
this.temperature = temperature;
set |= set_data;
}
}
public void set_battery_voltage(double battery_voltage) {
- if (battery_voltage != AltosRecord.MISSING) {
+ if (battery_voltage != AltosLib.MISSING) {
this.battery_voltage = battery_voltage;
set |= set_data;
}
}
public void set_pyro_voltage(double pyro_voltage) {
- if (pyro_voltage != AltosRecord.MISSING) {
+ if (pyro_voltage != AltosLib.MISSING) {
this.pyro_voltage = pyro_voltage;
set |= set_data;
}
}
public void set_apogee_voltage(double apogee_voltage) {
- if (apogee_voltage != AltosRecord.MISSING) {
+ if (apogee_voltage != AltosLib.MISSING) {
this.apogee_voltage = apogee_voltage;
set |= set_data;
}
}
public void set_main_voltage(double main_voltage) {
- if (main_voltage != AltosRecord.MISSING) {
+ if (main_voltage != AltosLib.MISSING) {
this.main_voltage = main_voltage;
set |= set_data;
}
@@ -955,17 +1000,17 @@ public class AltosState implements Cloneable {
}
public double time_since_boost() {
- if (tick == AltosRecord.MISSING)
+ if (tick == AltosLib.MISSING)
return 0.0;
- if (boost_tick != AltosRecord.MISSING) {
+ if (boost_tick != AltosLib.MISSING) {
return (tick - boost_tick) / 100.0;
}
return tick / 100.0;
}
public boolean valid() {
- return tick != AltosRecord.MISSING && serial != AltosRecord.MISSING;
+ return tick != AltosLib.MISSING && serial != AltosLib.MISSING;
}
public AltosGPS make_temp_gps(boolean sats) {
@@ -993,56 +1038,6 @@ public class AltosState implements Cloneable {
return s;
}
-
- public void init (AltosRecord cur, AltosState prev_state) {
-
- System.out.printf ("init\n");
- if (cur == null)
- cur = new AltosRecord();
-
- record = cur;
-
- /* Discard previous state if it was for a different board */
- if (prev_state != null && prev_state.serial != cur.serial)
- prev_state = null;
-
- copy(prev_state);
-
- set_ground_altitude(cur.ground_altitude());
- set_altitude(cur.altitude());
-
- set_kalman(cur.kalman_height, cur.kalman_speed, cur.kalman_acceleration);
-
- received_time = System.currentTimeMillis();
-
- set_temperature(cur.temperature());
- set_apogee_voltage(cur.drogue_voltage());
- set_main_voltage(cur.main_voltage());
- set_battery_voltage(cur.battery_voltage());
-
- set_pressure(cur.pressure());
-
- set_tick(cur.tick);
- set_state(cur.state);
-
- set_accel_g (cur.accel_minus_g, cur.accel_plus_g);
- set_ground_accel(cur.ground_accel);
- set_accel (cur.accel);
-
- if (cur.gps_sequence != gps_sequence)
- set_gps(cur.gps, cur.gps_sequence);
-
- }
-
- public AltosState(AltosRecord cur) {
- init(cur, null);
- }
-
- public AltosState (AltosRecord cur, AltosState prev) {
- init(cur, prev);
- }
-
-
public AltosState () {
init();
}
diff --git a/altoslib/AltosStateIterable.java b/altoslib/AltosStateIterable.java
index db4a2568..6d637419 100644
--- a/altoslib/AltosStateIterable.java
+++ b/altoslib/AltosStateIterable.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
diff --git a/altoslib/AltosStateUpdate.java b/altoslib/AltosStateUpdate.java
index 50460e21..ec4f7609 100644
--- a/altoslib/AltosStateUpdate.java
+++ b/altoslib/AltosStateUpdate.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public interface AltosStateUpdate {
public void update_state(AltosState state);
diff --git a/altoslib/AltosTelemetry.java b/altoslib/AltosTelemetry.java
index 642e7421..03ca9f80 100644
--- a/altoslib/AltosTelemetry.java
+++ b/altoslib/AltosTelemetry.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
diff --git a/altoslib/AltosTelemetryConfiguration.java b/altoslib/AltosTelemetryConfiguration.java
index 4c9bdd1f..e5d444dd 100644
--- a/altoslib/AltosTelemetryConfiguration.java
+++ b/altoslib/AltosTelemetryConfiguration.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryConfiguration extends AltosTelemetryStandard {
diff --git a/altoslib/AltosTelemetryFile.java b/altoslib/AltosTelemetryFile.java
index 33872688..7566d946 100644
--- a/altoslib/AltosTelemetryFile.java
+++ b/altoslib/AltosTelemetryFile.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
@@ -72,16 +72,14 @@ public class AltosTelemetryFile extends AltosStateIterable {
/* Find boost tick */
AltosState state = start.clone();
- System.out.printf ("Searching for boost\n");
for (AltosTelemetry telem : telems) {
telem.update_state(state);
+ state.finish_update();
if (state.state != AltosLib.ao_flight_invalid && state.state >= AltosLib.ao_flight_boost) {
- System.out.printf ("boost tick %d\n", state.tick);
start.set_boost_tick(state.tick);
break;
}
}
- System.out.printf ("Found boost %d\n", start.boost_tick);
}
public Iterator<AltosState> iterator() {
@@ -91,6 +89,7 @@ public class AltosTelemetryFile extends AltosStateIterable {
while (i.hasNext() && !state.valid()) {
AltosTelemetry t = i.next();
t.update_state(state);
+ state.finish_update();
}
return new AltosTelemetryIterator(state, i);
}
diff --git a/altoslib/AltosTelemetryIterable.java b/altoslib/AltosTelemetryIterable.java
index b7489f77..8075b8a3 100644
--- a/altoslib/AltosTelemetryIterable.java
+++ b/altoslib/AltosTelemetryIterable.java
@@ -15,17 +15,78 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
import java.text.*;
+class AltosTelemetryOrdered implements Comparable<AltosTelemetryOrdered> {
+ AltosTelemetry telem;
+ int index;
+ int tick;
+
+ public int compareTo(AltosTelemetryOrdered o) {
+ int tick_diff = tick - o.tick;
+
+ if (tick_diff != 0)
+ return tick_diff;
+ return index - o.index;
+ }
+
+ AltosTelemetryOrdered (AltosTelemetry telem, int index, int tick) {
+ this.telem = telem;
+ this.index = index;
+ this.tick = tick;
+ }
+}
+
+class AltosTelemetryOrderedIterator implements Iterator<AltosTelemetry> {
+ TreeSet<AltosTelemetryOrdered> olist;
+ Iterator<AltosTelemetryOrdered> oiterator;
+
+ public AltosTelemetryOrderedIterator(Iterable<AltosTelemetry> telems) {
+ olist = new TreeSet<AltosTelemetryOrdered>();
+
+ int tick = 0;
+ int index = 0;
+ boolean first = true;
+
+ for (AltosTelemetry e : telems) {
+ int t = e.tick;
+ if (first)
+ tick = t;
+ else {
+ while (t < tick - 32767)
+ t += 65536;
+ tick = t;
+ }
+ olist.add(new AltosTelemetryOrdered(e, index++, tick));
+ first = false;
+ }
+
+ oiterator = olist.iterator();
+ }
+
+ public boolean hasNext() {
+ return oiterator.hasNext();
+ }
+
+ public AltosTelemetry next() {
+ return oiterator.next().telem;
+ }
+
+ public void remove () {
+ }
+}
+
public class AltosTelemetryIterable implements Iterable<AltosTelemetry> {
LinkedList<AltosTelemetry> telems;
public Iterator<AltosTelemetry> iterator () {
- return telems.iterator();
+ if (telems == null)
+ telems = new LinkedList<AltosTelemetry>();
+ return new AltosTelemetryOrderedIterator(telems);
}
public AltosTelemetryIterable (FileInputStream input) {
diff --git a/altoslib/AltosTelemetryLegacy.java b/altoslib/AltosTelemetryLegacy.java
index 95cbbeed..132b9e80 100644
--- a/altoslib/AltosTelemetryLegacy.java
+++ b/altoslib/AltosTelemetryLegacy.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
@@ -264,34 +264,34 @@ public class AltosTelemetryLegacy extends AltosTelemetry {
AltosTelemetryMap map = new AltosTelemetryMap(words, i);
callsign = map.get_string(AO_TELEM_CALL, "N0CALL");
- serial = map.get_int(AO_TELEM_SERIAL, AltosRecord.MISSING);
- flight = map.get_int(AO_TELEM_FLIGHT, AltosRecord.MISSING);
- rssi = map.get_int(AO_TELEM_RSSI, AltosRecord.MISSING);
+ serial = map.get_int(AO_TELEM_SERIAL, AltosLib.MISSING);
+ flight = map.get_int(AO_TELEM_FLIGHT, AltosLib.MISSING);
+ rssi = map.get_int(AO_TELEM_RSSI, AltosLib.MISSING);
state = AltosLib.state(map.get_string(AO_TELEM_STATE, "invalid"));
tick = map.get_int(AO_TELEM_TICK, 0);
/* raw sensor values */
- accel = map.get_int(AO_TELEM_RAW_ACCEL, AltosRecord.MISSING);
- pres = map.get_int(AO_TELEM_RAW_BARO, AltosRecord.MISSING);
- temp = map.get_int(AO_TELEM_RAW_THERMO, AltosRecord.MISSING);
- batt = map.get_int(AO_TELEM_RAW_BATT, AltosRecord.MISSING);
- apogee = map.get_int(AO_TELEM_RAW_DROGUE, AltosRecord.MISSING);
- main = map.get_int(AO_TELEM_RAW_MAIN, AltosRecord.MISSING);
+ accel = map.get_int(AO_TELEM_RAW_ACCEL, AltosLib.MISSING);
+ pres = map.get_int(AO_TELEM_RAW_BARO, AltosLib.MISSING);
+ temp = map.get_int(AO_TELEM_RAW_THERMO, AltosLib.MISSING);
+ batt = map.get_int(AO_TELEM_RAW_BATT, AltosLib.MISSING);
+ apogee = map.get_int(AO_TELEM_RAW_DROGUE, AltosLib.MISSING);
+ main = map.get_int(AO_TELEM_RAW_MAIN, AltosLib.MISSING);
/* sensor calibration information */
- ground_accel = map.get_int(AO_TELEM_CAL_ACCEL_GROUND, AltosRecord.MISSING);
- ground_pres = map.get_int(AO_TELEM_CAL_BARO_GROUND, AltosRecord.MISSING);
- accel_plus_g = map.get_int(AO_TELEM_CAL_ACCEL_PLUS, AltosRecord.MISSING);
- accel_minus_g = map.get_int(AO_TELEM_CAL_ACCEL_MINUS, AltosRecord.MISSING);
+ ground_accel = map.get_int(AO_TELEM_CAL_ACCEL_GROUND, AltosLib.MISSING);
+ ground_pres = map.get_int(AO_TELEM_CAL_BARO_GROUND, AltosLib.MISSING);
+ accel_plus_g = map.get_int(AO_TELEM_CAL_ACCEL_PLUS, AltosLib.MISSING);
+ accel_minus_g = map.get_int(AO_TELEM_CAL_ACCEL_MINUS, AltosLib.MISSING);
/* flight computer values */
- kalman_acceleration = map.get_double(AO_TELEM_KALMAN_ACCEL, AltosRecord.MISSING, 1/16.0);
- kalman_speed = map.get_double(AO_TELEM_KALMAN_SPEED, AltosRecord.MISSING, 1/16.0);
- kalman_height = map.get_int(AO_TELEM_KALMAN_HEIGHT, AltosRecord.MISSING);
+ kalman_acceleration = map.get_double(AO_TELEM_KALMAN_ACCEL, AltosLib.MISSING, 1/16.0);
+ kalman_speed = map.get_double(AO_TELEM_KALMAN_SPEED, AltosLib.MISSING, 1/16.0);
+ kalman_height = map.get_int(AO_TELEM_KALMAN_HEIGHT, AltosLib.MISSING);
- flight_accel = map.get_int(AO_TELEM_ADHOC_ACCEL, AltosRecord.MISSING);
- flight_vel = map.get_int(AO_TELEM_ADHOC_SPEED, AltosRecord.MISSING);
- flight_pres = map.get_int(AO_TELEM_ADHOC_BARO, AltosRecord.MISSING);
+ flight_accel = map.get_int(AO_TELEM_ADHOC_ACCEL, AltosLib.MISSING);
+ flight_vel = map.get_int(AO_TELEM_ADHOC_SPEED, AltosLib.MISSING);
+ flight_pres = map.get_int(AO_TELEM_ADHOC_BARO, AltosLib.MISSING);
if (map.has(AO_TELEM_GPS_STATE))
gps = new AltosGPS(map);
@@ -363,13 +363,13 @@ public class AltosTelemetryLegacy extends AltosTelemetry {
kalman_speed = ((short) flight_vel) / 16.0;
kalman_acceleration = flight_accel / 16.0;
kalman_height = flight_pres;
- flight_vel = AltosRecord.MISSING;
- flight_pres = AltosRecord.MISSING;
- flight_accel = AltosRecord.MISSING;
+ flight_vel = AltosLib.MISSING;
+ flight_pres = AltosLib.MISSING;
+ flight_accel = AltosLib.MISSING;
} else {
- kalman_speed = AltosRecord.MISSING;
- kalman_acceleration = AltosRecord.MISSING;
- kalman_height = AltosRecord.MISSING;
+ kalman_speed = AltosLib.MISSING;
+ kalman_acceleration = AltosLib.MISSING;
+ kalman_height = AltosLib.MISSING;
}
AltosParse.word(words[i++], "gp:");
@@ -480,16 +480,16 @@ public class AltosTelemetryLegacy extends AltosTelemetry {
kalman_acceleration = int16(5);
kalman_speed = int16(9);
kalman_height = int16(13);
- flight_accel = AltosRecord.MISSING;
- flight_vel = AltosRecord.MISSING;
- flight_pres = AltosRecord.MISSING;
+ flight_accel = AltosLib.MISSING;
+ flight_vel = AltosLib.MISSING;
+ flight_pres = AltosLib.MISSING;
} else {
flight_accel = int16(5);
flight_vel = uint32(9);
flight_pres = int16(13);
- kalman_acceleration = AltosRecord.MISSING;
- kalman_speed = AltosRecord.MISSING;
- kalman_height = AltosRecord.MISSING;
+ kalman_acceleration = AltosLib.MISSING;
+ kalman_speed = AltosLib.MISSING;
+ kalman_height = AltosLib.MISSING;
}
gps = null;
@@ -544,7 +544,7 @@ public class AltosTelemetryLegacy extends AltosTelemetry {
state.set_pressure(AltosConvert.barometer_to_pressure(pres));
state.set_accel_g(accel_plus_g, accel_minus_g);
state.set_accel(accel);
- if (kalman_height != AltosRecord.MISSING)
+ if (kalman_height != AltosLib.MISSING)
state.set_kalman(kalman_height, kalman_speed, kalman_acceleration);
state.set_temperature(AltosConvert.thermometer_to_temperature(temp));
state.set_battery_voltage(AltosConvert.cc_battery_to_voltage(batt));
diff --git a/altoslib/AltosTelemetryLocation.java b/altoslib/AltosTelemetryLocation.java
index 50b9dcfc..6e880914 100644
--- a/altoslib/AltosTelemetryLocation.java
+++ b/altoslib/AltosTelemetryLocation.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryLocation extends AltosTelemetryStandard {
diff --git a/altoslib/AltosTelemetryMap.java b/altoslib/AltosTelemetryMap.java
index 7cca98b0..37883a1c 100644
--- a/altoslib/AltosTelemetryMap.java
+++ b/altoslib/AltosTelemetryMap.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
import java.util.HashMap;
diff --git a/altoslib/AltosTelemetryMegaData.java b/altoslib/AltosTelemetryMegaData.java
index 5e6cd580..f5cc01d0 100644
--- a/altoslib/AltosTelemetryMegaData.java
+++ b/altoslib/AltosTelemetryMegaData.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryMegaData extends AltosTelemetryStandard {
int state;
diff --git a/altoslib/AltosTelemetryMegaSensor.java b/altoslib/AltosTelemetryMegaSensor.java
index 7c385cfd..23b67af8 100644
--- a/altoslib/AltosTelemetryMegaSensor.java
+++ b/altoslib/AltosTelemetryMegaSensor.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {
int accel;
diff --git a/altoslib/AltosTelemetryMetrumData.java b/altoslib/AltosTelemetryMetrumData.java
index d419ab80..b6239971 100644
--- a/altoslib/AltosTelemetryMetrumData.java
+++ b/altoslib/AltosTelemetryMetrumData.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryMetrumData extends AltosTelemetryStandard {
diff --git a/altoslib/AltosTelemetryMetrumSensor.java b/altoslib/AltosTelemetryMetrumSensor.java
index 59d34dba..72d2f564 100644
--- a/altoslib/AltosTelemetryMetrumSensor.java
+++ b/altoslib/AltosTelemetryMetrumSensor.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard {
diff --git a/altoslib/AltosTelemetryRaw.java b/altoslib/AltosTelemetryRaw.java
index 9ef7787e..dbe70fe9 100644
--- a/altoslib/AltosTelemetryRaw.java
+++ b/altoslib/AltosTelemetryRaw.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRaw extends AltosTelemetryStandard {
public AltosTelemetryRaw(int[] bytes) {
diff --git a/altoslib/AltosTelemetryReader.java b/altoslib/AltosTelemetryReader.java
index b1cc009c..dfbad5fb 100644
--- a/altoslib/AltosTelemetryReader.java
+++ b/altoslib/AltosTelemetryReader.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
import java.io.*;
@@ -24,7 +24,6 @@ import java.util.concurrent.*;
public class AltosTelemetryReader extends AltosFlightReader {
AltosLink link;
AltosLog log;
- AltosRecord previous;
double frequency;
int telemetry;
AltosState state = null;
@@ -49,7 +48,6 @@ public class AltosTelemetryReader extends AltosFlightReader {
}
public void reset() {
- previous = null;
flush();
}
@@ -126,7 +124,6 @@ public class AltosTelemetryReader extends AltosFlightReader {
try {
log = new AltosLog(link);
name = link.name;
- previous = null;
telem = new LinkedBlockingQueue<AltosLine>();
frequency = AltosPreferences.frequency(link.serial);
set_frequency(frequency);
diff --git a/altoslib/AltosTelemetryRecord.java b/altoslib/AltosTelemetryRecord.java
index a744e61a..a46c1a33 100644
--- a/altoslib/AltosTelemetryRecord.java
+++ b/altoslib/AltosTelemetryRecord.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
public abstract class AltosTelemetryRecord {
diff --git a/altoslib/AltosTelemetryRecordCompanion.java b/altoslib/AltosTelemetryRecordCompanion.java
index 2231df13..9c38ba0a 100644
--- a/altoslib/AltosTelemetryRecordCompanion.java
+++ b/altoslib/AltosTelemetryRecordCompanion.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordCompanion extends AltosTelemetryRecordRaw {
diff --git a/altoslib/AltosTelemetryRecordConfiguration.java b/altoslib/AltosTelemetryRecordConfiguration.java
index 47fc3488..48474fa5 100644
--- a/altoslib/AltosTelemetryRecordConfiguration.java
+++ b/altoslib/AltosTelemetryRecordConfiguration.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordConfiguration extends AltosTelemetryRecordRaw {
diff --git a/altoslib/AltosTelemetryRecordGeneral.java b/altoslib/AltosTelemetryRecordGeneral.java
index 08cd6065..258678c7 100644
--- a/altoslib/AltosTelemetryRecordGeneral.java
+++ b/altoslib/AltosTelemetryRecordGeneral.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
diff --git a/altoslib/AltosTelemetryRecordLegacy.java b/altoslib/AltosTelemetryRecordLegacy.java
index f2d3f868..5f86d671 100644
--- a/altoslib/AltosTelemetryRecordLegacy.java
+++ b/altoslib/AltosTelemetryRecordLegacy.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.text.*;
@@ -236,34 +236,34 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord {
AltosTelemetryMap map = new AltosTelemetryMap(words, i);
record.callsign = map.get_string(AO_TELEM_CALL, "N0CALL");
- record.serial = map.get_int(AO_TELEM_SERIAL, AltosRecord.MISSING);
- record.flight = map.get_int(AO_TELEM_FLIGHT, AltosRecord.MISSING);
- record.rssi = map.get_int(AO_TELEM_RSSI, AltosRecord.MISSING);
+ record.serial = map.get_int(AO_TELEM_SERIAL, AltosLib.MISSING);
+ record.flight = map.get_int(AO_TELEM_FLIGHT, AltosLib.MISSING);
+ record.rssi = map.get_int(AO_TELEM_RSSI, AltosLib.MISSING);
record.state = AltosLib.state(map.get_string(AO_TELEM_STATE, "invalid"));
record.tick = map.get_int(AO_TELEM_TICK, 0);
/* raw sensor values */
- record.accel = map.get_int(AO_TELEM_RAW_ACCEL, AltosRecord.MISSING);
- record.pres = map.get_int(AO_TELEM_RAW_BARO, AltosRecord.MISSING);
- record.temp = map.get_int(AO_TELEM_RAW_THERMO, AltosRecord.MISSING);
- record.batt = map.get_int(AO_TELEM_RAW_BATT, AltosRecord.MISSING);
- record.drogue = map.get_int(AO_TELEM_RAW_DROGUE, AltosRecord.MISSING);
- record.main = map.get_int(AO_TELEM_RAW_MAIN, AltosRecord.MISSING);
+ record.accel = map.get_int(AO_TELEM_RAW_ACCEL, AltosLib.MISSING);
+ record.pres = map.get_int(AO_TELEM_RAW_BARO, AltosLib.MISSING);
+ record.temp = map.get_int(AO_TELEM_RAW_THERMO, AltosLib.MISSING);
+ record.batt = map.get_int(AO_TELEM_RAW_BATT, AltosLib.MISSING);
+ record.drogue = map.get_int(AO_TELEM_RAW_DROGUE, AltosLib.MISSING);
+ record.main = map.get_int(AO_TELEM_RAW_MAIN, AltosLib.MISSING);
/* sensor calibration information */
- record.ground_accel = map.get_int(AO_TELEM_CAL_ACCEL_GROUND, AltosRecord.MISSING);
- record.ground_pres = map.get_int(AO_TELEM_CAL_BARO_GROUND, AltosRecord.MISSING);
- record.accel_plus_g = map.get_int(AO_TELEM_CAL_ACCEL_PLUS, AltosRecord.MISSING);
- record.accel_minus_g = map.get_int(AO_TELEM_CAL_ACCEL_MINUS, AltosRecord.MISSING);
+ record.ground_accel = map.get_int(AO_TELEM_CAL_ACCEL_GROUND, AltosLib.MISSING);
+ record.ground_pres = map.get_int(AO_TELEM_CAL_BARO_GROUND, AltosLib.MISSING);
+ record.accel_plus_g = map.get_int(AO_TELEM_CAL_ACCEL_PLUS, AltosLib.MISSING);
+ record.accel_minus_g = map.get_int(AO_TELEM_CAL_ACCEL_MINUS, AltosLib.MISSING);
/* flight computer values */
- record.kalman_acceleration = map.get_double(AO_TELEM_KALMAN_ACCEL, AltosRecord.MISSING, 1/16.0);
- record.kalman_speed = map.get_double(AO_TELEM_KALMAN_SPEED, AltosRecord.MISSING, 1/16.0);
- record.kalman_height = map.get_int(AO_TELEM_KALMAN_HEIGHT, AltosRecord.MISSING);
+ record.kalman_acceleration = map.get_double(AO_TELEM_KALMAN_ACCEL, AltosLib.MISSING, 1/16.0);
+ record.kalman_speed = map.get_double(AO_TELEM_KALMAN_SPEED, AltosLib.MISSING, 1/16.0);
+ record.kalman_height = map.get_int(AO_TELEM_KALMAN_HEIGHT, AltosLib.MISSING);
- record.flight_accel = map.get_int(AO_TELEM_ADHOC_ACCEL, AltosRecord.MISSING);
- record.flight_vel = map.get_int(AO_TELEM_ADHOC_SPEED, AltosRecord.MISSING);
- record.flight_pres = map.get_int(AO_TELEM_ADHOC_BARO, AltosRecord.MISSING);
+ record.flight_accel = map.get_int(AO_TELEM_ADHOC_ACCEL, AltosLib.MISSING);
+ record.flight_vel = map.get_int(AO_TELEM_ADHOC_SPEED, AltosLib.MISSING);
+ record.flight_pres = map.get_int(AO_TELEM_ADHOC_BARO, AltosLib.MISSING);
if (map.has(AO_TELEM_GPS_STATE)) {
record.gps = new AltosGPS(map);
@@ -337,9 +337,9 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord {
record.kalman_speed = ((short) record.flight_vel) / 16.0;
record.kalman_acceleration = record.flight_accel / 16.0;
record.kalman_height = record.flight_pres;
- record.flight_vel = AltosRecord.MISSING;
- record.flight_pres = AltosRecord.MISSING;
- record.flight_accel = AltosRecord.MISSING;
+ record.flight_vel = AltosLib.MISSING;
+ record.flight_pres = AltosLib.MISSING;
+ record.flight_accel = AltosLib.MISSING;
}
AltosParse.word(words[i++], "gp:");
@@ -458,16 +458,16 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord {
record.kalman_acceleration = int16(5);
record.kalman_speed = int16(9);
record.kalman_height = int16(13);
- record.flight_accel = AltosRecord.MISSING;
- record.flight_vel = AltosRecord.MISSING;
- record.flight_pres = AltosRecord.MISSING;
+ record.flight_accel = AltosLib.MISSING;
+ record.flight_vel = AltosLib.MISSING;
+ record.flight_pres = AltosLib.MISSING;
} else {
record.flight_accel = int16(5);
record.flight_vel = uint32(9);
record.flight_pres = int16(13);
- record.kalman_acceleration = AltosRecord.MISSING;
- record.kalman_speed = AltosRecord.MISSING;
- record.kalman_height = AltosRecord.MISSING;
+ record.kalman_acceleration = AltosLib.MISSING;
+ record.kalman_speed = AltosLib.MISSING;
+ record.kalman_height = AltosLib.MISSING;
}
record.gps = null;
diff --git a/altoslib/AltosTelemetryRecordLocation.java b/altoslib/AltosTelemetryRecordLocation.java
index 0236d291..0eea8361 100644
--- a/altoslib/AltosTelemetryRecordLocation.java
+++ b/altoslib/AltosTelemetryRecordLocation.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordLocation extends AltosTelemetryRecordRaw {
diff --git a/altoslib/AltosTelemetryRecordMegaData.java b/altoslib/AltosTelemetryRecordMegaData.java
index a484ef4e..ee9442d2 100644
--- a/altoslib/AltosTelemetryRecordMegaData.java
+++ b/altoslib/AltosTelemetryRecordMegaData.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordMegaData extends AltosTelemetryRecordRaw {
diff --git a/altoslib/AltosTelemetryRecordMegaSensor.java b/altoslib/AltosTelemetryRecordMegaSensor.java
index 2a4b17a4..234cda27 100644
--- a/altoslib/AltosTelemetryRecordMegaSensor.java
+++ b/altoslib/AltosTelemetryRecordMegaSensor.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordMegaSensor extends AltosTelemetryRecordRaw {
diff --git a/altoslib/AltosTelemetryRecordMetrumData.java b/altoslib/AltosTelemetryRecordMetrumData.java
index 70179b28..ade2494f 100644
--- a/altoslib/AltosTelemetryRecordMetrumData.java
+++ b/altoslib/AltosTelemetryRecordMetrumData.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordMetrumData extends AltosTelemetryRecordRaw {
diff --git a/altoslib/AltosTelemetryRecordMetrumSensor.java b/altoslib/AltosTelemetryRecordMetrumSensor.java
index e41242c5..d6d29b15 100644
--- a/altoslib/AltosTelemetryRecordMetrumSensor.java
+++ b/altoslib/AltosTelemetryRecordMetrumSensor.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordMetrumSensor extends AltosTelemetryRecordRaw {
diff --git a/altoslib/AltosTelemetryRecordMini.java b/altoslib/AltosTelemetryRecordMini.java
index 75a66c16..3c290208 100644
--- a/altoslib/AltosTelemetryRecordMini.java
+++ b/altoslib/AltosTelemetryRecordMini.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordMini extends AltosTelemetryRecordRaw {
diff --git a/altoslib/AltosTelemetryRecordRaw.java b/altoslib/AltosTelemetryRecordRaw.java
index f94789bb..93d0ca50 100644
--- a/altoslib/AltosTelemetryRecordRaw.java
+++ b/altoslib/AltosTelemetryRecordRaw.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordRaw extends AltosTelemetryRecord {
int[] bytes;
diff --git a/altoslib/AltosTelemetryRecordSatellite.java b/altoslib/AltosTelemetryRecordSatellite.java
index 9835389b..5de16ab4 100644
--- a/altoslib/AltosTelemetryRecordSatellite.java
+++ b/altoslib/AltosTelemetryRecordSatellite.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordSatellite extends AltosTelemetryRecordRaw {
int channels;
diff --git a/altoslib/AltosTelemetryRecordSensor.java b/altoslib/AltosTelemetryRecordSensor.java
index e0e92c13..d1d9dd7e 100644
--- a/altoslib/AltosTelemetryRecordSensor.java
+++ b/altoslib/AltosTelemetryRecordSensor.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetryRecordSensor extends AltosTelemetryRecordRaw {
@@ -70,7 +70,7 @@ public class AltosTelemetryRecordSensor extends AltosTelemetryRecordRaw {
if (type == packet_type_TM_sensor)
next.accel = accel;
else
- next.accel = AltosRecord.MISSING;
+ next.accel = AltosLib.MISSING;
next.pres = pres;
next.temp = temp;
next.batt = v_batt;
@@ -78,8 +78,8 @@ public class AltosTelemetryRecordSensor extends AltosTelemetryRecordRaw {
next.drogue = sense_d;
next.main = sense_m;
} else {
- next.drogue = AltosRecord.MISSING;
- next.main = AltosRecord.MISSING;
+ next.drogue = AltosLib.MISSING;
+ next.main = AltosLib.MISSING;
}
next.kalman_acceleration = acceleration / 16.0;
@@ -92,9 +92,9 @@ public class AltosTelemetryRecordSensor extends AltosTelemetryRecordRaw {
next.accel_plus_g = accel_plus_g;
next.accel_minus_g = accel_minus_g;
} else {
- next.ground_accel = AltosRecord.MISSING;
- next.accel_plus_g = AltosRecord.MISSING;
- next.accel_minus_g = AltosRecord.MISSING;
+ next.ground_accel = AltosLib.MISSING;
+ next.accel_plus_g = AltosLib.MISSING;
+ next.accel_minus_g = AltosLib.MISSING;
}
next.seen |= AltosRecord.seen_sensor | AltosRecord.seen_temp_volt;
diff --git a/altoslib/AltosTelemetrySatellite.java b/altoslib/AltosTelemetrySatellite.java
index bd94740f..fde3d86d 100644
--- a/altoslib/AltosTelemetrySatellite.java
+++ b/altoslib/AltosTelemetrySatellite.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetrySatellite extends AltosTelemetryStandard {
int channels;
diff --git a/altoslib/AltosTelemetrySensor.java b/altoslib/AltosTelemetrySensor.java
index f89e56c3..e1106440 100644
--- a/altoslib/AltosTelemetrySensor.java
+++ b/altoslib/AltosTelemetrySensor.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTelemetrySensor extends AltosTelemetryStandard {
diff --git a/altoslib/AltosTelemetryStandard.java b/altoslib/AltosTelemetryStandard.java
index fa86bf8e..fbcc970c 100644
--- a/altoslib/AltosTelemetryStandard.java
+++ b/altoslib/AltosTelemetryStandard.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public abstract class AltosTelemetryStandard extends AltosTelemetry {
int[] bytes;
diff --git a/altoslib/AltosTemperature.java b/altoslib/AltosTemperature.java
index 2749eac0..0105fe53 100644
--- a/altoslib/AltosTemperature.java
+++ b/altoslib/AltosTemperature.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public class AltosTemperature extends AltosUnits {
diff --git a/altoslib/AltosUnits.java b/altoslib/AltosUnits.java
index b8b3254c..ee74f916 100644
--- a/altoslib/AltosUnits.java
+++ b/altoslib/AltosUnits.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public abstract class AltosUnits {
diff --git a/altoslib/AltosUnitsListener.java b/altoslib/AltosUnitsListener.java
index 61a181a4..1e3ad655 100644
--- a/altoslib/AltosUnitsListener.java
+++ b/altoslib/AltosUnitsListener.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
public interface AltosUnitsListener {
public void units_changed(boolean imperial_units);
diff --git a/altoslib/Makefile.am b/altoslib/Makefile.am
index 87d4d898..62159bcc 100644
--- a/altoslib/Makefile.am
+++ b/altoslib/Makefile.am
@@ -10,20 +10,9 @@ SRC=.
altoslibdir = $(datadir)/java
-record_files = \
- AltosEepromRecord.java \
- AltosEepromTeleScience.java \
- AltosRecordCompanion.java \
- AltosRecordIterable.java \
- AltosRecord.java \
- AltosRecordNone.java \
- AltosRecordTM.java \
- AltosRecordMM.java \
- AltosRecordMini.java
-
altoslib_JAVA = \
- $(record_files) \
AltosLib.java \
+ AltosCompanion.java \
AltosConfigData.java \
AltosConfigValues.java \
AltosConvert.java \
@@ -45,31 +34,32 @@ altoslib_JAVA = \
AltosFlightReader.java \
AltosFrequency.java \
AltosGPS.java \
- AltosGPSQuery.java \
AltosGPSSat.java \
AltosGreatCircle.java \
AltosHexfile.java \
+ AltosIdle.java \
+ AltosIdleFetch.java \
AltosIdleMonitor.java \
AltosIdleMonitorListener.java \
AltosIgnite.java \
AltosIMU.java \
- AltosIMUQuery.java \
AltosLine.java \
AltosLink.java \
AltosListenerState.java \
AltosLog.java \
+ AltosMag.java \
+ AltosMma655x.java \
AltosMs5607.java \
- AltosMs5607Query.java \
- AltosOrderedRecord.java \
- AltosOrderedMegaRecord.java \
- AltosOrderedMiniRecord.java \
AltosParse.java \
AltosPreferences.java \
AltosPreferencesBackend.java \
AltosReplayReader.java \
AltosRomconfig.java \
AltosSensorMM.java \
+ AltosSensorEMini.java \
AltosSensorTM.java \
+ AltosSensorMega.java \
+ AltosSensorMetrum.java \
AltosState.java \
AltosStateIterable.java \
AltosStateUpdate.java \