altoslib: Finish AltosState changes. Update version number.
authorKeith Packard <keithp@keithp.com>
Thu, 5 Sep 2013 18:33:48 +0000 (11:33 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 5 Sep 2013 18:35:14 +0000 (11:35 -0700)
Removes all of the AltosRecord bits, changes the monitor idle bits to
have per-object state updaters.

Signed-off-by: Keith Packard <keithp@keithp.com>
199 files changed:
altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java
altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java
altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java
altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java
altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java
altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java
altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java
altosdroid/src/org/altusmetrum/AltosDroid/TelemetryLogger.java
altosdroid/src/org/altusmetrum/AltosDroid/TelemetryReader.java
altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
altoslib/AltosAccel.java
altoslib/AltosCRCException.java
altoslib/AltosCompanion.java
altoslib/AltosConfigData.java
altoslib/AltosConfigValues.java
altoslib/AltosConvert.java
altoslib/AltosDebug.java
altoslib/AltosDistance.java
altoslib/AltosEeprom.java
altoslib/AltosEepromBody.java
altoslib/AltosEepromBodyIterable.java
altoslib/AltosEepromChunk.java
altoslib/AltosEepromFile.java
altoslib/AltosEepromGPS.java
altoslib/AltosEepromHeader.java
altoslib/AltosEepromHeaderIterable.java
altoslib/AltosEepromIterable.java
altoslib/AltosEepromLog.java
altoslib/AltosEepromMega.java
altoslib/AltosEepromMegaIterable.java
altoslib/AltosEepromMetrum.java
altoslib/AltosEepromMetrum2.java
altoslib/AltosEepromMetrumIterable.java
altoslib/AltosEepromMini.java
altoslib/AltosEepromMiniIterable.java
altoslib/AltosEepromOldIterable.java
altoslib/AltosEepromRecord.java [deleted file]
altoslib/AltosEepromTM.java
altoslib/AltosEepromTeleScience.java [deleted file]
altoslib/AltosFile.java
altoslib/AltosFlash.java
altoslib/AltosFlashListener.java
altoslib/AltosFlightReader.java
altoslib/AltosFrequency.java
altoslib/AltosGPS.java
altoslib/AltosGPSQuery.java [deleted file]
altoslib/AltosGPSSat.java
altoslib/AltosGreatCircle.java
altoslib/AltosHeight.java
altoslib/AltosHexfile.java
altoslib/AltosIMU.java
altoslib/AltosIMUQuery.java [deleted file]
altoslib/AltosIdle.java [new file with mode: 0644]
altoslib/AltosIdleFetch.java [new file with mode: 0644]
altoslib/AltosIdleMonitor.java
altoslib/AltosIdleMonitorListener.java
altoslib/AltosIgnite.java
altoslib/AltosLib.java
altoslib/AltosLine.java
altoslib/AltosLink.java
altoslib/AltosListenerState.java
altoslib/AltosLog.java
altoslib/AltosMag.java
altoslib/AltosMma655x.java [new file with mode: 0644]
altoslib/AltosMs5607.java
altoslib/AltosMs5607Query.java [deleted file]
altoslib/AltosOrderedMegaRecord.java [deleted file]
altoslib/AltosOrderedMetrumRecord.java
altoslib/AltosOrderedMiniRecord.java [deleted file]
altoslib/AltosOrderedRecord.java [deleted file]
altoslib/AltosParse.java
altoslib/AltosPreferences.java
altoslib/AltosPreferencesBackend.java
altoslib/AltosPyro.java
altoslib/AltosRecord.java [deleted file]
altoslib/AltosRecordCompanion.java [deleted file]
altoslib/AltosRecordIterable.java [deleted file]
altoslib/AltosRecordMM.java [deleted file]
altoslib/AltosRecordMini.java [deleted file]
altoslib/AltosRecordNone.java [deleted file]
altoslib/AltosRecordTM.java [deleted file]
altoslib/AltosRecordTM2.java
altoslib/AltosReplayReader.java
altoslib/AltosRomconfig.java
altoslib/AltosSelfFlash.java
altoslib/AltosSensorEMini.java [new file with mode: 0644]
altoslib/AltosSensorMM.java
altoslib/AltosSensorMega.java [new file with mode: 0644]
altoslib/AltosSensorMetrum.java
altoslib/AltosSensorTM.java
altoslib/AltosSpeed.java
altoslib/AltosState.java
altoslib/AltosStateIterable.java
altoslib/AltosStateUpdate.java
altoslib/AltosTelemetry.java
altoslib/AltosTelemetryConfiguration.java
altoslib/AltosTelemetryFile.java
altoslib/AltosTelemetryIterable.java
altoslib/AltosTelemetryLegacy.java
altoslib/AltosTelemetryLocation.java
altoslib/AltosTelemetryMap.java
altoslib/AltosTelemetryMegaData.java
altoslib/AltosTelemetryMegaSensor.java
altoslib/AltosTelemetryMetrumData.java
altoslib/AltosTelemetryMetrumSensor.java
altoslib/AltosTelemetryRaw.java
altoslib/AltosTelemetryReader.java
altoslib/AltosTelemetryRecord.java
altoslib/AltosTelemetryRecordCompanion.java
altoslib/AltosTelemetryRecordConfiguration.java
altoslib/AltosTelemetryRecordGeneral.java
altoslib/AltosTelemetryRecordLegacy.java
altoslib/AltosTelemetryRecordLocation.java
altoslib/AltosTelemetryRecordMegaData.java
altoslib/AltosTelemetryRecordMegaSensor.java
altoslib/AltosTelemetryRecordMetrumData.java
altoslib/AltosTelemetryRecordMetrumSensor.java
altoslib/AltosTelemetryRecordMini.java
altoslib/AltosTelemetryRecordRaw.java
altoslib/AltosTelemetryRecordSatellite.java
altoslib/AltosTelemetryRecordSensor.java
altoslib/AltosTelemetrySatellite.java
altoslib/AltosTelemetrySensor.java
altoslib/AltosTelemetryStandard.java
altoslib/AltosTemperature.java
altoslib/AltosUnits.java
altoslib/AltosUnitsListener.java
altoslib/Makefile.am
altosui/Altos.java
altosui/AltosAscent.java
altosui/AltosBTKnown.java
altosui/AltosCSV.java
altosui/AltosCSVUI.java
altosui/AltosCompanionInfo.java
altosui/AltosConfig.java
altosui/AltosConfigFreqUI.java
altosui/AltosConfigPyroUI.java
altosui/AltosConfigTD.java
altosui/AltosConfigTDUI.java
altosui/AltosConfigUI.java
altosui/AltosDataChooser.java
altosui/AltosDescent.java
altosui/AltosDisplayThread.java
altosui/AltosEepromDelete.java
altosui/AltosEepromDownload.java
altosui/AltosEepromList.java
altosui/AltosEepromManage.java
altosui/AltosEepromSelect.java
altosui/AltosFlashUI.java
altosui/AltosFlightDisplay.java
altosui/AltosFlightStats.java
altosui/AltosFlightStatsTable.java
altosui/AltosFlightStatus.java
altosui/AltosFlightStatusTableModel.java
altosui/AltosFlightStatusUpdate.java
altosui/AltosFlightUI.java
altosui/AltosFreqList.java
altosui/AltosGraph.java
altosui/AltosGraphDataPoint.java
altosui/AltosGraphDataSet.java
altosui/AltosGraphUI.java
altosui/AltosIdleMonitorUI.java
altosui/AltosIgniteUI.java
altosui/AltosInfoTable.java
altosui/AltosKML.java
altosui/AltosLanded.java
altosui/AltosPad.java
altosui/AltosRomconfigUI.java
altosui/AltosScanUI.java
altosui/AltosSerial.java
altosui/AltosSiteMap.java
altosui/AltosSiteMapTile.java
altosui/AltosUI.java
altosui/AltosUIPreferencesBackend.java
altosui/AltosWriter.java
altosuilib/AltosUIAxis.java
altosuilib/AltosUIEnable.java
altosuilib/AltosUIGraph.java
altosuilib/AltosUIGrapher.java
altosuilib/AltosUILib.java
altosuilib/AltosUIMarker.java
altosuilib/AltosUIPreferences.java
altosuilib/AltosUIPreferencesBackend.java
altosuilib/AltosUISeries.java
configure.ac
micropeak/MicroData.java
micropeak/MicroDownload.java
micropeak/MicroExport.java
micropeak/MicroFile.java
micropeak/MicroFileChooser.java
micropeak/MicroGraph.java
micropeak/MicroPeak.java
micropeak/MicroRaw.java
micropeak/MicroSave.java
micropeak/MicroStats.java
micropeak/MicroStatsTable.java

index 0aea06f1cf22a242cf89489768070522caafdf15..0ed314375eb55ccc20957a145a82a606a78a0a58 100644 (file)
@@ -31,7 +31,7 @@ import android.os.Handler;
 //import android.os.Message;
 import android.util.Log;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosBluetooth extends AltosLink {
 
index e10982f7cc8873832c99fa21e2937c260deab64f..6f3787775cb0868b57661399baadbb6af0087e70 100644 (file)
@@ -49,7 +49,7 @@ import android.widget.Toast;
 import android.app.AlertDialog;
 import android.location.Location;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosDroid extends FragmentActivity {
        // Debugging
@@ -266,7 +266,7 @@ public class AltosDroid extends FragmentActivity {
 
        static String pos(double p, String pos, String neg) {
                String  h = pos;
-               if (p == AltosRecord.MISSING)
+               if (p == AltosLib.MISSING)
                        return "";
                if (p < 0) {
                        h = neg;
@@ -278,13 +278,13 @@ public class AltosDroid extends FragmentActivity {
        }
 
        static String number(String format, double value) {
-               if (value == AltosRecord.MISSING)
+               if (value == AltosLib.MISSING)
                        return "";
                return String.format(format, value);
        }
 
        static String integer(String format, int value) {
-               if (value == AltosRecord.MISSING)
+               if (value == AltosLib.MISSING)
                        return "";
                return String.format(format, value);
        }
index fd4b0768ac33f8d60e55946be7f0d6bb1ad39d09..59fef84279d6c2b6985f9d192e05fd69e894dd48 100644 (file)
@@ -23,7 +23,7 @@ import android.content.Context;
 import android.content.SharedPreferences;
 import android.os.Environment;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosDroidPreferences implements AltosPreferencesBackend {
        public final static String        NAME    = "org.altusmetrum.AltosDroid";
index 6ebb47f74e3b1ff9f3218f5655c5e1d43d6e2237..c652a1694f24b62df27f2ca829f0868ac79b0265 100644 (file)
@@ -17,7 +17,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import android.location.Location;
 
 public interface AltosDroidTab {
index b3dba62693714403f95f0b312beeb890f6e88b1a..df7409c45999099b12d4641bbbc3094d853fc658 100644 (file)
@@ -21,7 +21,7 @@ package org.altusmetrum.AltosDroid;
 import android.speech.tts.TextToSpeech;\r
 import android.speech.tts.TextToSpeech.OnInitListener;\r
 \r
-import org.altusmetrum.altoslib_1.*;\r
+import org.altusmetrum.altoslib_2.*;\r
 \r
 public class AltosVoice {\r
 \r
index 0e141ae47e942e2983333a1ef526c79b67b13c2d..69bc68c95f6575b99fe95e09c56b5f909d7c8382 100644 (file)
@@ -17,7 +17,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import android.app.Activity;
 import android.os.Bundle;
@@ -103,10 +103,10 @@ public class TabAscent extends Fragment implements AltosDroidTab {
                        }
 
                        mApogeeVoltageView.setText(AltosDroid.number("%4.2f V", state.drogue_sense));
-                       mApogeeLights.set(state.drogue_sense > 3.2, state.drogue_sense == AltosRecord.MISSING);
+                       mApogeeLights.set(state.drogue_sense > 3.2, state.drogue_sense == AltosLib.MISSING);
 
                        mMainVoltageView.setText(AltosDroid.number("%4.2f V", state.main_sense));
-                       mMainLights.set(state.main_sense > 3.2, state.main_sense == AltosRecord.MISSING);
+                       mMainLights.set(state.main_sense > 3.2, state.main_sense == AltosLib.MISSING);
                }
        }
 }
index 09e7169b229ff1c126405ac9f8fe8a3fdbedabc6..ee09ea8800356cf9e0aa461b46c0da7f476b5098 100644 (file)
@@ -17,7 +17,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import android.app.Activity;
 import android.os.Bundle;
@@ -112,10 +112,10 @@ public class TabDescent extends Fragment implements AltosDroidTab {
                        }
 
                        mApogeeVoltageView.setText(AltosDroid.number("%4.2f V", state.drogue_sense));
-                       mApogeeLights.set(state.drogue_sense > 3.2, state.drogue_sense == AltosRecord.MISSING);
+                       mApogeeLights.set(state.drogue_sense > 3.2, state.drogue_sense == AltosLib.MISSING);
 
                        mMainVoltageView.setText(AltosDroid.number("%4.2f V", state.main_sense));
-                       mMainLights.set(state.main_sense > 3.2, state.main_sense == AltosRecord.MISSING);
+                       mMainLights.set(state.main_sense > 3.2, state.main_sense == AltosLib.MISSING);
                }
        }
 
index f42b46b55520d7fbf8551e676ddda47dfebafe41..a57ae5146088e7a7f65e7a9dd6c058b495845990 100644 (file)
@@ -17,7 +17,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import android.app.Activity;
 import android.os.Bundle;
index d831f1172761cfabf52a5b404a8b1ba585d200c9..a4e224aad486ac6f3216f728868c5ce3b00d53c0 100644 (file)
@@ -19,7 +19,7 @@ package org.altusmetrum.AltosDroid;
 
 import java.util.Arrays;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import com.google.android.gms.maps.CameraUpdateFactory;
 import com.google.android.gms.maps.GoogleMap;
index 066c1353ef792a87896a18a3522d9623725a0e2d..f9d30b34ea9434356de898f808e2941eaebbf724 100644 (file)
@@ -17,7 +17,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import android.app.Activity;
 import android.os.Bundle;
@@ -104,13 +104,13 @@ public class TabPad extends Fragment implements AltosDroidTab {
        public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) {
                if (state != null) {
                        mBatteryVoltageView.setText(AltosDroid.number("%4.2f V", state.battery));
-                       mBatteryLights.set(state.battery > 3.7, state.battery == AltosRecord.MISSING);
+                       mBatteryLights.set(state.battery > 3.7, state.battery == AltosLib.MISSING);
 
                        mApogeeVoltageView.setText(AltosDroid.number("%4.2f V", state.drogue_sense));
-                       mApogeeLights.set(state.drogue_sense > 3.2, state.drogue_sense == AltosRecord.MISSING);
+                       mApogeeLights.set(state.drogue_sense > 3.2, state.drogue_sense == AltosLib.MISSING);
 
                        mMainVoltageView.setText(AltosDroid.number("%4.2f V", state.main_sense));
-                       mMainLights.set(state.main_sense > 3.2, state.main_sense == AltosRecord.MISSING);
+                       mMainLights.set(state.main_sense > 3.2, state.main_sense == AltosLib.MISSING);
 
                        if (state.data.flight != 0) {
                                if (state.data.state <= AltosLib.ao_flight_pad)
@@ -122,7 +122,7 @@ public class TabPad extends Fragment implements AltosDroidTab {
                        } else {
                                mDataLoggingView.setText("Storage full");
                        }
-                       mDataLoggingLights.set(state.data.flight != 0, state.data.flight == AltosRecord.MISSING);
+                       mDataLoggingLights.set(state.data.flight != 0, state.data.flight == AltosLib.MISSING);
 
                        if (state.gps != null) {
                                mGPSLockedView.setText(AltosDroid.integer("%4d sats", state.gps.nsat));
index 3ece04ac3e8596b0ef1f64b40f430e5280c13d74..4d793413a8983e3403775b1e6217d03b034c0435 100644 (file)
@@ -1,6 +1,6 @@
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import android.content.BroadcastReceiver;
 import android.content.Context;
index 716ec5894c9df42c5e0a975591ba8464c42e91bd..e37019fd67b54edda08cd6ed229063c6c15b695b 100644 (file)
@@ -25,7 +25,7 @@ import java.util.concurrent.*;
 import android.util.Log;\r
 import android.os.Handler;\r
 \r
-import org.altusmetrum.altoslib_1.*;\r
+import org.altusmetrum.altoslib_2.*;\r
 \r
 \r
 public class TelemetryReader extends Thread {\r
index 940ad792df17ff35e6532123d2450ad41481782b..76efa74968ca557627ce2cf5495e7dbecd5b4645 100644 (file)
@@ -44,7 +44,7 @@ import android.location.LocationManager;
 import android.location.LocationListener;
 import android.location.Criteria;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 
 public class TelemetryService extends Service implements LocationListener {
index d02b32385f348e1dfdf28eabb5afd1219dbcf07b..08eba359c9f6bfb4622be0344d2b957390c8aead 100644 (file)
@@ -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 {
 
index 76e79add1255c1cb9157564c59ae7851d15a5864..be2ec4fec48e0bd00e311ea7b6c410718e07c4ac 100644 (file)
@@ -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;
index 1572fdae28326dcbd0a1c8f0959e88763265d9e8..57bb21afbccdd666a20a0f836c987eed18574fd1 100644 (file)
@@ -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;
index 2ca5a7a56f74093227285d72176f62b51307e304..d92f42c3aeb9b43006784f9375303e4d7f3fe2e3 100644 (file)
@@ -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.*;
index 027d10f4dfb92be98d04d41a5a161b2d48c64dbb..fd5584c2422b0552bc4dfa4086bf288354dd69c3 100644 (file)
@@ -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 */
index cf2bc59f35482a89a5df10311a0c48f821579ea1..760d9eb98c273a0501f15aad1e09b4dc6a6dca67 100644 (file)
@@ -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) {
index 4d8e3ae7cfa994bb7718ac41bbf0691a98111c76..76c13d57a399187079d9d4f0820eaedf4a36fa22 100644 (file)
@@ -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.*;
 
index 25028ac79a2ae255717c901ef41f0460dbdca71c..562571657370a81be5a4d28fb620985e6995e06d 100644 (file)
@@ -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 {
 
index 3a996ae0672ef44dfa644b776c80ee26daff4ae0..dd5993c763e7bc0cfd1747d81544062ca5f3e58a 100644 (file)
@@ -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.*;
index 60aa8881dfd7429fd0bc8c2fc53805bba0059838..444102ce8cd3027cc06e3911fc260456419230fd 100644 (file)
@@ -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.*;
index 33dc0ac849209695cbcf2dbf6bc0a55a59c0485c..4d32c66a232936955f9ae51992252166831bdfd5 100644 (file)
@@ -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.*;
index 1709352b3a640be5c0c3f523b8333066b9150cb9..918481fad81bce1cde8bae8999a4d018e23f85e4 100644 (file)
@@ -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.*;
index 082c23ca5149dee65e111d12b3c61308284d1249..f87bf916f9e8fe8f3fdcb095eaa742ac30797c38 100644 (file)
@@ -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
index f97fbbf906dbc6ff6ce7acd8808253f62ff0b07a..43ed3392c2fa8b27c9a37ae6d49c8abc6c20778c 100644 (file)
@@ -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.*;
index 35a03a121e27773bcfc7940a297b78666005c62c..0aeb78dd36e4bf8c9772e47bb8c116fba20feaf7 100644 (file)
@@ -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.*;
index 01953f0e97eed818ea5a9615694838edd6397603..920a438227856fce6ebecbf0e0f17efd2776ff8f 100644 (file)
@@ -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.*;
index 1e0f7f7570b7ac8b30e9f556fdf6997d3367c40b..fc793579f41837469a54c8924a6b85025d9c23e9 100644 (file)
@@ -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.*;
index 20026c6d33139a76b4c8014f15e284defd0c3b48..95c0c3f6c5bcb272ba8db7b8cfbd89b8640d198c 100644 (file)
@@ -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;
index b85c04bffc576559061949a2d3e879b4d9685a7d..7a4ee52d10680e1e61c3289bb029a12e079b444c 100644 (file)
@@ -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.*;
index 5736f9372e99b83ab49e4c7fc8a5c80157960cd4..8243aa88d7353623d1126780b2ab591f0412b31f 100644 (file)
@@ -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.*;
index e035e5fd635aef461061f5fe5465297d12446361..7b2fcb3c3426f81afd78d84dddceba4c43d25fbb 100644 (file)
@@ -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.*;
 
index ea38edf2c2cef76b034eaa0a51ed3247b9c60b95..c1d62c0c7663fd8c64bdb078657dc3e0fe40512e 100644 (file)
@@ -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.*;
index 0387319e2a898636ca858a9466e1fc653643a4bb..de4cc9199038c00aa12761f25fba77f65dbafbd3 100644 (file)
@@ -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.*;
index e0eedb73147ba2775bdaa7d85a3538b7a75e11ce..a09a62ceb6adfd4e24e95733a773c672f82367dc 100644 (file)
@@ -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) {
index 495495ebacc523150a5b233a21120570a316cfb3..31e667d88f99b5c400c8e2727a8386042f49052d 100644 (file)
@@ -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.*;
index ef82828b2c6622e7ad5abeab9049efaca883da9b..43b2362bcdf4a0bc615f9727536be1d52d9bc2d4 100644 (file)
@@ -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 (file)
index 70ac111..0000000
+++ /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;
-       }
-}
index 2bb9d974d9c639a17c506362db08d40de7700de4..a38c2dae628a914f258117c2a6feef9b71348315 100644 (file)
@@ -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 (file)
index bacd66b..0000000
+++ /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);
-       }
-}
index 54c5482435b18e75d3e173498b664240c82007ed..9802f883edbcb9ad8a26962b8f2f05e2bd2bdfbe 100644 (file)
@@ -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);
index 010274b944884ecf1e3339aad5f72a3e3221d18d..d806915797b7362512e5bd0d6643def2b9b0f342 100644 (file)
@@ -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.*;
 
index ab50b74a6093799f9322071cf9dc1475fe32b8c4..777ae635bf3ec24475ec3bda2b80d44df98fd941 100644 (file)
@@ -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);
index 5a415274e412024b9e3e08f41ab7a5e264e101cd..4a722e42ac5b0e6f27c1b96e9de484e14cc43029 100644 (file)
@@ -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; }
 }
index 484a2fd9d56e084f99c130185bf33fb2ad21711a..ece7525ad848d78408d432c328dac7235c6d3ece 100644 (file)
@@ -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;
index a8c19e4ad4fe9a8853fe6ee24bb189d44383ac1d..1d5b0755982a0d9a194d492dd6d22ec4322d7308 100644 (file)
  * 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 (file)
index deb9d20..0000000
+++ /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;
-               }
-       }
-}
-
index 8714dd8aa42f98e217764fc80c3c8718f8be9e05..0e17d7f24d9eca661543f1ce3eeb56f17f8fd129 100644 (file)
@@ -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;
index 770c3c6c34ffabc288db27a04f322ac980a0104c..2c84bf4a27534c607f0c517215e41f354fc0000d 100644 (file)
@@ -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;
 
index 96f5722bde80bcca8b3a33d32b3d32b345d2acd4..1d2e4dbce499562d9db2a4d73df41efed1454d70 100644 (file)
@@ -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 {
 
index 2140228a179f44acf126c5f3288a438a9bd6464f..90352927433f219e1a79c359554c84b2e40009d7 100644 (file)
@@ -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;
index c5ebbb16a8c276b1677e6bb92f2a3e93ae3293fc..c231dda74c6f8f9cc2a76c1a8e123478e2d9a232 100644 (file)
@@ -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 (file)
index 4ea5d96..0000000
+++ /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/AltosIdle.java b/altoslib/AltosIdle.java
new file mode 100644 (file)
index 0000000..456a924
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.*;
+
+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 (file)
index 0000000..42943c0
--- /dev/null
@@ -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;
+       }
+}
index b3ce5b204a8774976f9764fb2d738d37de99fdf1..d858845a1af0dbe0ea10837191cfa053507439d7 100644 (file)
@@ -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);
        }
 }
index 27e36dea2ce6b4f673bc47f3623c4e0e0d07810b..0b03b897ae3139ebb27ef7c12a26976e61885aaa 100644 (file)
@@ -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);
index 859059008cbfd838e8c9ff3aadd0704c8fe230f1..42169989b00eb797b307df5d7ebca671ed160933 100644 (file)
@@ -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.*;
index d6d78ca8ffc2dd68e1e80905ea5ad80605cda7d6..f8a3974a0b56f8dea046f4e46786149f0b524b95 100644 (file)
@@ -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;
 
index b3bd20f97bc71071ddf49d751ae1101012a56afe..e5dd13fc2901c7d582be2c937ea7560409454e75 100644 (file)
@@ -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;
index 159ebfe19c234b34b423a6619e56d18f7ca6f433..b1bf525b1af48b6aae09f4ca8793ddbe8a1e8643 100644 (file)
@@ -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;
        }
 }
index 2fb4673edcc5c87885f6ae03328959f9f8cd9502..01dd7afb4e6f7b9a6c7e52adec741584d0c1a31c 100644 (file)
@@ -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;
        }
 }
index 7f69bb65afea25e4082f5b1f2e7ae2649914f9e8..17b04970ae613c7eb514d2fd9914a29bc68ceeb7 100644 (file)
@@ -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;
index cb6826f3412fd56fdca25c51c1710cdb9fef48c9..56add8f3445da8d0de9fee7d2ec2f5150d4ee739 100644 (file)
  * 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 (file)
index 0000000..8dc947d
--- /dev/null
@@ -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;
+               }
+       }
+}
index 606916b7b46ec84f14de302b2d7e2a011056c5f2..b29fa9ae845d11ad4652448f4627587ae062027e 100644 (file)
@@ -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 (file)
index d39dbf2..0000000
+++ /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 (file)
index b20a5bb..0000000
+++ /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;
-       }
-}
index 02cdf1fe2ab71b0f68d18eea43fcd723bc40c36d..cc034bff0fe45b251a8f5930751c4781c46778e5 100644 (file)
@@ -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 (file)
index 9688894..0000000
+++ /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 (file)
index 63507d3..0000000
+++ /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;
-       }
-}
-
index 66bbeed5eb185f5b101b54a1bfad369d1fb44a0b..ca96a8f94385aeb3877458628b33afb1293d48e0 100644 (file)
@@ -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.*;
 
index 088ca3d7589c7507c1e17afb090158043737a218..c4051f9b58e2155a56a5a81e8ebf7d186d7f87fb 100644 (file)
@@ -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.*;
index fb8a235a8d5ede79f5b13f2019e2a897bc2e2808..1ea28b0131ab11510ea7fe719680036e3fc1cb81 100644 (file)
@@ -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;
 
index 4dbb42234a346c1806d606b70bad05e5a079ffcd..0142eac825a1dcca84b7a3660cc74baeca9162ed 100644 (file)
@@ -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 (file)
index 0c8e1db..0000000
+++ /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 (file)
index b153fb5..0000000
+++ /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/AltosRecordIterable.java b/altoslib/AltosRecordIterable.java
deleted file mode 100644 (file)
index 62dbdfe..0000000
+++ /dev/null
@@ -1,29 +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.io.*;
-import java.util.*;
-
-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; };
-}
diff --git a/altoslib/AltosRecordMM.java b/altoslib/AltosRecordMM.java
deleted file mode 100644 (file)
index d697111..0000000
+++ /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 (file)
index dacd89b..0000000
+++ /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 (file)
index a95b6a9..0000000
+++ /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 (file)
index c6cf364..0000000
+++ /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();
-       }
-}
index 0cd54f2c2e1ec4965c9a3e3b455a9852ef5792e2..da2d948cd3cf5953142189cb96cdd03621af272a 100644 (file)
@@ -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 {
 
index 0c14dee445dc449e5096fcb81dfb7833ef787c04..f65caaa0445b9ee54d0c6b4026d3d15df99ec41a 100644 (file)
@@ -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.*;
index 0800a2c4da1e405abad6d9686cfb76514d6355ff..e9d3147eeb30d1d7654845df6e75a1976c2aeda5 100644 (file)
@@ -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.*;
 
index 07917d5d09fff07eb1f4e90f6e34ccd9d9551534..0ae797a0877f2afb16613d58a81c8244d8bb13fd 100644 (file)
@@ -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 (file)
index 0000000..cbc6514
--- /dev/null
@@ -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++;
+               }
+       }
+}
+
index 6d1b61c079fa3d9305a661f871da2122651ffe1d..0ef42cf683e372938d951ddd788ec0dad0c7f4c9 100644 (file)
@@ -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 (file)
index 0000000..3afb8a6
--- /dev/null
@@ -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) {
+               }
+       }
+}
+
index 686c78a827c3188a9052b5adb23d09200017db40..4a51d492db4188f9d69861f600a34de49c1abb15 100644 (file)
@@ -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) {
+               }
+       }
 }
 
index 754dc5bbbc85cec8d762a5ec8fc5be1da31b9fde..2696a3080a252c68f10f43e1b0d49c75f82f5e20 100644 (file)
  * 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;
        }
 }
 
index 6fb624fb664bbab32511848765e54dccb566f77a..9b9f7240e781e4b0e8f3568c3b44b7b51158e722 100644 (file)
@@ -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 {
 
index 1c400bab2a57bece34d8627f1300bd62dbc4bd1d..dba9bff8084d5db712ea733e537cac6d9005bbe8 100644 (file)
  * 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();
        }
index db4a2568c7c7c55ce339326aedef92053c275c3b..6d63741947e715bb30ec2a8facf1e08a32e3e0e9 100644 (file)
@@ -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.*;
index 50460e215458056d897c3e7277f17c1f1db3e361..ec4f7609a1e3f1056e06abc80739061877fe18bb 100644 (file)
@@ -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);
index 642e742118dd6c2429c303c9971c422d199f3bb8..03ca9f80504bafa4b3b418bf43924a6b36686b14 100644 (file)
@@ -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.*;
 
index 4c9bdd1f908425dffc29496d68b173d9dae796cb..e5d444dd2099beadc728addd9fe0a4180d7b49c6 100644 (file)
@@ -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 {
index 338726887f76c06533d206ddd6c08008d6f83088..7566d9466bffc543ee01243c88d9c20ee9e6bfbc 100644 (file)
@@ -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);
        }
index b7489f77c64d4f4c7efe22a0f24fdac48ff484c2..8075b8a3274cf6f1706de1719661492c89532ed3 100644 (file)
  * 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) {
index 95cbbeed85cfe83128156cd64d3db08d55b81f7d..132b9e80f342f5d5a28eee1c6a2e431ba78959bd 100644 (file)
@@ -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));
index 50b9dcfcb71cf11e93091fe7b50d9d5bff255fa3..6e880914f36c36ea1ef1285ff0de14003daaf5c3 100644 (file)
@@ -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 {
index 7cca98b09acc39e46c9cf0091434c679541bbcb6..37883a1c47e838b19cf5e562eed21e220142edef 100644 (file)
@@ -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;
 
index 5e6cd5806ff7308e535305ec70edf34939c21458..f5cc01d07a5d1913ebad9d7629e6fdde4fe0d43f 100644 (file)
@@ -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;
index 7c385cfdc1084f61f02815c50e055b73106d3613..23b67af8b03e8a37ba82a172b28b0ae54625d874 100644 (file)
@@ -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;
index d419ab804d974ff71abb942abf4ac98b8e16d7b0..b623997195ad5a1fb4887f9566f8e81661eaa7ac 100644 (file)
@@ -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 {
index 59d34dbafb13e2080b1ee01f7b8b37b79be583f6..72d2f564e76130b6b57ed4600ca96614ed181883 100644 (file)
@@ -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 {
index 9ef7787e400475be3777fc4e1e7af9873f42f4c3..dbe70fe9e7066cd470d238a40e23e5fb92ae5283 100644 (file)
@@ -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) {
index b1cc009c12814f336bf56b9b3d86be1a460fc4ef..dfbad5fb21c7b431b85cdc9e91990afcf2ffb60e 100644 (file)
@@ -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);
index a744e61a185ed7c384eb812c023e0d20694a1740..a46c1a33f835df4ad04cecb7ca6e020c9b6052a1 100644 (file)
@@ -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 {
index 2231df13a1c8ec403aa87532ce1cdcb303ca2de5..9c38ba0aa3db0dd40fb5d782f2ead5d8838ccaf5 100644 (file)
@@ -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 {
 
index 47fc34886a20a2be529708a2abd11bac72d01b14..48474fa559864651b457c0bd1278395ccab74b0a 100644 (file)
@@ -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 {
index 08cd60651d2dc50eb8b30c23ba471c877dce5050..258678c7ccdb7af1a0b182b9ef70ead3dd85ad53 100644 (file)
@@ -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.*;
 
index f2d3f86877422afa79d8ff3b6b585f3e28047069..5f86d6713ca4a4f764c7cf2e461ec48286ec80f8 100644 (file)
@@ -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;
index 0236d29166b36a95373b6a9cba25d4707434b9b9..0eea8361b25b2d06f8370fbbad2e29ca1fda68d0 100644 (file)
@@ -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 {
index a484ef4ee52bfec3db92471294ab009ab7b1b288..ee9442d27a8e5ad458270591825f00d8b59a9c9b 100644 (file)
@@ -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 {
index 2a4b17a4811839fd5f88503a2bca43e86f105c30..234cda27ba36f44a6b90e35bfeb0cfbb9bafdf3b 100644 (file)
@@ -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 {
index 70179b2853fa06ba655d7a1e024efc5a794cb0a5..ade2494fec8a9c59d0d1362cf36e4265ab487b5e 100644 (file)
@@ -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 {
index e41242c5872d6953b6849dc665cd126b6191c2a2..d6d29b15254d15d4ac150459e07b37d43c382473 100644 (file)
@@ -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 {
index 75a66c1616612b7735605524d3ef495d9d0746f1..3c29020821d5d3305021b98e7f45e2d09c0aaa7d 100644 (file)
@@ -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 {
index f94789bb57adb08d936bf26ba9806eeeb199ca12..93d0ca504d5b642b21dbaf3a7a332ba31fcc2a7f 100644 (file)
@@ -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;
index 9835389b977a127a424c4563da13403efbdcdedb..5de16ab4528bf8761b3d1239b417405121e02a1b 100644 (file)
@@ -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;
index e0e92c13d5ba2218d17119b0241db34e58400da3..d1d9dd7ec8e78f257c0fd6ed8172e1b78183628d 100644 (file)
@@ -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;
index bd94740ff51a9725b4995cb0ba3de133456d6e9a..fde3d86d133de914a8c01ff49a9634e87ba78399 100644 (file)
@@ -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;
index f89e56c304b862ba8fc918337f39f77db0fb0df4..e1106440c352f43e7fe689bae7d6a6367fb3a7d3 100644 (file)
@@ -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 {
index fa86bf8ee83bcfd7eb1f533caa808af7290cb823..fbcc970c0e11504485195378b235dfe130ca72d2 100644 (file)
@@ -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;
index 2749eac09dfdbd08ffc538be1097e1247b821fec..0105fe539f6f992e4e5f8820cd6b748e6d2acc5d 100644 (file)
@@ -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 {
 
index b8b3254cc4e80394e6a996d51f622bf46b58ddda..ee74f916f373342f8d0f72664598f8d1fbe91d1f 100644 (file)
@@ -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 {
 
index 61a181a4da7853b9d9e80767ff8841b6fe381342..1e3ad6556888b4881c6a6bcbc32aa9066aa14ea0 100644 (file)
@@ -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);
index 87d4d8985297d73bd5954e617c0c3cdc7e9af6c3..62159bcc736d7501ab88f16f0f073767e0c5d408 100644 (file)
@@ -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 \
index d25736bf36da3d77134663a27ce6fe6d8d6744dc..07280b4ae1c5af8e776c6a288aef54b42294b8da 100644 (file)
@@ -20,7 +20,7 @@ package altosui;
 import java.awt.*;
 import libaltosJNI.*;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class Altos extends AltosUILib {
index 20474f527d8f8e9ea7db4b24a1bc8f08b30d1a5f..1d9af54679d4f637a82aadb7d32306eed069337d 100644 (file)
@@ -19,7 +19,7 @@ package altosui;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosAscent extends JComponent implements AltosFlightDisplay {
        GridBagLayout   layout;
@@ -179,7 +179,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
                void reset() {
                        value.setText("");
                        max_value.setText("");
-                       max = AltosRecord.MISSING;
+                       max = AltosLib.MISSING;
                }
 
                void set_font() {
@@ -189,12 +189,12 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
                }
 
                void show(AltosUnits units, double v) {
-                       if (v == AltosRecord.MISSING) {
+                       if (v == AltosLib.MISSING) {
                                value.setText("Missing");
                                max_value.setText("Missing");
                        } else {
                                value.setText(units.show(8, v));
-                               if (v > max || max == AltosRecord.MISSING) {
+                               if (v > max || max == AltosLib.MISSING) {
                                        max_value.setText(units.show(8, v));
                                        max = v;
                                }
@@ -308,7 +308,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
 
        class Lat extends AscentValue {
                void show (AltosState state, AltosListenerState listener_state) {
-                       if (state.gps != null && state.gps.connected && state.gps.lat != AltosRecord.MISSING)
+                       if (state.gps != null && state.gps.connected && state.gps.lat != AltosLib.MISSING)
                                show(pos(state.gps.lat,"N", "S"));
                        else
                                show("???");
@@ -322,7 +322,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
 
        class Lon extends AscentValue {
                void show (AltosState state, AltosListenerState listener_state) {
-                       if (state.gps != null && state.gps.connected && state.gps.lon != AltosRecord.MISSING)
+                       if (state.gps != null && state.gps.connected && state.gps.lon != AltosLib.MISSING)
                                show(pos(state.gps.lon,"E", "W"));
                        else
                                show("???");
@@ -365,11 +365,11 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
                        lon.hide();
                }
                height.show(state, listener_state);
-               if (state.main_voltage != AltosRecord.MISSING)
+               if (state.main_voltage != AltosLib.MISSING)
                        main.show(state, listener_state);
                else
                        main.hide();
-               if (state.apogee_voltage != AltosRecord.MISSING)
+               if (state.apogee_voltage != AltosLib.MISSING)
                        apogee.show(state, listener_state);
                else
                        apogee.hide();
index 1d42365ba858281e82ca43eb2914cd33a962a046..a1652ec4e0a6a893d53b96a4009fc20ea5f5c04b 100644 (file)
@@ -17,7 +17,7 @@
 
 package altosui;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosBTKnown implements Iterable<AltosBTDevice> {
index bcff393fd05a00bc40932d1fb5e9f0178eeaa482..7598eca00ffce570a58fcb30e8103228fb626e48 100644 (file)
@@ -19,7 +19,7 @@ package altosui;
 
 import java.io.*;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosCSV implements AltosWriter {
        File                    name;
@@ -222,7 +222,7 @@ public class AltosCSV implements AltosWriter {
        }
 
        void write_companion(AltosState state) {
-               AltosRecordCompanion companion = state.companion;
+               AltosCompanion companion = state.companion;
 
                int     channels_written = 0;
                if (companion == null) {
index 4b48bdf625f2bb1874e6989ee6ec4212ac9b7e5e..c41ea74b5190dba3a7c5868db374cfec20db9613 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosCSVUI
index 1ed2c425b4196acc6b5e9aaec53c10f7e18d6c26..1f446700218827c64ff1ff6673df8cf1654f2156 100644 (file)
@@ -19,7 +19,7 @@ package altosui;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosCompanionInfo extends JTable {
        private AltosFlightInfoTableModel model;
@@ -70,13 +70,13 @@ public class AltosCompanionInfo extends JTable {
                model.clear();
        }
 
-       AltosRecordCompanion    companion;
+       AltosCompanion  companion;
 
        public String board_name() {
                if (companion == null)
                        return "None";
                switch (companion.board_id) {
-               case AltosRecordCompanion.board_id_telescience:
+               case AltosCompanion.board_id_telescience:
                        return "TeleScience";
                default:
                        return String.format("%02x\n", companion.board_id);
index 4927d3f822e0ad9b73fc2cf6c1fab9c9137eb456..a6e6094fc1acbc21fb23dc5ca3de8e60ff612843 100644 (file)
@@ -22,7 +22,7 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.text.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosConfig implements ActionListener {
index c90b168f3359ff236f368d08564f0d97e83f6dcd..555af3b6b69ffdc8c12abd03f4dcbd8de98a384e 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 class AltosEditFreqUI extends AltosUIDialog implements ActionListener {
index 3cac56c3a576425f2d826c43bf9e3e91aebe21fc..2f5c199dbd5616c24f68c006c32ad3ea9857c7ea 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosConfigPyroUI
index 16c9e357134c58ded5f2a8e545c3f902781669ac..f879ff88bcdef1324db4714e8e16a7a0c9487cd1 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosConfigTD implements ActionListener {
index 125780a99f9813c723677080e4802c8b383eb36e..b5a6cd7c3fdd8ee6a355bb3d5daeea882722ac98 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosConfigTDUI
index 9723e6600141549237244cac29c878787df9ae1a..a6d27977cd5d41b211f6c1d511adf8e8287b2633 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosConfigUI
index af6c245b8a17b79a90f84463d313f9c526cd9a0d..0d0b0b0ac60c5a5d09a3968a4b1d64c6b5f83731 100644 (file)
@@ -20,7 +20,7 @@ package altosui;
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosDataChooser extends JFileChooser {
index e85717bbc37a5a3ec1fb11ee8384d11e5dd53c24..77776ff2ce3417d8b847874505dd1c8572228dc3 100644 (file)
@@ -19,7 +19,7 @@ package altosui;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosDescent extends JComponent implements AltosFlightDisplay {
        GridBagLayout   layout;
@@ -278,7 +278,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
 
        class Lat extends DescentValue {
                void show (AltosState state, AltosListenerState listener_state) {
-                       if (state.gps != null && state.gps.connected && state.gps.lat != AltosRecord.MISSING)
+                       if (state.gps != null && state.gps.connected && state.gps.lat != AltosLib.MISSING)
                                show(pos(state.gps.lat,"N", "S"));
                        else
                                show("???");
@@ -292,7 +292,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
 
        class Lon extends DescentValue {
                void show (AltosState state, AltosListenerState listener_state) {
-                       if (state.gps != null && state.gps.connected && state.gps.lon != AltosRecord.MISSING)
+                       if (state.gps != null && state.gps.connected && state.gps.lon != AltosLib.MISSING)
                                show(pos(state.gps.lon,"W", "E"));
                        else
                                show("???");
@@ -427,11 +427,11 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
                        lat.hide();
                        lon.hide();
                }
-               if (state.main_voltage != AltosRecord.MISSING)
+               if (state.main_voltage != AltosLib.MISSING)
                        main.show(state, listener_state);
                else
                        main.hide();
-               if (state.apogee_voltage != AltosRecord.MISSING)
+               if (state.apogee_voltage != AltosLib.MISSING)
                        apogee.show(state, listener_state);
                else
                        apogee.hide();
index c894c2d0e4eaea07f3c800a824a1bc53c9b5c48a..37f6adf9051613ec0686b0564dacfc442e128024 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.*;
 import javax.swing.*;
 import java.io.*;
 import java.text.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosDisplayThread extends Thread {
 
index e81a35d1133fd0249581fced0298b2780f18dc0b..9984d1a2420d37fe247688ab0c735e853967b26b 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosEepromDelete implements Runnable {
        AltosEepromList         flights;
index 931b55fd087e1334b96a46a9e78eee293a18ce1a..c3bdd15968018d6ad052ac98c640034c5b73caf4 100644 (file)
@@ -23,7 +23,7 @@ import java.io.*;
 import java.util.*;
 import java.text.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosEepromDownload implements Runnable {
 
@@ -61,9 +61,9 @@ public class AltosEepromDownload implements Runnable {
                        AltosGPS                gps = state.gps;
 
                        if (gps != null &&
-                           gps.year != AltosRecord.MISSING &&
-                           gps.month != AltosRecord.MISSING &&
-                           gps.day != AltosRecord.MISSING)
+                           gps.year != AltosLib.MISSING &&
+                           gps.month != AltosLib.MISSING &&
+                           gps.day != AltosLib.MISSING)
                        {
                                eeprom_name = new AltosFile(gps.year, gps.month, gps.day,
                                                            state.serial, state.flight, "eeprom");
index a63d173de36f275dc69bdf3b7b326cbd95e7c39d..258c421a5b4b67c3e7d9f6e8755ab910115af0fd 100644 (file)
@@ -21,7 +21,7 @@ import java.io.*;
 import java.util.*;
 import java.text.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 /*
  * Temporary structure to hold the list of stored flights;
index 7a7211960b02545b197b238ebb9229a4c20f2df4..b2d8a130fba1bbe11db4c1ec0a349c726e7e4e34 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosEepromManage implements ActionListener {
index a451aa3afbbe8b88793f77675e15dc1ed8b1cbe9..8f86eebff55436ec04e8cf7bfbb4349af0b2bf07 100644 (file)
@@ -21,7 +21,7 @@ import javax.swing.*;
 import javax.swing.border.*;
 import java.awt.*;
 import java.awt.event.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 class AltosEepromItem implements ActionListener {
index f4e522181b8f95419d0094f0881cb84a72b22f02..6eccface19815f29c00a2ef4ddd366d3545aee0e 100644 (file)
@@ -23,7 +23,7 @@ import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosFlashUI
index 4f4c158e8e08aad3105165ca36b5865cde53163a..289ddd01b66ac9a87bd4d351c638f38e2c59bfb3 100644 (file)
@@ -17,7 +17,7 @@
 
 package altosui;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public interface AltosFlightDisplay {
        void reset();
index f278012fdc867b71b8b9aa1c2b8b77263059d771..11a3f1a95614029008db612121b670a1919263d9 100644 (file)
@@ -18,7 +18,7 @@
 package altosui;
 
 import java.io.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosFlightStats {
        double          max_height;
@@ -77,7 +77,7 @@ public class AltosFlightStats {
        }
 
        double boost_time(AltosStateIterable states) {
-               double boost_time = AltosRecord.MISSING;
+               double boost_time = AltosLib.MISSING;
                AltosState      state = null;
 
                for (AltosState s : states) {
@@ -90,7 +90,7 @@ public class AltosFlightStats {
                if (state == null)
                        return 0;
 
-               if (boost_time == AltosRecord.MISSING)
+               if (boost_time == AltosLib.MISSING)
                        boost_time = state.time;
                return boost_time;
        }
@@ -101,21 +101,21 @@ public class AltosFlightStats {
                double          end_time = 0;
                double          landed_time = landed_time(states);
 
-               year = month = day = AltosRecord.MISSING;
-               hour = minute = second = AltosRecord.MISSING;
-               serial = flight = AltosRecord.MISSING;
-               lat = lon = AltosRecord.MISSING;
+               year = month = day = AltosLib.MISSING;
+               hour = minute = second = AltosLib.MISSING;
+               serial = flight = AltosLib.MISSING;
+               lat = lon = AltosLib.MISSING;
                has_gps = false;
                has_other_adc = false;
                has_rssi = false;
                for (AltosState state : states) {
-                       if (serial == AltosRecord.MISSING && state.serial != AltosRecord.MISSING)
+                       if (serial == AltosLib.MISSING && state.serial != AltosLib.MISSING)
                                serial = state.serial;
-                       if (flight == AltosRecord.MISSING && state.flight != AltosRecord.MISSING)
+                       if (flight == AltosLib.MISSING && state.flight != AltosLib.MISSING)
                                flight = state.flight;
-                       if (state.battery_voltage != AltosRecord.MISSING)
+                       if (state.battery_voltage != AltosLib.MISSING)
                                has_other_adc = true;
-                       if (state.rssi != AltosRecord.MISSING)
+                       if (state.rssi != AltosLib.MISSING)
                                has_rssi = true;
                        end_time = state.time;
                        if (state.time >= boost_time && state.state < Altos.ao_flight_boost)
index b5a9268377014c24f81c9c7c070f593ee6215835..db875b3bb70fac4bc9cc10a8e14fedfa24725fe9 100644 (file)
@@ -19,7 +19,7 @@ package altosui;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosFlightStatsTable extends JComponent {
        GridBagLayout   layout;
@@ -76,15 +76,15 @@ public class AltosFlightStatsTable extends JComponent {
                int y = 0;
                new FlightStat(layout, y++, "Serial", String.format("%d", stats.serial));
                new FlightStat(layout, y++, "Flight", String.format("%d", stats.flight));
-               if (stats.year != AltosRecord.MISSING && stats.hour != AltosRecord.MISSING)
+               if (stats.year != AltosLib.MISSING && stats.hour != AltosLib.MISSING)
                        new FlightStat(layout, y++, "Date/Time",
                                       String.format("%04d-%02d-%02d", stats.year, stats.month, stats.day),
                                       String.format("%02d:%02d:%02d UTC", stats.hour, stats.minute, stats.second));
                else {
-                       if (stats.year != AltosRecord.MISSING)
+                       if (stats.year != AltosLib.MISSING)
                                new FlightStat(layout, y++, "Date",
                                               String.format("%04d-%02d-%02d", stats.year, stats.month, stats.day));
-                       if (stats.hour != AltosRecord.MISSING)
+                       if (stats.hour != AltosLib.MISSING)
                                new FlightStat(layout, y++, "Time",
                                               String.format("%02d:%02d:%02d UTC", stats.hour, stats.minute, stats.second));
                }
@@ -95,7 +95,7 @@ public class AltosFlightStatsTable extends JComponent {
                               String.format("%5.0f m/s", stats.max_speed),
                               String.format("%5.0f mph", AltosConvert.meters_to_mph(stats.max_speed)),
                               String.format("Mach %4.1f", AltosConvert.meters_to_mach(stats.max_speed)));
-               if (stats.max_acceleration != AltosRecord.MISSING) {
+               if (stats.max_acceleration != AltosLib.MISSING) {
                        new FlightStat(layout, y++, "Maximum boost acceleration",
                                       String.format("%5.0f m/s²", stats.max_acceleration),
                                       String.format("%5.0f ft/s²", AltosConvert.meters_to_feet(stats.max_acceleration)),
index 6383e5b9f35ac690aade799cc791981f520bdf74..9d575e4c8897ebb8c14e651ca94e5c64712348d7 100644 (file)
@@ -19,7 +19,7 @@ package altosui;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosFlightStatus extends JComponent implements AltosFlightDisplay {
        GridBagLayout   layout;
@@ -76,7 +76,7 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
 
        class Serial extends FlightValue {
                void show(AltosState state, AltosListenerState listener_state) {
-                       if (state.serial == AltosRecord.MISSING)
+                       if (state.serial == AltosLib.MISSING)
                                value.setText("none");
                        else
                                value.setText(String.format("%d", state.serial));
@@ -90,7 +90,7 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
 
        class Flight extends FlightValue {
                void show(AltosState state, AltosListenerState listener_state) {
-                       if (state.flight == AltosRecord.MISSING)
+                       if (state.flight == AltosLib.MISSING)
                                value.setText("none");
                        else
                                value.setText(String.format("%d", state.flight));
index 6a327841bf10553b63e8ecaab258a3af83394580..08154fdadd1cc76cd052dd4b52a04fe4ecebda70 100644 (file)
@@ -27,7 +27,7 @@ import java.util.*;
 import java.text.*;
 import java.util.prefs.*;
 import java.util.concurrent.LinkedBlockingQueue;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosFlightStatusTableModel extends AbstractTableModel {
        private String[] columnNames = {
index 962a08f7821d3b88df57130eebd4679983ef9d6e..7821a77709a90fd32b9f58621998334fd5ceb947 100644 (file)
@@ -18,7 +18,7 @@
 package altosui;
 
 import java.awt.event.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosFlightStatusUpdate implements ActionListener {
 
index 1c450ce3c8ef0dd9aadf472599f32a361b08dc39..c151177e73e1915fae355b66fc9939ff33507b56 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, AltosFontListener {
index 7464ac3ee5f244c67e7fec24ca535a2231ea8c5c..917ac364b7a09a8925e575172179fc1d641085c2 100644 (file)
@@ -18,7 +18,7 @@
 package altosui;
 
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosFreqList extends JComboBox {
index a73e3fd8ee2837e67df4e23e02ba86543afb6386..e6cd7bd840c301683e0720ee1c0fcd8446225489 100644 (file)
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 import org.jfree.ui.*;
index 85a19b00c4c61241a8236756b7f12d479548329d..d8191f5d35199ab378188c5e071885031db2d47e 100644 (file)
@@ -18,7 +18,7 @@
 package altosui;
 
 import org.altusmetrum.altosuilib_1.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosGraphDataPoint implements AltosUIDataPoint {
 
@@ -49,7 +49,7 @@ public class AltosGraphDataPoint implements AltosUIDataPoint {
        }
 
        public double y(int index) throws AltosUIDataMissing {
-               double y = AltosRecord.MISSING;
+               double y = AltosLib.MISSING;
                switch (index) {
                case data_height:
                        y = state.height();
@@ -100,7 +100,7 @@ public class AltosGraphDataPoint implements AltosUIDataPoint {
                        y = state.pressure();
                        break;
                }
-               if (y == AltosRecord.MISSING)
+               if (y == AltosLib.MISSING)
                        throw new AltosUIDataMissing(index);
                return y;
        }
index 1e469c8a5c21bcc4c9c414266a64165c0758555c..4e6c46d1605a3d2bd840792a6cc447c4b10adae3 100644 (file)
@@ -20,7 +20,7 @@ package altosui;
 import java.lang.*;
 import java.io.*;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 class AltosGraphIterator implements Iterator<AltosUIDataPoint> {
@@ -34,7 +34,7 @@ class AltosGraphIterator implements Iterator<AltosUIDataPoint> {
        public AltosUIDataPoint next() {
                AltosState      state = iterator.next();
 
-               if (state.flight != AltosRecord.MISSING) {
+               if (state.flight != AltosLib.MISSING) {
                        if (dataSet.callsign == null && state.callsign != null)
                                dataSet.callsign = state.callsign;
 
index 376e99109569eb89acc0a2d98a85f96196dbb3ce..c42f7b5f89d4f346517fad948c5b3ec6a86229d4 100644 (file)
@@ -9,7 +9,7 @@ import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 import org.jfree.chart.ChartPanel;
index f6a91de872b5a8927d2c459d31682e2490277794..f4e16243cd4b05e1cbe66c8623a8dd7f1e5d05b2 100644 (file)
@@ -23,7 +23,7 @@ import javax.swing.*;
 import javax.swing.event.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDisplay, AltosFontListener, AltosIdleMonitorListener, DocumentListener {
index 14d4eebcbaf210013215e704ae3b7849613a2161..c8024aaedacf2773338179443abdd98b6c753008 100644 (file)
@@ -23,7 +23,7 @@ import javax.swing.*;
 import java.io.*;
 import java.text.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosIgniteUI
index cf4642bca2ac25eab0a94feabf5e0efa9cb448bc..d7871aa6b61bc3cc390bde0d9ad59926c8597d89 100644 (file)
@@ -20,7 +20,7 @@ package altosui;
 import java.awt.*;
 import javax.swing.*;
 import javax.swing.table.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosInfoTable extends JTable {
        private AltosFlightInfoTableModel model;
@@ -107,40 +107,44 @@ public class AltosInfoTable extends JTable {
        public void show(AltosState state, AltosListenerState listener_state) {
                info_reset();
                if (state != null) {
-                       if (state.altitude() != AltosRecord.MISSING)
+                       if (state.altitude() != AltosLib.MISSING)
                                info_add_row(0, "Altitude", "%6.0f    m", state.altitude());
-                       if (state.ground_altitude() != AltosRecord.MISSING)
+                       if (state.ground_altitude() != AltosLib.MISSING)
                                info_add_row(0, "Pad altitude", "%6.0f    m", state.ground_altitude());
-                       if (state.height() != AltosRecord.MISSING)
+                       if (state.height() != AltosLib.MISSING)
                                info_add_row(0, "Height", "%6.0f    m", state.height());
-                       if (state.max_height() != AltosRecord.MISSING)
+                       if (state.max_height() != AltosLib.MISSING)
                                info_add_row(0, "Max height", "%6.0f    m", state.max_height());
-                       if (state.acceleration() != AltosRecord.MISSING)
+                       if (state.acceleration() != AltosLib.MISSING)
                                info_add_row(0, "Acceleration", "%8.1f  m/s²", state.acceleration());
-                       if (state.max_acceleration() != AltosRecord.MISSING)
+                       if (state.max_acceleration() != AltosLib.MISSING)
                                info_add_row(0, "Max acceleration", "%8.1f  m/s²", state.max_acceleration());
-                       if (state.speed() != AltosRecord.MISSING)
+                       if (state.speed() != AltosLib.MISSING)
                                info_add_row(0, "Speed", "%8.1f  m/s", state.speed());
-                       if (state.max_speed() != AltosRecord.MISSING)
+                       if (state.max_speed() != AltosLib.MISSING)
                                info_add_row(0, "Max Speed", "%8.1f  m/s", state.max_speed());
-                       if (state.temperature != AltosRecord.MISSING)
+                       if (state.temperature != AltosLib.MISSING)
                                info_add_row(0, "Temperature", "%9.2f °C", state.temperature);
-                       if (state.battery_voltage != AltosRecord.MISSING)
+                       if (state.battery_voltage != AltosLib.MISSING)
                                info_add_row(0, "Battery", "%9.2f V", state.battery_voltage);
-                       if (state.apogee_voltage != AltosRecord.MISSING)
+                       if (state.apogee_voltage != AltosLib.MISSING)
                                info_add_row(0, "Drogue", "%9.2f V", state.apogee_voltage);
-                       if (state.main_voltage != AltosRecord.MISSING)
+                       if (state.main_voltage != AltosLib.MISSING)
                                info_add_row(0, "Main", "%9.2f V", state.main_voltage);
                }
                if (listener_state != null) {
                        info_add_row(0, "CRC Errors", "%6d", listener_state.crc_errors);
 
-                       if (listener_state.battery != AltosRecord.MISSING)
+                       if (listener_state.battery != AltosLib.MISSING)
                                info_add_row(0, "Receiver Battery", "%9.2f", listener_state.battery);
                }
 
                if (state != null) {
                        if (state.gps == null || !state.gps.connected) {
+                               if (state.gps == null)
+                                       System.out.printf ("null gps\n");
+                               else
+                                       System.out.printf ("not connected gps\n");
                                info_add_row(1, "GPS", "not available");
                        } else {
                                if (state.gps_ready)
@@ -155,13 +159,13 @@ public class AltosInfoTable extends JTable {
                                else
                                        info_add_row(1, "GPS", "  missing");
                                info_add_row(1, "Satellites", "%6d", state.gps.nsat);
-                               if (state.gps.lat != AltosRecord.MISSING)
+                               if (state.gps.lat != AltosLib.MISSING)
                                        info_add_deg(1, "Latitude", state.gps.lat, 'N', 'S');
-                               if (state.gps.lon != AltosRecord.MISSING)
+                               if (state.gps.lon != AltosLib.MISSING)
                                        info_add_deg(1, "Longitude", state.gps.lon, 'E', 'W');
-                               if (state.gps.alt != AltosRecord.MISSING)
+                               if (state.gps.alt != AltosLib.MISSING)
                                        info_add_row(1, "GPS altitude", "%8.1f", state.gps.alt);
-                               if (state.gps_height != AltosRecord.MISSING)
+                               if (state.gps_height != AltosLib.MISSING)
                                        info_add_row(1, "GPS height", "%8.1f", state.gps_height);
 
                                /* The SkyTraq GPS doesn't report these values */
@@ -199,12 +203,12 @@ public class AltosInfoTable extends JTable {
                                        info_add_deg(1, "Pad longitude", state.pad_lon, 'E', 'W');
                                        info_add_row(1, "Pad GPS alt", "%6.0f m", state.pad_alt);
                                }
-                               if (state.gps.year != AltosRecord.MISSING) 
+                               if (state.gps.year != AltosLib.MISSING) 
                                        info_add_row(1, "GPS date", "%04d-%02d-%02d",
                                                     state.gps.year,
                                                     state.gps.month,
                                                     state.gps.day);
-                               if (state.gps.hour != AltosRecord.MISSING)
+                               if (state.gps.hour != AltosLib.MISSING)
                                        info_add_row(1, "GPS time", "  %02d:%02d:%02d",
                                                     state.gps.hour,
                                                     state.gps.minute,
index 8679178f5af170c4c5b64bd7214a64727e655d12..fbb0ece41867319c95f15a3b5cf38fff9d2350f6 100644 (file)
@@ -18,7 +18,7 @@
 package altosui;
 
 import java.io.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosKML implements AltosWriter {
 
@@ -110,7 +110,7 @@ public class AltosKML implements AltosWriter {
                AltosGPS        gps = state.gps;
                double          altitude;
 
-               if (state.height() != AltosRecord.MISSING)
+               if (state.height() != AltosLib.MISSING)
                        altitude = state.height() + gps_start_altitude;
                else
                        altitude = gps.alt;
@@ -138,9 +138,9 @@ public class AltosKML implements AltosWriter {
                if (gps == null)
                        return;
 
-               if (gps.lat == AltosRecord.MISSING)
+               if (gps.lat == AltosLib.MISSING)
                        return;
-               if (gps.lon == AltosRecord.MISSING)
+               if (gps.lon == AltosLib.MISSING)
                        return;
                if (!started) {
                        start(state);
index 630527a04d601f66a31ba81913281aa0f5b3107e..139b81b636031ee4e74465f013b2d3ffe2b1faf0 100644 (file)
@@ -21,7 +21,7 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosLanded extends JComponent implements AltosFlightDisplay, ActionListener {
        GridBagLayout   layout;
@@ -104,7 +104,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
        class Lat extends LandedValue {
                void show (AltosState state, AltosListenerState listener_state) {
                        show();
-                       if (state.gps != null && state.gps.connected && state.gps.lat != AltosRecord.MISSING)
+                       if (state.gps != null && state.gps.connected && state.gps.lat != AltosLib.MISSING)
                                show(pos(state.gps.lat,"N", "S"));
                        else
                                show("???");
@@ -119,7 +119,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio
        class Lon extends LandedValue {
                void show (AltosState state, AltosListenerState listener_state) {
                        show();
-                       if (state.gps != null && state.gps.connected && state.gps.lon != AltosRecord.MISSING)
+                       if (state.gps != null && state.gps.connected && state.gps.lon != AltosLib.MISSING)
                                show(pos(state.gps.lon,"E", "W"));
                        else
                                show("???");
index e9c973deebcad58faae26e4f4a7b735a9fa877d5..b35bd23a8626f14032344b671dcd91575a385c1a 100644 (file)
@@ -19,7 +19,7 @@ package altosui;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosPad extends JComponent implements AltosFlightDisplay {
        GridBagLayout   layout;
@@ -176,7 +176,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        class Battery extends LaunchStatus {
                void show (AltosState state, AltosListenerState listener_state) {
-                       if (state == null || state.battery_voltage == AltosRecord.MISSING)
+                       if (state == null || state.battery_voltage == AltosLib.MISSING)
                                hide();
                        else {
                                show("%4.2f V", state.battery_voltage);
@@ -192,7 +192,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        class Apogee extends LaunchStatus {
                void show (AltosState state, AltosListenerState listener_state) {
-                       if (state == null || state.apogee_voltage == AltosRecord.MISSING)
+                       if (state == null || state.apogee_voltage == AltosLib.MISSING)
                                hide();
                        else {
                                show("%4.2f V", state.apogee_voltage);
@@ -208,7 +208,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        class Main extends LaunchStatus {
                void show (AltosState state, AltosListenerState listener_state) {
-                       if (state == null || state.main_voltage == AltosRecord.MISSING)
+                       if (state == null || state.main_voltage == AltosLib.MISSING)
                                hide();
                        else {
                                show("%4.2f V", state.main_voltage);
@@ -224,7 +224,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        class LoggingReady extends LaunchStatus {
                void show (AltosState state, AltosListenerState listener_state) {
-                       if (state == null || state.flight == AltosRecord.MISSING) {
+                       if (state == null || state.flight == AltosLib.MISSING) {
                                hide();
                        } else {
                                if (state.flight != 0) {
@@ -283,7 +283,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        class ReceiverBattery extends LaunchStatus {
                void show (AltosState state, AltosListenerState listener_state) {
-                       if (listener_state == null || listener_state.battery == AltosRecord.MISSING)
+                       if (listener_state == null || listener_state.battery == AltosLib.MISSING)
                                hide();
                        else {
                                show("%4.2f V", listener_state.battery);
@@ -310,11 +310,11 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        class PadLat extends LaunchValue {
                void show (AltosState state, AltosListenerState listener_state) {
-                       double lat = AltosRecord.MISSING;
+                       double lat = AltosLib.MISSING;
                        String label = null;
 
                        if (state != null) {
-                               if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.lat != AltosRecord.MISSING) {
+                               if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.lat != AltosLib.MISSING) {
                                        lat = state.gps.lat;
                                        label = "Latitude";
                                } else {
@@ -322,8 +322,8 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                                        label = "Pad Latitude";
                                }
                        }
-                       if (lat != AltosRecord.MISSING) {
-                               show(pos(lat,"E", "W"));
+                       if (lat != AltosLib.MISSING) {
+                               show(pos(lat,"N", "S"));
                                set_label(label);
                        } else
                                hide();
@@ -337,11 +337,11 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        class PadLon extends LaunchValue {
                void show (AltosState state, AltosListenerState listener_state) {
-                       double lon = AltosRecord.MISSING;
+                       double lon = AltosLib.MISSING;
                        String label = null;
 
                        if (state != null) {
-                               if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.lon != AltosRecord.MISSING) {
+                               if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.lon != AltosLib.MISSING) {
                                        lon = state.gps.lon;
                                        label = "Longitude";
                                } else {
@@ -349,7 +349,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                                        label = "Pad Longitude";
                                }
                        }
-                       if (lon != AltosRecord.MISSING) {
+                       if (lon != AltosLib.MISSING) {
                                show(pos(lon,"E", "W"));
                                set_label(label);
                        } else
@@ -364,11 +364,11 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
 
        class PadAlt extends LaunchValue {
                void show (AltosState state, AltosListenerState listener_state) {
-                       double alt = AltosRecord.MISSING;
+                       double alt = AltosLib.MISSING;
                        String label = null;
 
                        if (state != null) {
-                               if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.alt != AltosRecord.MISSING) {
+                               if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.alt != AltosLib.MISSING) {
                                        alt = state.gps.alt;
                                        label = "Altitude";
                                } else {
@@ -376,7 +376,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                                        label = "Pad Altitude";
                                }
                        }
-                       if (alt != AltosRecord.MISSING) {
+                       if (alt != AltosLib.MISSING) {
                                show("%4.0f m", state.gps.alt);
                                set_label(label);
                        } else
index 909e72a013af68eb735297f9de2cd73fd2d02a6e..6f9d9dc6eb034a64a1e00898dc945796a28debb2 100644 (file)
@@ -20,7 +20,7 @@ package altosui;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosRomconfigUI
index 224e1e616f716e357de7646a2ba86167d172c489..a5ccb15aac379a6d6cb82dc8a0a4850b8eb567f0 100644 (file)
@@ -25,7 +25,7 @@ import java.io.*;
 import java.util.*;
 import java.text.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 class AltosScanResult {
@@ -187,7 +187,7 @@ public class AltosScanUI
                                                AltosState      state = reader.read();
                                                if (state == null)
                                                        continue;
-                                               if (state.flight != AltosRecord.MISSING) {
+                                               if (state.flight != AltosLib.MISSING) {
                                                        final AltosScanResult   result = new AltosScanResult(state.callsign,
                                                                                                     state.serial,
                                                                                                     state.flight,
index e869f1ab1ac3688a9eaa6c964c6cd64729af2e0b..697ad539877f78bf19da5ff657c5805713e86024 100644 (file)
@@ -25,7 +25,7 @@ import java.io.*;
 import java.util.*;
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 import libaltosJNI.*;
index c092691926f72925b854b29993a6bd1c3400d31c..9491ce2be4b95c4ddf5f400beda942a23a1294bf 100644 (file)
@@ -23,7 +23,7 @@ import java.io.*;
 import java.lang.Math;
 import java.awt.geom.Point2D;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
@@ -287,10 +287,10 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
                        return;
 
                if (!initialised) {
-                       if (state.pad_lat != AltosRecord.MISSING && state.pad_lon != AltosRecord.MISSING) {
+                       if (state.pad_lat != AltosLib.MISSING && state.pad_lon != AltosLib.MISSING) {
                                initMaps(state.pad_lat, state.pad_lon);
                                initialised = true;
-                       } else if (gps.lat != AltosRecord.MISSING && gps.lon != AltosRecord.MISSING) {
+                       } else if (gps.lat != AltosLib.MISSING && gps.lon != AltosLib.MISSING) {
                                initMaps(gps.lat, gps.lon);
                                initialised = true;
                        } else {
index 365e4b6c3c36846a96e9fdc91ffed0fec6e072af..172e6397c6fe9875d193940932e6037c7f10e0f0 100644 (file)
@@ -22,7 +22,7 @@ import java.awt.image.*;
 import javax.swing.*;
 import java.awt.geom.Point2D;
 import java.awt.geom.Line2D;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosSiteMapTile extends JLayeredPane {
        JLabel mapLabel;
index 31d5a54d12e539cfc071151d6e8f7ded03d5ba68..9dad8718507dd384c07a59c5506fb4d8234b2cc4 100644 (file)
@@ -22,7 +22,7 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class AltosUI extends AltosUIFrame {
@@ -492,7 +492,7 @@ public class AltosUI extends AltosUIFrame {
                                          stats.max_speed,
                                          AltosConvert.meters_to_feet(stats.max_speed),
                                          AltosConvert.meters_to_mach(stats.max_speed));
-                       if (stats.max_acceleration != AltosRecord.MISSING) {
+                       if (stats.max_acceleration != AltosLib.MISSING) {
                                System.out.printf("Max accel:   %6.0f m/s² %6.0f ft/s² %6.2f g\n",
                                                  stats.max_acceleration,
                                                  AltosConvert.meters_to_feet(stats.max_acceleration),
index 0dac9fc74f3dc3dad4c222824eeb10b0fd1be77f..fb5f8520a2c5039d2f8eef6f31b88009ecb79299 100644 (file)
@@ -19,7 +19,7 @@ package altosui;
 
 import java.io.File;
 import java.util.prefs.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import javax.swing.filechooser.FileSystemView;
 
 public class AltosUIPreferencesBackend implements AltosPreferencesBackend {
index 8de11bc9a11e80b163be0766af5e6bbd8f2a8d5a..d664d6e825fe28c556a9b0725952f18fd8686b70 100644 (file)
@@ -17,7 +17,7 @@
 
 package altosui;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 
 public interface AltosWriter {
index 867b03841bb4100cfaf4298377cb55fd52a990e4..a38cba63e0f7913ce52e7cab49ca1cb4bb88d45e 100644 (file)
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 55486dea1214a064c5a1d013c2d639bd361fce71..84803c0e916770af06b0fc627e040806f826cfe5 100644 (file)
@@ -23,7 +23,7 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 5f3a2eef30a8064936f4abc763160cd4298124e6..ef0cc6772daa8e80e8f06d216ddfdabed136c5fe 100644 (file)
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 8f0ce8011d6595d7812d9b9888cfd8f2f7cc3fb1..d826072fee0eacd24c07e320a52663c2fbd7781d 100644 (file)
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 1b1214052f8f9598f46b8895456d6a3f95a23b76..9fcaf6d4d636979ef4272b1171ff0a982f75a758 100644 (file)
@@ -20,7 +20,7 @@ package org.altusmetrum.altosuilib_1;
 import java.awt.*;
 import libaltosJNI.*;
 
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosUILib extends AltosLib {
 
index 0949be6f94af3122ed0b31d2643eb16754b40c9f..e4262abd3c77c47818301bdae7e6cce3e07ad0a8 100644 (file)
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 49321bcec358500809bb9edd1ccfbd2f4871d71a..fc14f24b5a3417190ad4445d36f50cb861e386d8 100644 (file)
@@ -21,7 +21,7 @@ import java.io.*;
 import java.util.*;
 import java.awt.Component;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosUIPreferences extends AltosPreferences {
 
index 8a5386c3328c0dd0bd3e9c66f811cf2ad2b5801c..55da8d480c6af10fab511dcbb378e760b4d09b1f 100644 (file)
@@ -19,7 +19,7 @@ package org.altusmetrum.altosuilib_1;
 
 import java.io.File;
 import java.util.prefs.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import javax.swing.filechooser.FileSystemView;
 
 public class AltosUIPreferencesBackend implements AltosPreferencesBackend {
index ac09a3cc04c9b6541eb3d95e18684c0d7bca3013..ff430d1a1384820983d3c2cade3fe9364af71a57 100644 (file)
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
@@ -34,6 +34,20 @@ import org.jfree.chart.labels.*;
 import org.jfree.data.xy.*;
 import org.jfree.data.*;
 
+class AltosUITime extends AltosUnits {
+       public double value(double v) { return v; }
+       public String show_units() { return "s"; }
+       public String say_units() { return "seconds"; }
+
+       public int show_fraction(int width) {
+               if (width < 5)
+                       return 0;
+               return width - 5;
+       }
+
+       public int say_fraction() { return 0; }
+}
+
 public class AltosUISeries extends XYSeries implements AltosUIGrapher {
        AltosUIAxis     axis;
        String          label;
@@ -47,11 +61,12 @@ public class AltosUISeries extends XYSeries implements AltosUIGrapher {
                axis.set_units();
                StandardXYToolTipGenerator      ttg;
 
-               String  example = units.graph_format(4);
+               String  time_example = (new AltosUITime()).graph_format(7);
+               String  example = units.graph_format(7);
 
                ttg = new StandardXYToolTipGenerator(String.format("{1}s: {2}%s ({0})",
                                                                   units.show_units()),
-                                                    new java.text.DecimalFormat(example),
+                                                    new java.text.DecimalFormat(time_example),
                                                     new java.text.DecimalFormat(example));
                renderer.setBaseToolTipGenerator(ttg);
        }
index 4d0a2ef68119872a6376139b2cbf33a39e498a10..e88109f936c434d1eb5e342203ed030fdff2e306 100644 (file)
@@ -31,7 +31,7 @@ dnl ==========================================================================
 dnl Java library versions
 
 ALTOSUILIB_VERSION=1
-ALTOSLIB_VERSION=1
+ALTOSLIB_VERSION=2
 
 AC_SUBST(ALTOSLIB_VERSION)
 AC_DEFINE(ALTOSLIB_VERSION,$ALTOSLIB_VERSION,[Version of the AltosLib package])
index 4c0ed4c3312bf1de84e5a6947f5d1e1865e9837b..07806fa4bab465014f33cd7acfd41dabec606f2c 100644 (file)
@@ -20,7 +20,7 @@ package org.altusmetrum.micropeak;
 import java.lang.*;
 import java.io.*;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 class MicroIterator implements Iterator<MicroDataPoint> {
index bd6795f85f633fb8e573dac8eb02cbe3c444f472..a9095f9c6bc9ed5da1c5d21b9d9d5a4486f982d0 100644 (file)
@@ -23,7 +23,7 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class MicroDownload extends AltosUIDialog implements Runnable, ActionListener {
index 20a6f79a4cd2f5dde791f03ee116674b75283d49..5af767c6a92a3f5523285001ab649e1b67108497 100644 (file)
@@ -23,7 +23,7 @@ import java.util.ArrayList;
 import java.awt.*;
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class MicroExport extends JFileChooser {
index cdd42e667657d377334a5afe9ef309ab4ea78be9..2b02e20a5d0c9cb9dda54c53eb6243bcbf7da4c7 100644 (file)
@@ -19,7 +19,7 @@ package org.altusmetrum.micropeak;
 
 import java.io.*;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class MicroFile {
index d52eab2ccf830ead8d532f73ffcb0a7b1bb0e34f..3ca128ee97bfddc79cefd3f55ad77d2162b7b528 100644 (file)
@@ -20,7 +20,7 @@ package org.altusmetrum.micropeak;
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class MicroFileChooser extends JFileChooser {
index 50508a61b42cbcb0f46bf9fc45b685caba6c6e30..fba6290723a10449ab4a3e6119064c550407d6dc 100644 (file)
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 import org.jfree.ui.*;
index cb1c68cbba2eb7afbc55fe3580a0ff5bce1f5d2f..27a8db02a262845ba2fb2feb5c0f3f763a62ccb3 100644 (file)
@@ -23,7 +23,7 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class MicroPeak extends MicroFrame implements ActionListener, ItemListener {
index 7337a1dec58b38f6ccdb75c87e402c297ca31e74..0520fa7145da1edd9ef81bd4e6eef5042d1f0b68 100644 (file)
@@ -20,7 +20,7 @@ package org.altusmetrum.micropeak;
 import java.awt.*;
 import java.io.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class MicroRaw extends JTextArea {
index 99f621ce8aa18269c408c14010838257c09a131c..1f1ef3cb86df99e779a7fa87ab3ab45548272ad7 100644 (file)
@@ -24,7 +24,7 @@ import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class MicroSave extends JFileChooser {
index 99479cb4aeff3c69a1e69c71fdd2560608faad2a..32d944322caf76705fa3b31be602e4a9970d92e8 100644 (file)
@@ -18,7 +18,7 @@
 package org.altusmetrum.micropeak;
 
 import java.io.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class MicroStats {
index 145bb70ea6dd453ec9730beda5e0dde5615808b5..4400a317f193d78f1e6a17e439e7f1d0c427cdf9 100644 (file)
@@ -19,7 +19,7 @@ package org.altusmetrum.micropeak;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_1.*;
+import org.altusmetrum.altoslib_2.*;
 import org.altusmetrum.altosuilib_1.*;
 
 public class MicroStatsTable extends JComponent implements AltosFontListener {