Merge branch 'branch-1.9' into debian
authorBdale Garbee <bdale@gag.com>
Wed, 26 Feb 2020 06:58:18 +0000 (23:58 -0700)
committerBdale Garbee <bdale@gag.com>
Wed, 26 Feb 2020 06:58:18 +0000 (23:58 -0700)
388 files changed:
ChangeLog
Makefile.am
Releasing
altosdroid/Makefile.am
altosdroid/app/.gitignore [new file with mode: 0644]
altosdroid/app/build.gradle [deleted file]
altosdroid/app/build.gradle.in [new file with mode: 0644]
altosdroid/app/src/main/AndroidManifest.xml.in
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroidLink.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroidMapInterface.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroidPreferences.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroidPreferencesBackend.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroidTab.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosMapOffline.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosMapOnline.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosUsb.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosVoice.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/DeviceListActivity.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/GoNoGoLights.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/IdleModeActivity.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/IgniterActivity.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/ManageFrequenciesActivity.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/MapTypeActivity.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/PreloadMapActivity.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/SelectTrackerActivity.java [new file with mode: 0644]
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/SetupActivity.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TabFlight.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TabMap.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TabPad.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TabRecover.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TabsAdapter.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryLogger.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryReader.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryService.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryState.java
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/Tracker.java [new file with mode: 0644]
altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/makefile [new file with mode: 0644]
altosdroid/app/src/main/res/layout/device_name.xml
altosdroid/app/src/main/res/layout/idle_mode.xml
altosdroid/app/src/main/res/layout/setup.xml
altosdroid/app/src/main/res/layout/tab_flight.xml
altosdroid/app/src/main/res/layout/tab_layout.xml
altosdroid/app/src/main/res/layout/tab_map.xml
altosdroid/app/src/main/res/layout/tab_pad.xml
altosdroid/app/src/main/res/layout/tab_recover.xml
altosdroid/app/src/main/res/layout/tracker_ent.xml [new file with mode: 0644]
altosdroid/app/src/main/res/layout/tracker_list.xml [new file with mode: 0644]
altosdroid/app/src/main/res/values/CustomTheme.xml
altosdroid/app/src/main/res/values/strings.xml
altoslib/AltosAccel.java
altoslib/AltosAccelCal.java
altoslib/AltosAccelCalListener.java
altoslib/AltosAdxl375.java
altoslib/AltosCRCException.java
altoslib/AltosCSV.java
altoslib/AltosCalData.java
altoslib/AltosCompanion.java
altoslib/AltosConfigData.java
altoslib/AltosConfigDataException.java
altoslib/AltosConfigValues.java
altoslib/AltosConvert.java
altoslib/AltosDataListener.java
altoslib/AltosDataProvider.java
altoslib/AltosDebug.java
altoslib/AltosDistance.java
altoslib/AltosEeprom.java
altoslib/AltosEepromChunk.java
altoslib/AltosEepromDownload.java
altoslib/AltosEepromFile.java
altoslib/AltosEepromList.java
altoslib/AltosEepromLog.java
altoslib/AltosEepromMonitor.java
altoslib/AltosEepromRecord.java
altoslib/AltosEepromRecordFireTwo.java
altoslib/AltosEepromRecordFull.java
altoslib/AltosEepromRecordGps.java
altoslib/AltosEepromRecordMega.java
altoslib/AltosEepromRecordMetrum.java
altoslib/AltosEepromRecordMicroPeak2.java
altoslib/AltosEepromRecordMini.java
altoslib/AltosEepromRecordSet.java
altoslib/AltosEepromRecordTiny.java
altoslib/AltosFile.java
altoslib/AltosFilterListener.java
altoslib/AltosFlash.java
altoslib/AltosFlashListener.java
altoslib/AltosFlightDisplay.java
altoslib/AltosFlightReader.java
altoslib/AltosFlightSeries.java
altoslib/AltosFlightStats.java
altoslib/AltosFontListener.java
altoslib/AltosForce.java
altoslib/AltosFrequency.java
altoslib/AltosGPS.java
altoslib/AltosGPSSat.java
altoslib/AltosGPSTimeValue.java
altoslib/AltosGauss.java [new file with mode: 0644]
altoslib/AltosGreatCircle.java
altoslib/AltosHeight.java
altoslib/AltosHexfile.java
altoslib/AltosHexsym.java
altoslib/AltosIMU.java
altoslib/AltosIdle.java
altoslib/AltosIdleFetch.java
altoslib/AltosIdleMonitor.java
altoslib/AltosIdleMonitorListener.java
altoslib/AltosIdleReader.java
altoslib/AltosIgnite.java
altoslib/AltosImage.java
altoslib/AltosJson.java
altoslib/AltosKML.java
altoslib/AltosLatLon.java
altoslib/AltosLatitude.java
altoslib/AltosLaunchSite.java
altoslib/AltosLaunchSiteListener.java
altoslib/AltosLaunchSites.java
altoslib/AltosLib.java
altoslib/AltosLine.java
altoslib/AltosLink.java
altoslib/AltosListenerState.java
altoslib/AltosLocation.java
altoslib/AltosLog.java
altoslib/AltosLongitude.java
altoslib/AltosMag.java
altoslib/AltosMap.java
altoslib/AltosMapCache.java
altoslib/AltosMapCacheListener.java
altoslib/AltosMapInterface.java
altoslib/AltosMapLine.java
altoslib/AltosMapLoader.java
altoslib/AltosMapLoaderListener.java
altoslib/AltosMapMark.java
altoslib/AltosMapPath.java
altoslib/AltosMapPathPoint.java
altoslib/AltosMapRectangle.java
altoslib/AltosMapStore.java
altoslib/AltosMapStoreListener.java
altoslib/AltosMapTile.java
altoslib/AltosMapTileListener.java
altoslib/AltosMapTransform.java
altoslib/AltosMapTypeListener.java
altoslib/AltosMapZoomListener.java
altoslib/AltosMma655x.java
altoslib/AltosMs5607.java
altoslib/AltosNoSymbol.java
altoslib/AltosOrient.java
altoslib/AltosParse.java
altoslib/AltosPointDouble.java
altoslib/AltosPointInt.java
altoslib/AltosPreferences.java
altoslib/AltosPreferencesBackend.java
altoslib/AltosPresTemp.java
altoslib/AltosPressure.java
altoslib/AltosProgrammer.java
altoslib/AltosPyro.java
altoslib/AltosPyroName.java
altoslib/AltosQuaternion.java
altoslib/AltosRecordSet.java
altoslib/AltosRectangle.java
altoslib/AltosReplayReader.java
altoslib/AltosRomconfig.java
altoslib/AltosRotation.java
altoslib/AltosRotationRate.java
altoslib/AltosSavedState.java
altoslib/AltosSelfFlash.java
altoslib/AltosSensorEMini.java
altoslib/AltosSensorMM.java
altoslib/AltosSensorMega.java
altoslib/AltosSensorMetrum.java
altoslib/AltosSensorTGPS1.java
altoslib/AltosSensorTGPS2.java
altoslib/AltosSensorTM.java
altoslib/AltosSensorTMini2.java
altoslib/AltosSensorTMini3.java
altoslib/AltosSpeed.java
altoslib/AltosState.java
altoslib/AltosStateName.java
altoslib/AltosStringInputStream.java
altoslib/AltosTelemetry.java
altoslib/AltosTelemetryCompanion.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/AltosTelemetryMini2.java
altoslib/AltosTelemetryMini3.java
altoslib/AltosTelemetryRaw.java
altoslib/AltosTelemetryReader.java
altoslib/AltosTelemetrySatellite.java
altoslib/AltosTelemetrySensor.java
altoslib/AltosTelemetryStandard.java
altoslib/AltosTemperature.java
altoslib/AltosTime.java
altoslib/AltosTimeSeries.java
altoslib/AltosTimeValue.java
altoslib/AltosUnitInfo.java
altoslib/AltosUnitInfoListener.java
altoslib/AltosUnits.java
altoslib/AltosUnitsListener.java
altoslib/AltosUnitsRange.java
altoslib/AltosUnknownProduct.java
altoslib/AltosUsbId.java
altoslib/AltosVersion.java.in
altoslib/AltosVoltage.java
altoslib/AltosWriter.java
altoslib/Makefile.am
altosui/Altos.java
altosui/AltosAscent.java
altosui/AltosCompanionInfo.java
altosui/AltosConfigFC.java
altosui/AltosConfigFCUI.java
altosui/AltosConfigPyroUI.java
altosui/AltosConfigTD.java
altosui/AltosConfigTDUI.java
altosui/AltosConfigureUI.java
altosui/AltosDescent.java
altosui/AltosFlightStatus.java
altosui/AltosFlightStatusTableModel.java
altosui/AltosFlightStatusUpdate.java
altosui/AltosFlightUI.java
altosui/AltosGraphUI.java
altosui/AltosIdleMonitorUI.java
altosui/AltosIgniteUI.java
altosui/AltosIgnitor.java
altosui/AltosLanded.java
altosui/AltosLaunch.java
altosui/AltosLaunchUI.java
altosui/AltosPad.java
altosui/AltosUI.java
altosui/Makefile.am
altosui/altos-windows.nsi.in
altosuilib/AltosBTDevice.java
altosuilib/AltosBTDeviceIterator.java
altosuilib/AltosBTKnown.java
altosuilib/AltosBTManage.java
altosuilib/AltosCSVUI.java
altosuilib/AltosConfigFreqUI.java
altosuilib/AltosDataChooser.java
altosuilib/AltosDevice.java
altosuilib/AltosDeviceDialog.java
altosuilib/AltosDeviceUIDialog.java
altosuilib/AltosDisplayThread.java
altosuilib/AltosEepromDelete.java
altosuilib/AltosEepromGrapher.java
altosuilib/AltosEepromManage.java
altosuilib/AltosEepromMonitorUI.java
altosuilib/AltosEepromSelect.java
altosuilib/AltosFlashUI.java
altosuilib/AltosFlightInfoTableModel.java
altosuilib/AltosFlightStatsTable.java
altosuilib/AltosGraph.java
altosuilib/AltosInfoTable.java
altosuilib/AltosLed.java
altosuilib/AltosLights.java
altosuilib/AltosPositionListener.java
altosuilib/AltosRomconfigUI.java
altosuilib/AltosScanUI.java
altosuilib/AltosSerial.java
altosuilib/AltosSerialInUseException.java
altosuilib/AltosShapeListener.java
altosuilib/AltosUIAccelCal.java
altosuilib/AltosUIAxis.java
altosuilib/AltosUIConfigure.java
altosuilib/AltosUIDataMissing.java
altosuilib/AltosUIDataPoint.java
altosuilib/AltosUIDataSet.java
altosuilib/AltosUIDialog.java
altosuilib/AltosUIEnable.java
altosuilib/AltosUIFlightSeries.java
altosuilib/AltosUIFlightTab.java
altosuilib/AltosUIFrame.java
altosuilib/AltosUIFreqList.java
altosuilib/AltosUIGraph.java
altosuilib/AltosUIGrapher.java
altosuilib/AltosUIImage.java
altosuilib/AltosUIIndicator.java
altosuilib/AltosUILib.java
altosuilib/AltosUILineStyle.java
altosuilib/AltosUIListener.java
altosuilib/AltosUIMap.java
altosuilib/AltosUIMapPreload.java
altosuilib/AltosUIMarker.java
altosuilib/AltosUIPreferences.java
altosuilib/AltosUIPreferencesBackend.java
altosuilib/AltosUIRateList.java
altosuilib/AltosUITelemetryList.java
altosuilib/AltosUITimeSeries.java
altosuilib/AltosUIUnitsIndicator.java
altosuilib/AltosUIVoltageIndicator.java
altosuilib/AltosUSBDevice.java
altosuilib/AltosVoice.java
altosuilib/OSXAdapter.java
ao-bringup/test-telemega
ao-bringup/test-telemega-v3.0 [new file with mode: 0755]
ao-bringup/turnon_telemega
ao-bringup/turnon_telemega_v3.0 [new file with mode: 0755]
ao-tools/ao-eeprom/ao-eeprom.c
ao-tools/ao-telem/ao-telem.c
ao-tools/lib/ao-eeprom-read.h
ao-tools/lib/cc-telemetry.h
configure.ac
doc/Makefile.am
doc/RELNOTES
doc/altusmetrum-theme.yml
doc/altusmetrum.txt
doc/easymega.inc
doc/easymini-device.inc
doc/easymini.txt
doc/micropeak.txt
doc/release-notes-1.9.2.inc [new file with mode: 0644]
doc/release-notes.inc
doc/specs.inc
doc/telegps.txt
doc/telelaunch.txt
doc/telemega.inc
doc/telemetrum.inc
doc/telemetry.txt
doc/telemini.inc
doc/usage.inc
libaltos/libaltos_common.c
libaltos/libaltos_posix.c
libaltos/libaltos_private.h
libaltos/libaltos_windows.c
map-server/altos-mapd/AltosMapd.java
map-server/altos-mapd/AltosMapdClient.java
map-server/altos-mapd/AltosMapdPreferences.java
map-server/altos-mapj/AltosMap.java
micropeak/MicroData.java
micropeak/MicroDeviceDialog.java
micropeak/MicroDownload.java
micropeak/MicroExport.java
micropeak/MicroFile.java
micropeak/MicroFileChooser.java
micropeak/MicroFrame.java
micropeak/MicroPeak.java
micropeak/MicroRaw.java
micropeak/MicroSave.java
micropeak/MicroSerial.java
micropeak/MicroSerialLog.java
micropeak/MicroUSB.java
src/Makefile
src/drivers/ao_bmx160.c
src/drivers/ao_bmx160.h
src/drivers/ao_btm.c
src/drivers/ao_lco.c
src/drivers/ao_lco.h
src/drivers/ao_lco_bits.c
src/drivers/ao_lco_cmd.c
src/drivers/ao_lco_func.c
src/drivers/ao_pad.c
src/kernel/ao_boot.h
src/kernel/ao_data.h
src/kernel/ao_log.h
src/kernel/ao_log_mega.c
src/kernel/ao_telemetry.c
src/kernel/ao_telemetry.h
src/lpc/ao_boot_pin.c
src/lpc/ao_interrupt.c
src/stm/ao_boot_pin.c
src/stm/ao_interrupt.c
src/stmf0/ao_boot_pin.c
src/stmf0/ao_interrupt.c
src/telelco-v2.0/ao_lco_v2.c
src/telemega-v4.0/.gitignore [new file with mode: 0644]
src/telemega-v4.0/Makefile [new file with mode: 0644]
src/telemega-v4.0/ao_pins.h [new file with mode: 0644]
src/telemega-v4.0/ao_telemega.c [new file with mode: 0644]
src/telemega-v4.0/flash-loader/Makefile [new file with mode: 0644]
src/telemega-v4.0/flash-loader/ao_pins.h [new file with mode: 0644]
src/telemini-v3.0/ao_pins.h
src/telemini-v3.0/ao_telemini.c
telegps/TeleGPS.java
telegps/TeleGPSConfig.java
telegps/TeleGPSConfigUI.java
telegps/TeleGPSDisplayThread.java
telegps/TeleGPSGraphUI.java
telegps/TeleGPSInfo.java
telegps/TeleGPSPreferences.java
telegps/TeleGPSState.java
telegps/TeleGPSStatus.java
telegps/TeleGPSStatusUpdate.java

index b6749b6defb8f5d47933f318a2e93c0486510f0c..a246ee4ed605f6469a30a6a5735c3a99f9b147d5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,900 @@
+commit 28e77f3520095a1e47ab25721b186e42110ffd3e
+Merge: c6ea2666 91ab3acc
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Tue Feb 25 23:57:31 2020 -0700
+
+    Merge branch 'master' into branch-1.9
+
+commit 91ab3acc113dc24e1ebce89875def646e590fb12
+Merge: 243a6b5e aae87fe9
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Tue Feb 25 23:55:29 2020 -0700
+
+    Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
+
+commit aae87fe9fa8d596fea6cc19d4701a7583255150f
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:08:58 2020 -0800
+
+    Bump version to 1.9.2, android 27
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ec46adee44ea08120b1940ca55a5fbdf56874bb1
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:07:15 2020 -0800
+
+    Bump java lib versions in preparation for 1.9.2
+    
+    Quite a few changes; let's bump the version so we don't end up with
+    the wrong version on some machine.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 45f7b91ea126f8f9e607a8ee53df655d992590f2
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 22:51:54 2020 -0800
+
+    libaltos: Create altos_pause_one_second API
+    
+    This is to wait for the reading thread to stop using the file object
+    while cleaning up.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 243a6b5ee60989ec4c04b8a7638907d2517d4926
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Tue Feb 25 23:18:11 2020 -0700
+
+    update copyright assertion in TeleLaunch manual
+
+commit c6ea266630b9eef7a80e267a4430d22d50954908
+Merge: 12d6b4dc 7d2b2bae
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Tue Feb 25 23:17:22 2020 -0700
+
+    Merge branch 'master' into branch-1.9
+
+commit 7d2b2bae8a7ed2e15040c58819c8e96215e8292b
+Merge: af8f0b58 0993f791
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Tue Feb 25 22:56:07 2020 -0700
+
+    Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
+
+commit cec4dea23b7b3cfe0f0a43c19b3118cc98cb9414
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 21:50:10 2020 -0800
+
+    altoslib: Remove debug printf from AltosIMU.java
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 0993f7913efb3bc217df6ed2b38b5f6ad018b95d
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:08:58 2020 -0800
+
+    Bump version to 1.9.2, android 27
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 76b288f8d02e0a48f04de9455a2dd0b77e48bd63
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:07:15 2020 -0800
+
+    Bump java lib versions in preparation for 1.9.2
+    
+    Quite a few changes; let's bump the version so we don't end up with
+    the wrong version on some machine.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit af8f0b5892e01bdcf9fa4ca86a4752a8294992a1
+Merge: 25c1ef61 65df207e
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Tue Feb 25 22:44:08 2020 -0700
+
+    Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
+
+commit 8011baae420bb96ec487bfb343a761af70dd980d
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:24:23 2020 -0800
+
+    Set doc version and date from package version and release date
+    
+    This is a bit less work than manually updating them.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 65df207e00545ccd380ff7a80933b2d223c1544b
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:08:58 2020 -0800
+
+    Bump version to 1.9.2, android 27
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit a74e4816b669346fac1c72cfc629d11e2ca5e336
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 21:42:29 2020 -0800
+
+    altoslib: Add TeleMega-v4 adxl375 config to AltosConfigData
+    
+    Needed for idle monitor to work correctly
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 528fdc4e03466430c8d81fc78c90d3c9e8465ca7
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:07:15 2020 -0800
+
+    Bump java lib versions in preparation for 1.9.2
+    
+    Quite a few changes; let's bump the version so we don't end up with
+    the wrong version on some machine.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 25c1ef61b9c791b8e55b7d0ebd948ece4ca954c7
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:08:58 2020 -0800
+
+    Bump version to 1.9.2, android 27
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 61d3064e7c4958036e241381aa4ab791582820f8
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:24:23 2020 -0800
+
+    Set doc version and date from package version and release date
+    
+    This is a bit less work than manually updating them.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 52149fd81df45f37f5097850795f290f463c43ef
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 17:07:15 2020 -0800
+
+    Bump java lib versions in preparation for 1.9.2
+    
+    Quite a few changes; let's bump the version so we don't end up with
+    the wrong version on some machine.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 9ad50b83eca7aea8c9e568a661fcdd98598d0c73
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 15:35:33 2020 -0800
+
+    altoslib: BMX160 driver now returns µT values for mag sensor
+    
+    These are converted on-board using calibration values provided with
+    the chip.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ff2dc6ea0e62f6534b5fb1b0ec2edd4702cf4a41
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 14:57:35 2020 -0800
+
+    altos/bmx160: Compute µT in bmx160 driver using trim data
+    
+    Instead of attempting to ship all of the trim data, compute µT
+    on-board. This means losing the raw sensor values.
+    
+    The compensate functions were taken from the bmm150 sample driver
+    provided by Bosch under the BSD 3 clause license.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 9aedcdcab2c24b804236a5b8f99da634cac7ba05
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 11:58:17 2020 -0800
+
+    altos/telemega-4.0: Fix signs of IMU pitch and mag across
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 0ab2332358eb0990cb55074001b675d390eae2ca
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 11:55:36 2020 -0800
+
+    altosuilib, altoslib: Add azimuth and compass to reports
+    
+    Here, azimuth means change in horizontal plane from launch.
+    Compass is reporting mag field strength in X/Y plane
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 97cb2a808ad8853cead2d9722b7258b1b62df7a4
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 11:54:11 2020 -0800
+
+    altoslib: Remove hard-coded accel scale for mega eeprom
+    
+    I don't know why this is using a hard-coded value which only matches
+    early TeleMega v1 boards.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit a4039a60bbe972fd022699d62ab06a8f1bc4af69
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 11:51:57 2020 -0800
+
+    altoslib: Correct sign of telemega v4 pitch
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 88cf92175a4524143349491a817c9037dd8c39ef
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Feb 25 11:57:21 2020 -0800
+
+    libaltos: Delay freeing serial device until not busy
+    
+    Just spins for a while waiting for reading thread to wake up and
+    return.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 017e7ed4d2eea2bbc01972a8dfe11babd42d5993
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Feb 23 16:43:23 2020 -0800
+
+    altoslib: Fix Tmega v4 eeprom parsing
+    
+    Mangled the source while hacking things somehow; both accel and gyro
+    corrupted.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit a5a8a4d8de49484a2edba62cc9b84377aa5415a6
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Feb 21 00:19:25 2020 -0800
+
+    altos/altoslib: BMX160 Y axis gyro direction is opposite from MPU
+    
+    Just need to flip the sign to make the values go the same direction.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 3db6d4698d05c5017565a25b9b5c0f538014bebe
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 20 23:43:01 2020 -0800
+
+    altos: Adjust comment about how the BMX160 is oriented
+    
+    Bdale promises to make them all the same.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 101d068b92031169e2b11350528be0833ff2f8ea
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 20 23:42:24 2020 -0800
+
+    ao-tools: Handle TeleMega v4.0 telemetry in ao-telem
+    
+    Same packet format as older telemega, but axes differ
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 6c68e96ef650b2a149064069e26a4dc3ac741d42
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 20 23:41:27 2020 -0800
+
+    altoslib: Correct IMU axes for telemetry data
+    
+    The telem data was assuming original TeleMega sensor orientation.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 88cb0f4a791e0867ccd279e6d244d94f0b1765e9
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 20 22:53:31 2020 -0800
+
+    altos: Init BMX160 more carefully
+    
+    Check accel and gyro power status after turning them on, waiting
+    for a while to see if they actually power up.
+    
+    Read more registers after configuring accel to try and get things
+    reset better.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+    
+    Oops.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 0ca9a7c6fc914c4b555c99863828861ec54fa01d
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 20 22:44:54 2020 -0800
+
+    ao-tools: Add TeleMega v4.0 to ao-eeprom
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 5e8de5a2cef200c1426674859967edc0fdd13663
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 20 22:35:54 2020 -0800
+
+    altoslib: Remove ADXL375 debug noise
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 67356ae163487e57e6d9c83cb2b7f71a69f8aa27
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 20 16:51:15 2020 -0800
+
+    altos: Get BMX160 initialized correctly
+    
+     1. Don't reboot at startup. This probably takes a lot longer
+        than 100ms.
+    
+     2. Power up acc and gyr before attempting to configure
+    
+     3. Clear data registers after setting acc range
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ee38b3bea20f1e3a73e67aea151f9fc6abdc8483
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 20 16:23:33 2020 -0800
+
+    altos: Copy BMX160 data to data ring
+    
+    Otherwise you get a lot of zero
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 58976653e5d4b8eff1781e69115c4b7e86db045a
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 20 16:12:43 2020 -0800
+
+    altos: Log BMX160 data when present
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 4b824da227f08e45f7a1a59661b8c0fe45068d60
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 19 14:30:50 2020 -0800
+
+    Bump version for new android upload
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 95fe82630797bae5a9a7ffacc871bbd00efe2d82
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 19 14:01:15 2020 -0800
+
+    altosuilib: Eliminate a couple java compiler warnings
+    
+    Were using new Integer(int), when just passing the int would
+    'auto-box' as necessary.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 76c5e6bf7ecc30ae77a9744a4af26dca3dc46254
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 13 16:00:43 2020 -0800
+
+    altosui: Add TeleMega v4.0 firmware to altosui packaged bits
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 3055f698e0426d7785843ea1668478375fd02642
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 13 15:59:25 2020 -0800
+
+    doc: updates for 1.9.2
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 8ac11767a1b8d3e2faf6f020f5161ed05b801070
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 13 15:39:08 2020 -0800
+
+    altoslib: Pass all flight records while reading telem file
+    
+    This makes sure we get complete GPS and setup information before
+    the flight starts.
+    
+    To make this work, have data skipped when building time series
+    instead, and have realtime replay fast-forward through the initial
+    data
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit da499044c9d66e42915e3f6429b6b86999b06c2c
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 13 15:38:34 2020 -0800
+
+    altosuilib: Put units on GPS altitude and height in info table
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 305e7852f764e6a06024a9d57b5766d2f8a056ee
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 13 15:36:57 2020 -0800
+
+    altoslib: Report raw baro height instead of kalman filtered value
+    
+    Report raw sensor values to the user during flight.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 5ff0442702ee41179341240b1bbf290be89e1718
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 13 15:06:45 2020 -0800
+
+    altoslib: Re-initialize cal data for eeprom record set
+    
+    Instead of leaving it uninitialized, restore the initial data from
+    the flight log.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 58e7fccc24f933fd64e272207f783ca79002b7ba
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 13 15:04:40 2020 -0800
+
+    altoslib: Report whether GPS data contains new location/sat info
+    
+    Use this to limit time series additions to fresh data.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit f2e45e4b1351ce505b9294d5dc25429ab9721e62
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 13 15:00:55 2020 -0800
+
+    altoslib: Move 'state_name' API to AltosCalData
+    
+    That's where state lives.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit f400b8dd98680e47645d43940bcff5c0c99bb9e9
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Thu Feb 13 12:15:01 2020 -0700
+
+    include TeleMega v4 in list of firmware included in fat build and LLC repo
+
+commit 06cf43cea9149f8c04c80785a613408454eab4f2
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 12 20:07:02 2020 -0800
+
+    altoslib: Add support for TeleMega v4
+    
+    TeleMega v4 has a new IMU chip, which required adding support for
+    multiple IMU types, including different scale factors for each mag
+    sensor axis.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit f51ad734dfccfa2d4b7515a94dc337eb2b2708a2
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 12 20:05:31 2020 -0800
+
+    altoslib: Store IMU accel ground data in converted values
+    
+    For some reason, this value was in sensor units.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit b2deef36f135b52ba2eea3042e9d1a1198d4a9ae
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 12 20:00:22 2020 -0800
+
+    altosuilib: Add fourth column to info table
+    
+    Holds IMU data and igniter voltages
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 4435843fc8eb06751dbb1ba00fb2856563963e5e
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 12 19:59:19 2020 -0800
+
+    altoslib: Add 'gauss' units for magnetic field strength
+    
+    Compute in gauss, but display in nT (G * 100000)
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ea4140a81dc4ec6e541512ed70861691b57c4904
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 12 13:00:18 2020 -0800
+
+    altos: Create new log format for TeleMega v4
+    
+    Has BMX160 instead of MPU9250
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 440292f53125d7da29b3b4e8caa2c94c557b8325
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 12 13:01:08 2020 -0800
+
+    altos: Add new telemetry packet format for TeleMega v4
+    
+    Bmx160 instead of MPU9250 changes orientation of IMU data
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit cff5506e97314bf9b34d80a01cbdfcad22f3ce08
+Merge: e220b00d 803e260d
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Wed Feb 12 12:55:04 2020 -0700
+
+    Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
+
+commit e220b00d5c3af42dd840dbd34fba264e11046fc6
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Wed Feb 12 12:54:38 2020 -0700
+
+    update TeleMega production scripts for v4.0
+
+commit 803e260dcf9beba5684c4dcdda14255d76b2e551
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 12 11:53:25 2020 -0800
+
+    altos: Fix wiring mistakes for TeleMega v4.0
+    
+    Enable SPI 1 on PB3 PB4 PB5 (just sets output pin config)
+    Disable I2C (we're not using)
+    Fix Pyro channel C port (port D, not port B)
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit e64b1bc108bd75bcd6271631e48abde84af4631f
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 12 11:37:05 2020 -0800
+
+    altoslib: Reset consecutive GPS count when GPS bad
+    
+    This makes sure we get back to 'GPS not ready' when GPS goes unlocked.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ae38a6b5c6cb6c7d89b3237623a890e5101e282b
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Feb 10 14:25:55 2020 -0800
+
+    altosdroid: Change layout of idle mode dialog a bit
+    
+    Stick 'callsign:' label and callsign on same line. Save a bit of vertical space.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ddd0c7b57aca8fe7e68c0b8dae21ba79e163db15
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Feb 10 14:25:26 2020 -0800
+
+    altosdroid: Make frequency changes during idle mode work
+    
+    Otherwise, we'd end up sending a freq change over the link, which
+    would do 'bad things'.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 9697da4767bceb07c4ec070e1537ff4f91a74a87
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Feb 10 13:55:37 2020 -0800
+
+    altosdroid: Use select tracker dialog when deleting a tracker
+    
+    Remove custom delete tracker dialog code.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 0b7b31793dc91a25d215c216e8db481d549e66ad
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Feb 8 23:59:44 2020 -0800
+
+    Bump version to build a new android app (25)
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 1df1efc7a022597287722dc3a34d3a678fde6d3b
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Feb 8 23:55:58 2020 -0800
+
+    altosdroid: When the user switches frequency, look for something there
+    
+    Instead of sticking with the original tracker serial, when the user
+    selects a new frequency, check to see if some data appears there and
+    switch to that tracker.
+    
+    Only do this once, and stop looking if the user selects a tracker.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit a88989faebdc3a4b5198c4150096e6f626d76a96
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Feb 8 23:09:50 2020 -0800
+
+    altosui: Set idle mode frequency before starting link
+    
+    This makes sure the link doesn't try to start at the wrong frequency.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 96bdc1585d89e09381bd164dfb2ea41e8257df26
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Feb 8 20:46:19 2020 -0800
+
+    altosdroid: Add helper 'makefile'
+    
+    This builds the app from deep inside the source tree.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 41ad298abe24cfef0a9db0259436b998a66e4208
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Feb 8 20:45:50 2020 -0800
+
+    altosdroid: Ignore 'build.gradle', which is built from a .in file
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 79f2677143f85a2807b8d4e297f3617aafbd34da
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Feb 8 20:44:10 2020 -0800
+
+    altosdroid: Change tracker selection dialog
+    
+    Create a table of trackers and allow sorting based on each column.
+    When a tracker is selected, the app will not change to another tracker
+    automatically.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 6e3c4493cfa8d92d96808d14d1c12abb35ecb442
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Feb 8 20:42:11 2020 -0800
+
+    altosdroid: Fix a pile of compile warnings
+    
+    This deletes code which doesn't do anything in API versions past 21 and
+    changes a few bits of code to use the newer supported way.
+    
+    No functional changes are intended...
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit a4fc7db3bc82d4a2222bcfc0cd33b298bc5d3430
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Feb 7 22:00:53 2020 -0800
+
+    altosdroid: Use custom dialog themes for all dialogs
+    
+    Instead of a mixture of custom application and standard dialog themes
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 953caffcb87f3aae5962ee2540eef9310c84d32d
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Feb 7 20:47:33 2020 -0800
+
+    Bump version to build a new android app (23)
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit d84a777f07c9a876acdcda44ebc9186ef226d896
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Feb 7 18:44:14 2020 -0800
+
+    altosdroid: Add text size selection
+    
+    Add a setup menu item to change the size of the text everywhere.
+    This involved re-doing the layout for most of the tabs.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 33be3363985ec4998c1ae09cab7969aebf775b60
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 6 23:32:24 2020 -0800
+
+    Bump version to build a new android app -- 1.9.1c
+    
+    This will suffice until we ship 1.9.2
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit d0891fbdcc13a61836462525edab776366f86a24
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 6 23:21:02 2020 -0800
+
+    altosdroid: Check if the telem service is running when bluetooth gets enabled
+    
+    Make sure we aren't trying to send a message when the telem service is
+    shut down and the pointer is null.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 5186c6f64b374404aeb88b64227a006a58634ab9
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 6 23:17:30 2020 -0800
+
+    altosdroid: Request fine location permission if not already granted
+    
+    This avoids crashing if we don't have access to fine position
+    information.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 273bae40dfabc3249acd4427d92abb2ed9fefa6c
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Feb 6 17:15:14 2020 -0800
+
+    altosdroid: Switch to NotificationCompat
+    
+    Instead of Notification, which doesn't appear to work on older android
+    releases.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit fc73795cd3ad95d8f177a2eb3792d8ed0c7c540f
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Feb 5 10:52:05 2020 -0800
+
+    Use 'must' instead of 'should' in reference to switch for pyro battery
+    
+    Make this consistent with docs for other boards.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ad947ec3f313bbd1295af5dc64f1af9ec09bfe27
+Merge: 5b1bd4f8 d8e9d152
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Wed Feb 5 11:48:13 2020 -0700
+
+    Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
+
+commit 5b1bd4f87f682c1956e173a27414ceb076b20ceb
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Wed Feb 5 11:46:36 2020 -0700
+
+    update info on using separate pyro batteries to encourage including a switch
+
+commit d8e9d1529cb744742cfd7d4f5e9f168d4d6dc498
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Jan 28 12:57:25 2020 -0800
+
+    Bump altosdroid version to 20, always build release apk
+    
+    Now that altosdroid doesn't need a maps key, we can always build the
+    release version. New version is 20 instead of 19 because I messed up
+    the upload and google play store is harsh.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 65169d0b33ce6651508127a5ca45b6de27616352
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Jan 28 12:56:27 2020 -0800
+
+    Force using opensdk-8 to build altosdroid
+    
+    Current gradlew doesn't run on newer java
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit db786c24510d2df8f5a5d3ec0931deaa252469ad
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Jan 28 12:55:47 2020 -0800
+
+    Generate altosdroid/app/build.gradle at configure time
+    
+    This file includes the release version numbers, which are set in
+    configure.ac.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ffbf340c516a7fff7c95b808586f623269fe4338
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Jan 23 17:40:30 2020 -0800
+
+    altos: Always start application if boot pin isn't in use
+    
+    When there's no 'force boot loader' pin, jump to the application
+    instead of stopping in the boot loader.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ee009332a17557076f4c9348a31658f5bf605240
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Jan 23 17:31:13 2020 -0800
+
+    altos: Disable ao_btm debug. Avoids breaking 's' command
+    
+    The 's' command is used by altoslib to get the RSSI value during
+    monitor idle operations. Let's avoid breaking that.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ced64381edf2478cd080a340a0f88b3d98a1b13d
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Jan 23 14:34:14 2020 -0800
+
+    altos: TeleMini beeper is on Tim2 CH4, not Tim3 CH4
+    
+    This makes the beeper work.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 539598ce53744f7d70dad482e8865d427fca2fa2
+Author: Keith Packard <keithp@keithp.com>
+Date:   Thu Jan 23 14:32:10 2020 -0800
+
+    altos: Make debug telemini firmware a bit easier to build
+    
+    To enable debugging, we need to stop using the SWD GPIO pins, which
+    are normally used to trigger boot-time firmware behavior -- SWDIO is
+    used to force entry to the boot loader while SWDCLK is used to force
+    default frequency and callsign.
+    
+    This patch makes it easy to edit ao_pins.h to disable the default
+    frequency option.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 54e98a498db0d7026ce16c3ad53bc60986c68253
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Jan 22 12:41:40 2020 -0800
+
+    altos: Use AO_TICK_TYPE/AO_TICK_SIGNED for lco/pad code
+    
+    Was using 16-bit types, which 'mostly' worked, except that the pad
+    code compared ao_time() with a 16-bit value when determining the radio
+    status. After the box was on for 10 minutes (timer wrapped), the RF
+    timeout check would always fail, so the red LED would be lit.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 366c1422f6d34c8f616dc95c2767d01c4f53f581
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Jan 6 00:18:25 2020 -0800
+
+    altos: Build TeleMega v4.0 bits
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit eae79e1429f1df53577f4ee78e8a0856a8ad5975
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Jan 6 00:16:15 2020 -0800
+
+    altos: Initial bits for TeleMega v4.0
+    
+    ADXL375 and BMX160 instead of MMA655x and MPU9250
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit c7031c5abbb56b99b067fb8705c8c32695c70e46
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Tue Dec 10 18:17:42 2019 -0700
+
+    doc: update copyright year in footers, note need to check this doc/RELNOTEs
+
+commit b7ce0474eb30c0fb7e08f26891eb40f208de6a96
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Mon Dec 9 03:51:02 2019 -0700
+
+    Releasing: add TeleMetrum v3.0 firmware to production list
+
+commit 5565bc256ccf1f32474d7080fe0f75ce4fad4dc1
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Thu Dec 5 23:16:34 2019 -0700
+
+    Releasing: capture notes from 1.9.1 release
+
+commit 12d6b4dc6ec0a18bb6b1e3dfddbb9d6f00f76f99
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Thu Dec 5 22:22:32 2019 -0700
+
+    update ChangeLog for 1.9.1 release
+
 commit fdf1dbd3d945f6f34f404ffbcb57781f4df23015
 Merge: 5b4da841 bfc4999c
 Author: Bdale Garbee <bdale@gag.com>
index fc6bbdaf4256ce669aa6fb9dd12f9e825948f7ea..a62d539a53651eecb03b7cfbf24bb23d57af7359 100644 (file)
@@ -61,6 +61,7 @@ fat_altos = \
        src/telemega-v1.0/telemega-v1.0-$(VERSION).ihx \
        src/telemega-v2.0/telemega-v2.0-$(VERSION).ihx \
        src/telemega-v3.0/telemega-v3.0-$(VERSION).ihx \
+       src/telemega-v4.0/telemega-v4.0-$(VERSION).ihx \
        src/telemetrum-v2.0/telemetrum-v2.0-$(VERSION).ihx
 
 keithp-fat: fat
index 613635ce4f1dc76c83e5baae9eda0c19e50ac9dd..4f649b6e79f2ea70bfe64a5b1dccb6dbb668efa5 100644 (file)
--- a/Releasing
+++ b/Releasing
@@ -60,6 +60,8 @@ These are Bdale's notes on how to do a release.
        - make sure that doc/*.txt have the right copyright year and the
          new release is included
        - make absolutely sure checked-out tree is "clean" 
+       - make absolutely sure any commits Keith might have pushed to branches
+         like debian are already pulled
 
         git log > ChangeLog
        git commit -a
@@ -109,10 +111,9 @@ These are Bdale's notes on how to do a release.
           src/teledongle-v3.0/{*.elf,*.ihx} \
           src/telegps-v1.0/{*.elf,*.ihx} \
           src/telegps-v2.0/{*.elf,*.ihx} \
-          src/telemega-v1.0/{*.elf,*.ihx} \
-          src/telemega-v2.0/{*.elf,*.ihx} \
-          src/telemega-v3.0/{*.elf,*.ihx} \
+          src/telemega-v[1-4].0/{*.elf,*.ihx} \
           src/telemetrum-v2.0/{*.elf,*.ihx} \
+          src/telemetrum-v3.0/{*.elf,*.ihx} \
           src/telemini-v3.0/{*.elf,*.ihx} \
           src/telelco-v2.0/{*.elf,*.ihx} \
           src/telefireeight-v1.0/{*.elf,*.ihx} \
@@ -128,10 +129,9 @@ These are Bdale's notes on how to do a release.
           src/teledongle-v3.0/flash-loader/*.elf \
           src/telegps-v1.0/flash-loader/*.elf \
           src/telegps-v2.0/flash-loader/{*.elf,*.bin} \
-          src/telemega-v1.0/flash-loader/*.elf \
-          src/telemega-v2.0/flash-loader/*.elf \
-          src/telemega-v3.0/flash-loader/*.elf \
+          src/telemega-v[1-4].0/flash-loader/*.elf \
           src/telemetrum-v2.0/flash-loader/*.elf \
+          src/telemetrum-v3.0/flash-loader/*.elf \
           src/telemini-v3.0/flash-loader/{*.elf,*.bin} \
           src/telelco-v2.0/flash-loader/*.elf \
           src/telefireeight-v1.0/flash-loader/*.elf \
index 3a4edde17044256d1833be3e85df8ccbc5a03d2e..7fb16404d776cc27a681ee6a87ed7bc183c2b92c 100644 (file)
@@ -40,7 +40,7 @@ DRAWABLES=\
     $(DRAWABLE_DIR)/greenled.png \
     $(DRAWABLE_DIR)/grayled.png
 
-GRADLEW=bash ./gradlew --no-daemon
+GRADLEW=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 bash ./gradlew --no-daemon
 
 LAYOUTS=$(LAYOUT_DIR)/*.xml
 MENUS=$(MENU_DIR)/*.xml
diff --git a/altosdroid/app/.gitignore b/altosdroid/app/.gitignore
new file mode 100644 (file)
index 0000000..4dd9642
--- /dev/null
@@ -0,0 +1 @@
+build.gradle
\ No newline at end of file
diff --git a/altosdroid/app/build.gradle b/altosdroid/app/build.gradle
deleted file mode 100644 (file)
index 1d97693..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-apply plugin: 'com.android.application'
-
-def keystorePropertiesFile = file(System.properties['user.home'] + "/altusmetrumllc/android_keystore.properties")
-def keystoreProperties = new Properties()
-keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
-
-android {
-    signingConfigs {
-        release {
-            storeFile file(System.properties['user.home'] + "/altusmetrumllc/android_keystore.jks")
-            storePassword keystoreProperties['storePassword']
-            keyAlias keystoreProperties['keyAlias']
-            keyPassword keystoreProperties['keyPassword']
-        }
-    }
-
-    compileSdkVersion 28
-    defaultConfig {
-        applicationId "org.altusmetrum.AltosDroid"
-        minSdkVersion 26
-        targetSdkVersion 28
-        versionCode 19
-        versionName "1.9.1rc1"
-    }
-    buildTypes {
-        release {
-            signingConfig signingConfigs.release
-            minifyEnabled false
-            debuggable false
-            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
-        }
-        debug {
-            debuggable true
-        }
-    }
-    lintOptions {
-        abortOnError false
-    }
-}
-
-dependencies {
-    implementation 'androidx.appcompat:appcompat:1.0.0'
-    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
-    implementation 'com.google.android.gms:play-services-maps:17.0.0'
-    implementation fileTree(dir: 'libs', include: ['*.jar'])
-}
-
diff --git a/altosdroid/app/build.gradle.in b/altosdroid/app/build.gradle.in
new file mode 100644 (file)
index 0000000..5dbd30e
--- /dev/null
@@ -0,0 +1,47 @@
+apply plugin: 'com.android.application'
+
+def keystorePropertiesFile = file(System.properties['user.home'] + "/altusmetrumllc/android_keystore.properties")
+def keystoreProperties = new Properties()
+keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
+
+android {
+    signingConfigs {
+        release {
+            storeFile file(System.properties['user.home'] + "/altusmetrumllc/android_keystore.jks")
+            storePassword keystoreProperties['storePassword']
+            keyAlias keystoreProperties['keyAlias']
+            keyPassword keystoreProperties['keyPassword']
+        }
+    }
+
+    compileSdkVersion 28
+    defaultConfig {
+        applicationId "org.altusmetrum.AltosDroid"
+        minSdkVersion 21
+        targetSdkVersion 28
+        versionCode @ANDROID_VERSION@
+        versionName "@VERSION@"
+    }
+    buildTypes {
+        release {
+            signingConfig signingConfigs.release
+            minifyEnabled false
+            debuggable false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+        }
+        debug {
+            debuggable true
+        }
+    }
+    lintOptions {
+        abortOnError false
+    }
+}
+
+dependencies {
+    implementation 'androidx.appcompat:appcompat:1.0.0'
+    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+    implementation 'androidx.core:core:1.2.0'
+    implementation 'com.google.android.gms:play-services-maps:17.0.0'
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+}
index 69b5463b6a8bc874a7652c752d45dbb6acd256c3..efedddaf5555b4526bab4e615143a7b367579a13 100644 (file)
@@ -46,7 +46,7 @@
     <application android:label="@string/app_name"
                  android:icon="@drawable/app_icon"
                  android:allowBackup="true"
-                 android:theme="@style/CustomTheme">
+                 android:theme="@style/Medium">
 
         <activity android:name="org.altusmetrum.AltosDroid.AltosDroid"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.Dialog"
                   android:configChanges="orientation|keyboardHidden" />
 
+        <activity android:name=".SelectTrackerActivity"
+                  android:label="@string/select_tracker"
+                  android:theme="@android:style/Theme.Dialog"
+                  android:configChanges="orientation|keyboardHidden" />
+
         <activity android:name=".PreloadMapActivity"
                   android:label="@string/preload_maps"
                   android:theme="@android:style/Theme.Dialog"
index 2854836c44069fa3552d51e0dbb686bd9681cda2..e564e78478612742fe29eb5112bc16eb77f5c7a5 100644 (file)
@@ -21,6 +21,7 @@ package org.altusmetrum.AltosDroid;
 import java.lang.ref.WeakReference;
 import java.util.*;
 
+import android.Manifest;
 import android.app.Activity;
 import android.app.PendingIntent;
 import android.bluetooth.BluetoothAdapter;
@@ -35,6 +36,7 @@ import android.os.Handler;
 import android.os.Message;
 import android.os.Messenger;
 import android.os.RemoteException;
+import android.os.Parcelable;
 import androidx.fragment.app.FragmentActivity;
 import androidx.fragment.app.FragmentManager;
 import android.view.*;
@@ -44,8 +46,9 @@ import android.location.Location;
 import android.location.LocationManager;
 import android.location.LocationListener;
 import android.hardware.usb.*;
-
-import org.altusmetrum.altoslib_13.*;
+import android.content.pm.PackageManager;
+import androidx.core.app.ActivityCompat;
+import org.altusmetrum.altoslib_14.*;
 
 class SavedState {
        long    received_time;
@@ -70,76 +73,7 @@ class SavedState {
        }
 }
 
-class Tracker implements CharSequence, Comparable {
-       int     serial;
-       String  call;
-       double  frequency;
-
-       String  display;
-
-       public Tracker(int serial, String call, double frequency) {
-               if (call == null)
-                       call = "none";
-
-               this.serial = serial;
-               this.call = call;
-               this.frequency = frequency;
-               if (frequency == 0.0)
-                       display = "Auto";
-               else if (frequency == AltosLib.MISSING) {
-                       display = String.format("%-8.8s  %6d", call, serial);
-               } else {
-                       display = String.format("%-8.8s %7.3f %6d", call, frequency, serial);
-               }
-       }
-
-       public Tracker(AltosState s) {
-               this(s == null ? 0 : s.cal_data().serial,
-                    s == null ? null : s.cal_data().callsign,
-                    s == null ? 0.0 : s.frequency);
-       }
-
-       /* CharSequence */
-       public char charAt(int index) {
-               return display.charAt(index);
-       }
-
-       public int length() {
-               return display.length();
-       }
-
-       public CharSequence subSequence(int start, int end) throws IndexOutOfBoundsException {
-               return display.subSequence(start, end);
-       }
-
-       public String toString() {
-               return display.toString();
-       }
-
-       /* Comparable */
-       public int compareTo (Object other) {
-               Tracker o = (Tracker) other;
-               if (frequency == 0.0) {
-                       if (o.frequency == 0.0)
-                               return 0;
-                       return -1;
-               }
-               if (o.frequency == 0.0)
-                       return 1;
-
-               int     a = serial - o.serial;
-               int     b = call.compareTo(o.call);
-               int     c = (int) Math.signum(frequency - o.frequency);
-
-               if (b != 0)
-                       return b;
-               if (c != 0)
-                       return c;
-               return a;
-       }
-}
-
-public class AltosDroid extends FragmentActivity implements AltosUnitsListener, LocationListener {
+public class AltosDroid extends FragmentActivity implements AltosUnitsListener, LocationListener, ActivityCompat.OnRequestPermissionsResultCallback {
 
        // Actions sent to the telemetry server at startup time
 
@@ -160,16 +94,22 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
        public static final int REQUEST_IDLE_MODE      = 5;
        public static final int REQUEST_IGNITERS       = 6;
        public static final int REQUEST_SETUP          = 7;
+       public static final int REQUEST_SELECT_TRACKER = 8;
+       public static final int REQUEST_DELETE_TRACKER = 9;
 
        public static final String EXTRA_IDLE_MODE = "idle_mode";
        public static final String EXTRA_IDLE_RESULT = "idle_result";
+       public static final String EXTRA_FREQUENCY = "frequency";
        public static final String EXTRA_TELEMETRY_SERVICE = "telemetry_service";
+       public static final String EXTRA_TRACKERS = "trackers";
+       public static final String EXTRA_TRACKERS_TITLE = "trackers_title";
 
        // Setup result bits
        public static final int SETUP_BAUD = 1;
        public static final int SETUP_UNITS = 2;
        public static final int SETUP_MAP_SOURCE = 4;
        public static final int SETUP_MAP_TYPE = 8;
+       public static final int SETUP_FONT_SIZE = 16;
 
        public static FragmentManager   fm;
 
@@ -215,7 +155,6 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
        TelemetryState  telemetry_state;
        Tracker[]       trackers;
 
-
        UsbDevice       pending_usb_device;
        boolean         start_with_usb;
 
@@ -322,7 +261,7 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                case TelemetryState.CONNECT_CONNECTED:
                        if (telemetry_state.config != null) {
                                String str = String.format("S/N %d %6.3f MHz%s", telemetry_state.config.serial,
-                                                          telemetry_state.frequency, idle_mode ? " (idle)" : "");
+                                                          telemetry_state.frequency, telemetry_state.idle_mode ? " (idle)" : "");
                                if (telemetry_state.telemetry_rate != AltosLib.ao_telemetry_rate_38400)
                                        str = str.concat(String.format(" %d bps",
                                                                       AltosLib.ao_telemetry_rate_values[telemetry_state.telemetry_rate]));
@@ -360,7 +299,6 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
        }
 
        int     selected_serial = 0;
-       int     current_serial;
        long    switch_time;
 
        void set_switch_time() {
@@ -375,11 +313,29 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                if (new_telemetry_state != null)
                        telemetry_state = new_telemetry_state;
 
-               if (selected_serial != 0)
-                       current_serial = selected_serial;
+               if (selected_frequency != AltosLib.MISSING) {
+                       AltosState selected_state = telemetry_state.get(selected_serial);
+                       AltosState latest_state = telemetry_state.get(telemetry_state.latest_serial);
+
+                       if (selected_state != null && selected_state.frequency == selected_frequency) {
+                               selected_frequency = AltosLib.MISSING;
+                       } else if ((selected_state == null || selected_state.frequency != selected_frequency) &&
+                                  (latest_state != null && latest_state.frequency == selected_frequency))
+                       {
+                               selected_frequency = AltosLib.MISSING;
+                               selected_serial = telemetry_state.latest_serial;
+                       }
+               }
 
-               if (current_serial == 0)
-                       current_serial = telemetry_state.latest_serial;
+               if (!telemetry_state.containsKey(selected_serial)) {
+                       selected_serial = telemetry_state.latest_serial;
+                       AltosDebug.debug("selected serial set to %d", selected_serial);
+               }
+
+               int shown_serial = selected_serial;
+
+               if (telemetry_state.idle_mode)
+                       shown_serial = telemetry_state.latest_serial;
 
                if (!registered_units_listener) {
                        registered_units_listener = true;
@@ -387,7 +343,8 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                }
 
                int     num_trackers = 0;
-               for (AltosState s : telemetry_state.states.values()) {
+
+               for (AltosState s : telemetry_state.values()) {
                        num_trackers++;
                }
 
@@ -396,44 +353,17 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                int n = 0;
                trackers[n++] = new Tracker(0, "auto", 0.0);
 
-               for (AltosState s : telemetry_state.states.values())
+               for (AltosState s : telemetry_state.values())
                        trackers[n++] = new Tracker(s);
 
                Arrays.sort(trackers);
 
-               update_title(telemetry_state);
-
-               AltosState      state = null;
-               boolean         aged = true;
-
-               if (telemetry_state.states.containsKey(current_serial)) {
-                       state = telemetry_state.states.get(current_serial);
-                       int age = state_age(state.received_time);
-                       if (age < 20)
-                               aged = false;
-                       if (current_serial == selected_serial)
-                               aged = false;
-                       else if (switch_time != 0 && (switch_time - state.received_time) > 0)
-                               aged = true;
-               }
-
-               if (aged) {
-                       AltosState      newest_state = null;
-                       int             newest_age = 0;
-
-                       for (int serial : telemetry_state.states.keySet()) {
-                               AltosState      existing = telemetry_state.states.get(serial);
-                               int             existing_age = state_age(existing.received_time);
+               if (telemetry_state.frequency != AltosLib.MISSING)
+                       telem_frequency = telemetry_state.frequency;
 
-                               if (newest_state == null || existing_age < newest_age) {
-                                       newest_state = existing;
-                                       newest_age = existing_age;
-                               }
-                       }
+               update_title(telemetry_state);
 
-                       if (newest_state != null)
-                               state = newest_state;
-               }
+               AltosState      state = telemetry_state.get(shown_serial);
 
                update_ui(telemetry_state, state, telemetry_state.quiet);
 
@@ -474,6 +404,19 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        }
 
+       static String age_string(int age) {
+               String  text;
+               if (age < 60)
+                       text = String.format("%ds", age);
+               else if (age < 60 * 60)
+                       text = String.format("%dm", age / 60);
+               else if (age < 60 * 60 * 24)
+                       text = String.format("%dh", age / (60 * 60));
+               else
+                       text = String.format("%dd", age / (24 * 60 * 60));
+               return text;
+       }
+
        void update_age() {
                if (saved_state != null) {
                        int age = state_age(saved_state.received_time);
@@ -487,16 +430,7 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
 
                        set_screen_on(age);
 
-                       String  text;
-                       if (age < 60)
-                               text = String.format("%ds", age);
-                       else if (age < 60 * 60)
-                               text = String.format("%dm", age / 60);
-                       else if (age < 60 * 60 * 24)
-                               text = String.format("%dh", age / (60 * 60));
-                       else
-                               text = String.format("%dd", age / (24 * 60 * 60));
-                       mAgeView.setText(text);
+                       mAgeView.setText(age_string(age));
                }
        }
 
@@ -594,7 +528,6 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                for (AltosDroidTab mTab : mTabs)
                        mTab.update_ui(telem_state, state, from_receiver, location, mTab == mTabsAdapter.currentItem());
 
-               AltosDebug.debug("quiet %b\n", quiet);
                if (mAltosVoice != null && mTabsAdapter.currentItem() != null)
                        mAltosVoice.tell(telem_state, state, from_receiver, location, (AltosDroidTab) mTabsAdapter.currentItem(), quiet);
 
@@ -617,7 +550,7 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                }
                int deg = (int) Math.floor(p);
                double min = (p - Math.floor(p)) * 60.0;
-               return String.format("%d°%9.4f\" %s", deg, min, h);
+               return String.format("%d° %7.4f\" %s", deg, min, h);
        }
 
        static String number(String format, double value) {
@@ -640,14 +573,29 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                return tab_view;
        }
 
+       static public int[] themes = {
+               R.style.Small,
+               R.style.Medium,
+               R.style.Large,
+               R.style.Extra
+       };
+
+       static public int[] dialog_themes = {
+               R.style.Small_Dialog,
+               R.style.Medium_Dialog,
+               R.style.Large_Dialog,
+               R.style.Extra_Dialog
+       };
+
        @Override
        public void onCreate(Bundle savedInstanceState) {
+               // Initialise preferences
+               AltosDroidPreferences.init(this);
+               setTheme(themes[AltosDroidPreferences.font_size()]);
                super.onCreate(savedInstanceState);
                AltosDebug.init(this);
                AltosDebug.debug("+++ ON CREATE +++");
 
-               // Initialise preferences
-               AltosDroidPreferences.init(this);
 
                fm = getSupportFragmentManager();
 
@@ -682,7 +630,7 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                mStateView     = (TextView) findViewById(R.id.state_value);
                mAgeView       = (TextView) findViewById(R.id.age_value);
                mAgeNewColor   = mAgeView.getTextColors().getDefaultColor();
-               mAgeOldColor   = getResources().getColor(R.color.old_color);
+               mAgeOldColor   = getResources().getColor(R.color.old_color, getTheme());
        }
 
        private void ensureBluetooth() {
@@ -791,11 +739,7 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                noticeIntent(intent);
        }
 
-       @Override
-       public void onResume() {
-               super.onResume();
-               AltosDebug.debug("+ ON RESUME +");
-
+       private void enable_location_updates() {
                // Listen for GPS and Network position updates
                LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
                locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, this);
@@ -810,12 +754,81 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                update_ui(telemetry_state, state, true);
        }
 
+       static final int MY_PERMISSION_REQUEST = 1001;
+
+       public boolean have_location_permission = false;
+       public boolean have_storage_permission = false;
+       public boolean asked_permission = false;
+
+       AltosMapOnline map_online;
+
+       void
+       tell_map_permission(AltosMapOnline map_online) {
+               this.map_online = map_online;
+       }
+
+       @Override
+       public void onRequestPermissionsResult(int requestCode, String[] permissions,
+                                              int[] grantResults) {
+               if (requestCode == MY_PERMISSION_REQUEST) {
+                       for (int i = 0; i < grantResults.length; i++) {
+                               if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
+                                       if (permissions[i].equals(Manifest.permission.ACCESS_FINE_LOCATION)) {
+                                               have_location_permission = true;
+                                               enable_location_updates();
+                                               if (map_online != null)
+                                                       map_online.position_permission();
+                                       }
+                                       if (permissions[i].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
+                                               have_storage_permission = true;
+                                       }
+                               }
+                       }
+               }
+       }
+
+       @Override
+       public void onResume() {
+               super.onResume();
+               AltosDebug.debug("+ ON RESUME +");
+
+               if (!asked_permission) {
+                       asked_permission = true;
+                       if (ActivityCompat.checkSelfPermission(this,
+                                                             Manifest.permission.ACCESS_FINE_LOCATION)
+                           == PackageManager.PERMISSION_GRANTED)
+                       {
+                               have_location_permission = true;
+                       }
+                       if (ActivityCompat.checkSelfPermission(this,
+                                                              Manifest.permission.WRITE_EXTERNAL_STORAGE)
+                           == PackageManager.PERMISSION_GRANTED)
+                       {
+                               have_storage_permission = true;
+                       }
+                       int count = (have_location_permission ? 0 : 1) + (have_storage_permission ? 0 : 1);
+                       if (count > 0)
+                       {
+                               String[] permissions = new String[count];
+                               int i = 0;
+                               if (!have_location_permission)
+                                       permissions[i++] = Manifest.permission.ACCESS_FINE_LOCATION;
+                               if (!have_location_permission)
+                                       permissions[i++] = Manifest.permission.WRITE_EXTERNAL_STORAGE;
+                               ActivityCompat.requestPermissions(this, permissions, MY_PERMISSION_REQUEST);
+                       }
+               }
+               if (have_location_permission)
+                       enable_location_updates();
+       }
+
        @Override
        public void onPause() {
                super.onPause();
                AltosDebug.debug("- ON PAUSE -");
                // Stop listening for location updates
-               ((LocationManager) getSystemService(Context.LOCATION_SERVICE)).removeUpdates(this);
+               if (have_location_permission)
+                       ((LocationManager) getSystemService(Context.LOCATION_SERVICE)).removeUpdates(this);
        }
 
        @Override
@@ -838,7 +851,7 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
        }
 
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-               AltosDebug.debug("onActivityResult " + resultCode);
+               AltosDebug.debug("onActivityResult request %d result %d", requestCode, resultCode);
                switch (requestCode) {
                case REQUEST_CONNECT_DEVICE:
                        // When DeviceListActivity returns with a device to connect to
@@ -868,12 +881,22 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                        if (resultCode == Activity.RESULT_OK)
                                note_setup_changes(data);
                        break;
+               case REQUEST_SELECT_TRACKER:
+                       if (resultCode == Activity.RESULT_OK)
+                               select_tracker(data);
+                       break;
+               case REQUEST_DELETE_TRACKER:
+                       if (resultCode == Activity.RESULT_OK)
+                               delete_track(data);
+                       break;
                }
        }
 
        private void note_setup_changes(Intent data) {
                int changes = data.getIntExtra(SetupActivity.EXTRA_SETUP_CHANGES, 0);
 
+               AltosDebug.debug("note_setup_changes changes %d\n", changes);
+
                if ((changes & SETUP_BAUD) != 0) {
                        try {
                                mService.send(Message.obtain(null, TelemetryService.MSG_SETBAUD,
@@ -891,6 +914,11 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                        /* nothing to do here */
                }
                set_switch_time();
+               if ((changes & SETUP_FONT_SIZE) != 0) {
+                       AltosDebug.debug(" ==== Recreate to switch font sizes ==== ");
+                       finish();
+                       startActivity(getIntent());
+               }
        }
 
        private void connectUsb(UsbDevice device) {
@@ -908,10 +936,12 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
        }
 
        private void bluetoothEnabled(Intent data) {
-               try {
-                       mService.send(Message.obtain(null, TelemetryService.MSG_BLUETOOTH_ENABLED, null));
-               } catch (RemoteException e) {
-                       AltosDebug.debug("send BT enabled message failed");
+               if (mService != null) {
+                       try {
+                               mService.send(Message.obtain(null, TelemetryService.MSG_BLUETOOTH_ENABLED, null));
+                       } catch (RemoteException e) {
+                               AltosDebug.debug("send BT enabled message failed");
+                       }
                }
        }
 
@@ -978,7 +1008,12 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                return true;
        }
 
+       double telem_frequency = 434.550;
+       double selected_frequency = AltosLib.MISSING;
+
        void setFrequency(double freq) {
+               telem_frequency = freq;
+               selected_frequency = AltosLib.MISSING;
                try {
                        mService.send(Message.obtain(null, TelemetryService.MSG_SETFREQUENCY, freq));
                        set_switch_time();
@@ -1018,10 +1053,9 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                }
        }
 
-       void select_tracker(int serial) {
-               int i;
+       void select_tracker(int serial, double frequency) {
 
-               AltosDebug.debug("select tracker %d\n", serial);
+               AltosDebug.debug("select tracker %d %7.3f\n", serial, frequency);
 
                if (serial == selected_serial) {
                        AltosDebug.debug("%d already selected\n", serial);
@@ -1029,6 +1063,7 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                }
 
                if (serial != 0) {
+                       int i;
                        for (i = 0; i < trackers.length; i++)
                                if (trackers[i].serial == serial)
                                        break;
@@ -1037,35 +1072,18 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                                AltosDebug.debug("attempt to select unknown tracker %d\n", serial);
                                return;
                        }
+                       if (frequency != 0.0 && frequency != AltosLib.MISSING)
+                               setFrequency(frequency);
                }
 
-               current_serial = selected_serial = serial;
+               selected_serial = serial;
                update_state(null);
        }
 
-       void touch_trackers(Integer[] serials) {
-               AlertDialog.Builder builder_tracker = new AlertDialog.Builder(this);
-               builder_tracker.setTitle("Select Tracker");
-
-               final Tracker[] my_trackers = new Tracker[serials.length + 1];
-
-               my_trackers[0] = new Tracker(null);
-
-               for (int i = 0; i < serials.length; i++) {
-                       AltosState      s = telemetry_state.states.get(serials[i]);
-                       my_trackers[i+1] = new Tracker(s);
-               }
-               builder_tracker.setItems(my_trackers,
-                                        new DialogInterface.OnClickListener() {
-                                                public void onClick(DialogInterface dialog, int item) {
-                                                        if (item == 0)
-                                                                select_tracker(0);
-                                                        else
-                                                                select_tracker(my_trackers[item].serial);
-                                                }
-                                        });
-               AlertDialog alert_tracker = builder_tracker.create();
-               alert_tracker.show();
+       void select_tracker(Intent data) {
+               int serial = data.getIntExtra(SelectTrackerActivity.EXTRA_SERIAL_NUMBER, 0);
+               double frequency = data.getDoubleExtra(SelectTrackerActivity.EXTRA_FREQUENCY, 0.0);
+               select_tracker(serial, frequency);
        }
 
        void delete_track(int serial) {
@@ -1075,6 +1093,39 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                }
        }
 
+       void delete_track(Intent data) {
+               int serial = data.getIntExtra(SelectTrackerActivity.EXTRA_SERIAL_NUMBER, 0);
+               if (serial != 0)
+                       delete_track(serial);
+       }
+
+       void start_select_tracker(Tracker[] select_trackers, int title_id, int request) {
+               Intent intent = new Intent(this, SelectTrackerActivity.class);
+               AltosDebug.debug("put title id 0x%x %s", title_id, getResources().getString(title_id));
+               intent.putExtra(EXTRA_TRACKERS_TITLE, title_id);
+               if (select_trackers != null) {
+                       ArrayList<Tracker> tracker_array = new ArrayList<Tracker>(Arrays.asList(select_trackers));
+                       intent.putParcelableArrayListExtra(EXTRA_TRACKERS, tracker_array);
+               } else {
+                       intent.putExtra(EXTRA_TRACKERS, (Parcelable[]) null);
+               }
+               startActivityForResult(intent, request);
+       }
+
+       void start_select_tracker(Tracker[] select_trackers) {
+               start_select_tracker(select_trackers, R.string.select_tracker, REQUEST_SELECT_TRACKER);
+       }
+
+       void touch_trackers(Integer[] serials) {
+               Tracker[] my_trackers = new Tracker[serials.length];
+
+               for (int i = 0; i < serials.length; i++) {
+                       AltosState      s = telemetry_state.get(serials[i]);
+                       my_trackers[i] = new Tracker(s);
+               }
+               start_select_tracker(my_trackers);
+       }
+
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
                Intent serverIntent = null;
@@ -1108,56 +1159,28 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                                frequency_strings[i] = frequencies[i].toString();
 
                        AlertDialog.Builder builder_freq = new AlertDialog.Builder(this);
-                       builder_freq.setTitle("Pick a frequency");
+                       builder_freq.setTitle("Select Frequency");
                        builder_freq.setItems(frequency_strings,
                                         new DialogInterface.OnClickListener() {
                                                 public void onClick(DialogInterface dialog, int item) {
                                                         setFrequency(frequencies[item]);
+                                                        selected_frequency = frequencies[item].frequency;
                                                 }
                                         });
                        AlertDialog alert_freq = builder_freq.create();
                        alert_freq.show();
                        return true;
                case R.id.select_tracker:
-                       if (trackers != null) {
-                               AlertDialog.Builder builder_serial = new AlertDialog.Builder(this);
-                               builder_serial.setTitle("Select a tracker");
-                               builder_serial.setItems(trackers,
-                                                       new DialogInterface.OnClickListener() {
-                                                               public void onClick(DialogInterface dialog, int item) {
-                                                                       System.out.printf("select item %d %s\n", item, trackers[item].display);
-                                                                       if (item == 0)
-                                                                               select_tracker(0);
-                                                                       else
-                                                                               select_tracker(trackers[item].serial);
-                                                               }
-                                                       });
-                               AlertDialog alert_serial = builder_serial.create();
-                               alert_serial.show();
-
-                       }
+                       start_select_tracker(trackers);
                        return true;
                case R.id.delete_track:
-                       if (trackers != null) {
-                               AlertDialog.Builder builder_serial = new AlertDialog.Builder(this);
-                               builder_serial.setTitle("Delete a track");
-                               final Tracker[] my_trackers = new Tracker[trackers.length - 1];
-                               for (int i = 0; i < trackers.length - 1; i++)
-                                       my_trackers[i] = trackers[i+1];
-                               builder_serial.setItems(my_trackers,
-                                                       new DialogInterface.OnClickListener() {
-                                                               public void onClick(DialogInterface dialog, int item) {
-                                                                       delete_track(my_trackers[item].serial);
-                                                               }
-                                                       });
-                               AlertDialog alert_serial = builder_serial.create();
-                               alert_serial.show();
-
-                       }
+                       if (trackers != null && trackers.length > 0)
+                               start_select_tracker(trackers, R.string.delete_track, REQUEST_DELETE_TRACKER);
                        return true;
                case R.id.idle_mode:
                        serverIntent = new Intent(this, IdleModeActivity.class);
                        serverIntent.putExtra(EXTRA_IDLE_MODE, idle_mode);
+                       serverIntent.putExtra(EXTRA_FREQUENCY, telem_frequency);
                        startActivityForResult(serverIntent, REQUEST_IDLE_MODE);
                        return true;
                }
index 1e22e8ffbd0761a38bf0e6c843eb265893a0e83c..cbecee9025050d444f5b38cac5a6faf627937992 100644 (file)
@@ -20,7 +20,7 @@ package org.altusmetrum.AltosDroid;
 
 import android.os.Handler;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public abstract class AltosDroidLink extends AltosLink {
 
index b22849a0a6c60c4097dd7d9a5b042c0eb55118ec..e1f0275e4a2c21830dc61e67f5295527e7927ede 100644 (file)
@@ -19,7 +19,7 @@
 package org.altusmetrum.AltosDroid;
 
 import android.location.Location;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public interface AltosDroidMapInterface {
        public void onCreateView(AltosDroid altos_droid);
index 6ec9e4d19b867802c38af3b257989f2b55441b73..f49f11004a30c419da4b311abe36d110064bfce5 100644 (file)
@@ -20,7 +20,7 @@ package org.altusmetrum.AltosDroid;
 import java.util.*;
 
 import android.content.Context;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosDroidPreferences extends AltosPreferences {
 
@@ -28,6 +28,15 @@ public class AltosDroidPreferences extends AltosPreferences {
        final static String activeDeviceAddressPreference = "ACTIVE-DEVICE-ADDRESS";
        final static String activeDeviceNamePreference = "ACTIVE-DEVICE-NAME";
 
+       public static final int font_size_small = 0;
+       public static final int font_size_medium = 1;
+       public static final int font_size_large = 2;
+       public static final int font_size_extra = 3;
+
+       final static String fontSizePreference = "FONT-SIZE";
+
+       static int font_size = font_size_medium;
+
        static DeviceAddress    active_device_address;
 
        /* Map source preference name */
@@ -38,12 +47,19 @@ public class AltosDroidPreferences extends AltosPreferences {
 
        static int      map_source;
 
+       /* Tracker sort selection */
+       final static String trackerSortPreference = "TRACKER-SORT";
+
+       static int      tracker_sort;
+
        public static void init(Context context) {
                if (backend != null)
                        return;
 
                AltosPreferences.init(new AltosDroidPreferencesBackend(context));
 
+               font_size = backend.getInt(fontSizePreference, font_size_medium);
+
                String address = backend.getString(activeDeviceAddressPreference, null);
                String name = backend.getString(activeDeviceNamePreference, null);
 
@@ -51,6 +67,8 @@ public class AltosDroidPreferences extends AltosPreferences {
                        active_device_address = new DeviceAddress (address, name);
 
                map_source = backend.getInt(mapSourcePreference, MAP_SOURCE_ONLINE);
+
+               tracker_sort = backend.getInt(trackerSortPreference, 0);
        }
 
        public static void set_active_device(DeviceAddress address) {
@@ -107,4 +125,37 @@ public class AltosDroidPreferences extends AltosPreferences {
                        map_source_listeners.remove(l);
                }
        }
+
+       public static int font_size() {
+               synchronized (backend) {
+                       return font_size;
+               }
+       }
+
+       public static void set_font_size(int new_font_size) {
+               synchronized (backend) {
+                       if (font_size != new_font_size) {
+                               font_size = new_font_size;
+                               backend.putInt(fontSizePreference, font_size);
+                               flush_preferences();
+                       }
+               }
+       }
+
+
+       public static int tracker_sort() {
+               synchronized(backend) {
+                       return tracker_sort;
+               }
+       }
+
+       public static void set_tracker_sort(int new_tracker_sort) {
+               synchronized(backend) {
+                       if (tracker_sort != new_tracker_sort) {
+                               tracker_sort = new_tracker_sort;
+                               backend.putInt(trackerSortPreference, tracker_sort);
+                               flush_preferences();
+                       }
+               }
+       }
 }
index 854fe86d6edaa6ab29c16fea6666c95ce151e458..5d836f5dceeb7f21f9711b0c77beffadfe5fadbc 100644 (file)
@@ -25,7 +25,7 @@ import android.content.SharedPreferences;
 import android.os.Environment;
 import android.util.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosDroidPreferencesBackend extends AltosPreferencesBackend {
        public final static String        NAME    = "org.altusmetrum.AltosDroid";
index 4f0fb1fa456241975f656e0f992ac667ad63944b..e6923c376643b245f2592a50d1bc75fe7ac0f419 100644 (file)
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 import android.location.Location;
 import android.app.Activity;
+import android.content.*;
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentTransaction;
 import android.widget.TextView;
@@ -66,9 +67,9 @@ public abstract class AltosDroidTab extends Fragment implements AltosUnitsListen
        }
 
        @Override
-       public void onAttach(Activity activity) {
-               super.onAttach(activity);
-               altos_droid = (AltosDroid) activity;
+       public void onAttach(Context context) {
+               super.onAttach(context);
+               altos_droid = (AltosDroid) context;
                altos_droid.registerTab(this);
        }
 
index c3204336a1a99878b10f0a153abd8de71b71305d..cca958c50f873f1f0afbed954f241bebfdfd8bbb 100644 (file)
@@ -21,7 +21,7 @@ package org.altusmetrum.AltosDroid;
 import java.util.*;
 import java.io.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import android.graphics.*;
 import android.view.*;
@@ -346,18 +346,6 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
                draw_bitmap(here, here_bitmap, here_off_x, here_off_y);
        }
 
-       @Override public void invalidate() {
-               Rect r = new Rect();
-               getDrawingRect(r);
-               super.invalidate();
-       }
-
-       @Override public void invalidate(int l, int t, int r, int b) {
-               Rect rect = new Rect();
-               getDrawingRect(rect);
-               super.invalidate();
-       }
-
        @Override
        protected void onDraw(Canvas view_canvas) {
                if (map == null) {
@@ -449,11 +437,11 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
 
                if (telem_state != null) {
                        Integer[] old_serial = rockets.keySet().toArray(new Integer[0]);
-                       Integer[] new_serial = telem_state.states.keySet().toArray(new Integer[0]);
+                       Integer[] new_serial = telem_state.keySet().toArray(new Integer[0]);
 
                        /* remove deleted keys */
                        for (int serial : old_serial) {
-                               if (!telem_state.states.containsKey(serial))
+                               if (!telem_state.containsKey(serial))
                                        rockets.remove(serial);
                        }
 
@@ -461,7 +449,7 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
 
                        for (int serial : new_serial) {
                                Rocket          rocket;
-                               AltosState      t_state = telem_state.states.get(serial);
+                               AltosState      t_state = telem_state.get(serial);
                                if (rockets.containsKey(serial))
                                        rocket = rockets.get(serial);
                                else {
@@ -471,7 +459,7 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
                                if (t_state.gps != null) {
                                        AltosLatLon     latlon = new AltosLatLon(t_state.gps.lat, t_state.gps.lon);
                                        rocket.set_position(latlon, t_state.received_time);
-                                       if (state.cal_data().serial == serial)
+                                       if (state != null && state.cal_data().serial == serial)
                                                there = latlon;
                                }
                                if (state != null)
index 272744a35c8355b93eef7178f63c935616668321..c35bbb4d308c32ae608583ac5fe813ad69a2e3ef 100644 (file)
@@ -20,7 +20,7 @@ package org.altusmetrum.AltosDroid;
 
 import java.util.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import com.google.android.gms.maps.*;
 import com.google.android.gms.maps.model.*;
@@ -203,13 +203,22 @@ public class AltosMapOnline implements AltosDroidMapInterface, GoogleMap.OnMarke
                return true;
        }
 
+       void
+       position_permission() {
+               if (mMap != null)
+                       mMap.setMyLocationEnabled(true);
+       }
+
        @Override
        public void onMapReady(GoogleMap googleMap) {
                final int map_type = AltosPreferences.map_type();
                mMap = googleMap;
                if (mMap != null) {
                        map_type_changed(map_type);
-                       mMap.setMyLocationEnabled(true);
+                       if (altos_droid.have_location_permission)
+                               mMap.setMyLocationEnabled(true);
+                       else
+                               altos_droid.tell_map_permission(this);
                        mMap.getUiSettings().setTiltGesturesEnabled(false);
                        mMap.getUiSettings().setZoomControlsEnabled(false);
                        mMap.setOnMarkerClickListener(this);
@@ -278,12 +287,12 @@ public class AltosMapOnline implements AltosDroidMapInterface, GoogleMap.OnMarke
 
                if (telem_state != null) {
                        for (int serial : rockets.keySet()) {
-                               if (!telem_state.states.containsKey(serial))
+                               if (!telem_state.containsKey(serial))
                                        remove_rocket(serial);
                        }
 
-                       for (int serial : telem_state.states.keySet()) {
-                               set_rocket(serial, telem_state.states.get(serial));
+                       for (int serial : telem_state.keySet()) {
+                               set_rocket(serial, telem_state.get(serial));
                        }
                }
 
index ae82032fe4c503f2f3c2dbb144d549a902d58d80..c2ef8a700ce026fddbf37a68dd498ba01cc059f4 100644 (file)
@@ -27,7 +27,7 @@ import android.hardware.usb.*;
 import android.app.*;
 import android.os.Handler;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosUsb extends AltosDroidLink {
 
index ae3299facba66c76ea1ed15aa02308b276a982ac..2049c79654b958c645846d298423912605ddabed 100644 (file)
@@ -23,7 +23,7 @@ import android.speech.tts.TextToSpeech;
 import android.speech.tts.TextToSpeech.OnInitListener;
 import android.location.Location;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosVoice {
 
@@ -82,7 +82,7 @@ public class AltosVoice {
                if (!tts_enabled) return;
                last_speak_time = now();
                if (!quiet)
-                       tts.speak(s, TextToSpeech.QUEUE_ADD, null);
+                       tts.speak(s, TextToSpeech.QUEUE_ADD, null, null);
        }
 
        public synchronized long time_since_speak() {
@@ -123,8 +123,6 @@ public class AltosVoice {
                if (state == null)
                        return false;
 
-               AltosDebug.debug("tell_pad lag %b ltm %d\n", last_apogee_good, last_tell_mode);
-
                if (state.apogee_voltage != AltosLib.MISSING)
                        last_apogee_good = tell_gonogo("apogee",
                                                       state.apogee_voltage >= AltosLib.ao_igniter_good,
index 839fb5311df69fd3e388ced03b0e4817a0276b43..1c3e1dbab21019bd9bfa82423e820a2129720c00 100644 (file)
@@ -55,10 +55,10 @@ public class DeviceListActivity extends Activity {
 
        @Override
        protected void onCreate(Bundle savedInstanceState) {
+               setTheme(AltosDroid.dialog_themes[AltosDroidPreferences.font_size()]);
                super.onCreate(savedInstanceState);
 
                // Setup the window
-               requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
                setContentView(R.layout.device_list);
 
                // Set result CANCELED incase the user backs out
@@ -135,7 +135,6 @@ public class DeviceListActivity extends Activity {
                AltosDebug.debug("doDiscovery()");
 
                // Indicate scanning in the title
-               setProgressBarIndeterminateVisibility(true);
                setTitle(R.string.scanning);
 
                // Turn on sub-title for new devices
@@ -207,7 +206,6 @@ public class DeviceListActivity extends Activity {
                        /* When discovery is finished, change the Activity title
                         */
                        } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
-                               setProgressBarIndeterminateVisibility(false);
                                setTitle(R.string.select_device);
                                if (mNewDevicesArrayAdapter.getCount() == 0) {
                                        String noDevices = getResources().getText(R.string.none_found).toString();
index a57758b5b769207b4fced886b53a5cc270d0bf84..717bd2090cc3bf13355e56b0f858e0447d7f7ad2 100644 (file)
@@ -41,9 +41,9 @@ public class GoNoGoLights {
                missing = true;
                set = false;
 
-               dRed   = r.getDrawable(R.drawable.redled);
-               dGreen = r.getDrawable(R.drawable.greenled);
-               dGray  = r.getDrawable(R.drawable.grayled);
+               dRed   = in_red.getContext().getDrawable(R.drawable.redled);
+               dGreen = in_red.getContext().getDrawable(R.drawable.greenled);
+               dGray  = in_red.getContext().getDrawable(R.drawable.grayled);
        }
 
        public void set(Boolean s, Boolean m) {
index f10c718606bf0b78a9f1c9e400945e6d436fc8af..9b9095bdefc28979a9ff66786d2f2ed57dc54227 100644 (file)
@@ -26,14 +26,16 @@ import android.view.Window;
 import android.view.View.OnClickListener;
 import android.widget.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class IdleModeActivity extends Activity {
-       private EditText callsign;
+       private EditText callsignText;
+       private TextView frequencyView;
        private Button connect;
        private Button disconnect;
        private Button reboot;
        private Button igniters;
+       private double frequency;
 
        public static final String EXTRA_IDLE_MODE = "idle_mode";
        public static final String EXTRA_IDLE_RESULT = "idle_result";
@@ -52,7 +54,7 @@ public class IdleModeActivity extends Activity {
        }
 
        private String callsign() {
-               return callsign.getEditableText().toString();
+               return callsignText.getEditableText().toString();
        }
 
        public void connect_idle() {
@@ -74,14 +76,18 @@ public class IdleModeActivity extends Activity {
 
        @Override
        protected void onCreate(Bundle savedInstanceState) {
+               setTheme(AltosDroid.dialog_themes[AltosDroidPreferences.font_size()]);
                super.onCreate(savedInstanceState);
 
                // Setup the window
-               requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
                setContentView(R.layout.idle_mode);
 
-               callsign = (EditText) findViewById(R.id.set_callsign);
-               callsign.setText(new StringBuffer(AltosPreferences.callsign()));
+               callsignText = (EditText) findViewById(R.id.set_callsign);
+               callsignText.setText(new StringBuffer(AltosPreferences.callsign()));
+
+               frequency = getIntent().getDoubleExtra(AltosDroid.EXTRA_FREQUENCY, 0.0);
+               frequencyView = (TextView) findViewById(R.id.frequency);
+               frequencyView.setText(String.format("Frequency: %7.3f MHz", frequency));
 
                connect = (Button) findViewById(R.id.connect_idle);
                connect.setOnClickListener(new OnClickListener() {
index 9e5a14ed82e65eee708441d2d09c9d04048f4e46..752558206accf3f89d3880d9c95d3cf1fbb68a48 100644 (file)
@@ -29,7 +29,7 @@ import android.view.*;
 import android.view.View.*;
 import android.widget.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 class IgniterItem {
        public String name;
@@ -101,7 +101,7 @@ class IgniterAdapter extends ArrayAdapter<IgniterItem> {
                if (position == selected_item)
                        item.igniter_view.setBackgroundColor(Color.RED);
                else
-                       item.igniter_view.setBackgroundColor(Color.BLACK);
+                       item.igniter_view.setBackgroundColor(0);
                return item.igniter_view;
        }
 }
@@ -139,7 +139,8 @@ public class IgniterActivity extends Activity {
 
                        switch (msg.what) {
                        case AltosDroid.MSG_IGNITER_STATUS:
-                               ia.igniter_status((HashMap <String,Integer>) msg.obj);
+                               @SuppressWarnings("unchecked") HashMap<String,Integer> map = (HashMap <String,Integer>) msg.obj;
+                               ia.igniter_status(map);
                                break;
                        }
                }
@@ -339,10 +340,10 @@ public class IgniterActivity extends Activity {
 
        @Override
        protected void onCreate(Bundle savedInstanceState) {
+               setTheme(AltosDroid.dialog_themes[AltosDroidPreferences.font_size()]);
                super.onCreate(savedInstanceState);
 
                // Setup the window
-               requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
                setContentView(R.layout.igniters);
 
                igniters_view = (ListView) findViewById(R.id.igniters);
index 6e8e38dbb36043cf3385936fc1e0f0bf2c3b786d..69cd225f72abcfced228b9475c3e58476a3674b1 100644 (file)
@@ -30,7 +30,7 @@ import android.view.View.*;
 import android.view.inputmethod.*;
 import android.widget.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 class FrequencyItem {
        public AltosFrequency frequency;
@@ -99,7 +99,7 @@ class FrequencyAdapter extends ArrayAdapter<FrequencyItem> {
                if (position == selected_item)
                        item.frequency_view.setBackgroundColor(Color.RED);
                else
-                       item.frequency_view.setBackgroundColor(Color.BLACK);
+                       item.frequency_view.setBackgroundColor(0);
                return item.frequency_view;
        }
 }
@@ -236,10 +236,10 @@ public class ManageFrequenciesActivity extends Activity {
 
        @Override
        protected void onCreate(Bundle savedInstanceState) {
+               setTheme(AltosDroid.dialog_themes[AltosDroidPreferences.font_size()]);
                super.onCreate(savedInstanceState);
 
                // Setup the window
-               requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
                setContentView(R.layout.manage_frequencies);
 
                frequencies_view = (ListView) findViewById(R.id.frequencies);
index 167fb293372d9470ff04474b91cbef670cad922b..58515a3bc9c726cf8e1aaa1228c7ea8dbd4728ae 100644 (file)
@@ -25,7 +25,7 @@ import android.view.View;
 import android.view.Window;
 import android.widget.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class MapTypeActivity extends Activity {
        private Button hybrid;
@@ -58,10 +58,10 @@ public class MapTypeActivity extends Activity {
 
        @Override
        protected void onCreate(Bundle savedInstanceState) {
+               setTheme(AltosDroid.dialog_themes[AltosDroidPreferences.font_size()]);
                super.onCreate(savedInstanceState);
 
                // Setup the window
-               requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
                setContentView(R.layout.map_type);
 
                hybrid = (Button) findViewById(R.id.map_type_hybrid);
index a9f30f119c240973d0df8f11225964c6550e1c67..f911e1ee85e0ef597ae5e69ff9f04a40ada364ab 100644 (file)
@@ -33,7 +33,7 @@ import android.location.Location;
 import android.location.LocationManager;
 import android.location.LocationListener;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 /**
  * This Activity appears as a dialog. It lists any paired devices and
@@ -296,10 +296,10 @@ public class PreloadMapActivity extends Activity implements AltosLaunchSiteListe
 
        @Override
        protected void onCreate(Bundle savedInstanceState) {
+               setTheme(AltosDroid.dialog_themes[AltosDroidPreferences.font_size()]);
                super.onCreate(savedInstanceState);
 
                // Setup the window
-               requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
                setContentView(R.layout.map_preload);
 
                // Set result CANCELED incase the user backs out
diff --git a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/SelectTrackerActivity.java b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/SelectTrackerActivity.java
new file mode 100644 (file)
index 0000000..1815331
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * Copyright © 2020 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, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.AltosDroid;
+
+import java.util.*;
+import android.app.Activity;
+import android.content.*;
+import android.os.*;
+import android.util.*;
+import android.view.*;
+import android.view.View.*;
+import android.widget.*;
+import android.graphics.*;
+import android.graphics.drawable.*;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+
+import org.altusmetrum.altoslib_14.*;
+
+class TrackerComparatorCall implements Comparator<Tracker> {
+       public int compare(Tracker a, Tracker b) {
+               int v;
+
+               v = a.compareCall(b);
+               if (v != 0)
+                       return v;
+               v = a.compareAge(b);
+               if (v != 0)
+                       return v;
+               v = a.compareSerial(b);
+               if (v != 0)
+                       return v;
+               return a.compareFrequency(b);
+       }
+       public boolean equals(Object o) {
+               return o instanceof TrackerComparatorCall;
+       }
+}
+
+class TrackerComparatorSerial implements Comparator<Tracker> {
+       public int compare(Tracker a, Tracker b) {
+               int v;
+
+               v = a.compareSerial(b);
+               if (v != 0)
+                       return v;
+               v = a.compareAge(b);
+               if (v != 0)
+                       return v;
+               v = a.compareCall(b);
+               if (v != 0)
+                       return v;
+               return a.compareFrequency(b);
+       }
+       public boolean equals(Object o) {
+               return o instanceof TrackerComparatorSerial;
+       }
+}
+
+class TrackerComparatorAge implements Comparator<Tracker> {
+       public int compare(Tracker a, Tracker b) {
+               int v;
+
+               v = a.compareAge(b);
+               if (v != 0)
+                       return v;
+               v = a.compareCall(b);
+               if (v != 0)
+                       return v;
+               v = a.compareSerial(b);
+               if (v != 0)
+                       return v;
+               return a.compareFrequency(b);
+       }
+       public boolean equals(Object o) {
+               return o instanceof TrackerComparatorAge;
+       }
+}
+
+class TrackerComparatorFrequency implements Comparator<Tracker> {
+       public int compare(Tracker a, Tracker b) {
+               int v;
+
+               v = a.compareFrequency(b);
+               if (v != 0)
+                       return v;
+               v = a.compareAge(b);
+               if (v != 0)
+                       return v;
+               v = a.compareCall(b);
+               if (v != 0)
+                       return v;
+               return a.compareSerial(b);
+       }
+       public boolean equals(Object o) {
+               return o instanceof TrackerComparatorFrequency;
+       }
+}
+
+public class SelectTrackerActivity extends Activity implements OnTouchListener {
+       // Return Intent extra
+       public static final String EXTRA_SERIAL_NUMBER = "serial_number";
+       public static final String EXTRA_FREQUENCY = "frequency";
+
+       private int button_ids[] = {
+               R.id.call_button,
+               R.id.serial_button,
+               R.id.frequency_button,
+               R.id.age_button
+       };
+
+       private static final int call_button = 0;
+       private static final int serial_button = 1;
+       private static final int freq_button = 2;
+       private static final int age_button = 3;
+       private RadioButton radio_buttons[] = new RadioButton[4];
+       private TableLayout table;
+
+       private Tracker[] trackers;
+
+       private void set_sort(int id) {
+               AltosDroidPreferences.set_tracker_sort(id);
+               resort();
+       }
+
+       private void resort() {
+               Comparator<Tracker> compare;
+               int tracker_sort = AltosDroidPreferences.tracker_sort();
+               AltosDebug.debug("sort %d", tracker_sort);
+               switch (tracker_sort) {
+               case call_button:
+               default:
+                       compare = new TrackerComparatorCall();
+                       break;
+               case serial_button:
+                       compare = new TrackerComparatorSerial();
+                       break;
+               case freq_button:
+                       compare = new TrackerComparatorFrequency();
+                       break;
+               case age_button:
+                       compare = new TrackerComparatorAge();
+                       break;
+               }
+               Arrays.sort(trackers, compare);
+               set_trackers();
+       }
+
+       void init_button_state() {
+               int tracker_sort = AltosDroidPreferences.tracker_sort();
+               for (int i = 0; i < 4; i++)
+                       radio_buttons[i].setChecked(i == tracker_sort);
+       }
+
+       OnCheckedChangeListener button_listener = new OnCheckedChangeListener() {
+                       @Override
+                       public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                               int id = buttonView.getId();
+                               if (isChecked) {
+                                       int sort_id = -1;
+                                       for (int i = 0; i < 4; i++) {
+                                               if (id == button_ids[i])
+                                                       sort_id = i;
+                                               else
+                                                       radio_buttons[i].setChecked(false);
+                                       }
+                                       if (sort_id != -1)
+                                               set_sort(sort_id);
+                               }
+                       }
+               };
+
+       long start_time;
+
+       private void
+       insert_tracker(Tracker tracker) {
+               TableRow row = (TableRow) getLayoutInflater().inflate(R.layout.tracker_ent, null);
+
+               ((TextView) row.findViewById(R.id.call_view)).setText(tracker.call);
+               if (tracker.serial == 0)
+                       ((TextView) row.findViewById(R.id.serial_view)).setText("");
+               else
+                       ((TextView) row.findViewById(R.id.serial_view)).setText(String.format("%d", tracker.serial));
+               if (tracker.frequency == 0.0)
+                       ((TextView) row.findViewById(R.id.frequency_view)).setText("");
+               else if (tracker.frequency == AltosLib.MISSING)
+                       ((TextView) row.findViewById(R.id.frequency_view)).setText("");
+               else
+                       ((TextView) row.findViewById(R.id.frequency_view)).setText(String.format("%7.3f", tracker.frequency));
+               if (tracker.received_time != 0) {
+                       int age = (int) ((start_time - tracker.received_time + 500) / 1000);
+                       ((TextView) row.findViewById(R.id.age_view)).setText(AltosDroid.age_string(age));
+               } else {
+                       ((TextView) row.findViewById(R.id.age_view)).setText("");
+               }
+               row.setClickable(true);
+               row.setOnTouchListener(this);
+               table.addView(row);
+       }
+
+       private void set_trackers() {
+               for (int i = table.getChildCount() - 1; i >= 1; i--)
+                       table.removeViewAt(i);
+               for (Tracker tracker : trackers)
+                       insert_tracker(tracker);
+       }
+
+       private void done(View v) {
+               int result = Activity.RESULT_CANCELED;
+               Intent intent = new Intent();
+               for (int i = 1; i < table.getChildCount(); i++) {
+                       View child = table.getChildAt(i);
+                       if (child == v) {
+                               Tracker tracker = trackers[i - 1];
+                               intent.putExtra(EXTRA_SERIAL_NUMBER, tracker.serial);
+                               intent.putExtra(EXTRA_FREQUENCY, tracker.frequency);
+                               result = Activity.RESULT_OK;
+                               break;
+                       }
+               }
+               setResult(Activity.RESULT_OK, intent);
+               finish();
+       }
+
+       @Override
+       protected void onCreate(Bundle savedInstanceState) {
+               int title_id = getIntent().getIntExtra(AltosDroid.EXTRA_TRACKERS_TITLE, R.id.select_tracker);
+               AltosDebug.debug("get title id 0x%x %s", title_id, getResources().getText(title_id));
+               setTitle(getResources().getText(title_id));
+               setTheme(AltosDroid.dialog_themes[AltosDroidPreferences.font_size()]);
+               super.onCreate(savedInstanceState);
+
+               setContentView(R.layout.tracker_list);
+               // Set result CANCELED incase the user backs out
+               setResult(Activity.RESULT_CANCELED);
+
+               for (int i = 0; i < 4; i++) {
+                       radio_buttons[i] = (RadioButton) findViewById(button_ids[i]);
+                       radio_buttons[i].setOnCheckedChangeListener(button_listener);
+               }
+
+               ArrayList<Parcelable> tracker_array = (ArrayList<Parcelable>) getIntent().getParcelableArrayListExtra(AltosDroid.EXTRA_TRACKERS);
+               if (tracker_array != null) {
+                       Object[] array = tracker_array.toArray();
+                       trackers = new Tracker[array.length];
+                       for (int i = 0; i < array.length; i++)
+                               trackers[i] = (Tracker) array[i];
+               }
+
+               start_time = System.currentTimeMillis();
+
+               table = (TableLayout) findViewById(R.id.tracker_list);
+
+               init_button_state();
+
+               resort();
+
+               set_trackers();
+       }
+
+       @Override
+       public boolean onTouch(View v, MotionEvent event) {
+               int action = event.getAction() & MotionEvent.ACTION_MASK;
+               switch (action) {
+               case MotionEvent.ACTION_UP:
+               case MotionEvent.ACTION_CANCEL:
+               case MotionEvent.ACTION_OUTSIDE:
+                       v.setBackgroundColor(0);
+                       v.invalidate();
+                       break;
+               case MotionEvent.ACTION_DOWN:
+                       v.setBackgroundColor(Color.RED);
+                       v.invalidate();
+                       break;
+               }
+               if (action == MotionEvent.ACTION_UP) {
+                       done(v);
+                       return true;
+               }
+               return false;
+       }
+}
index 55b34856a090266e14242aa385f147b1ec247ac0..9643367387d72029bf32ae321a8c76e1d342ebce 100644 (file)
@@ -26,11 +26,12 @@ import android.view.View.*;
 import android.widget.*;
 import android.widget.AdapterView.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class SetupActivity extends Activity {
        private Spinner select_rate;
        private Spinner set_units;
+       private Spinner font_size;
        private Spinner map_type;
        private Spinner map_source;
        private Button manage_frequencies;
@@ -72,6 +73,13 @@ public class SetupActivity extends Activity {
                "2400",
        };
 
+       static final String[] sizes = {
+               "Small",
+               "Medium",
+               "Large",
+               "Extra"
+       };
+
        static final String[] map_types = {
                "Hybrid",
                "Satellite",
@@ -95,30 +103,39 @@ public class SetupActivity extends Activity {
        private int     set_map_source;
        private int     set_map_type;
        private boolean set_imperial_units;
-
-       private int     changes = 0;
-
-       private void add_change(int change) {
-               changes |= change;
-       }
+       private int     set_font_size;
 
        private void done() {
+               int     changes = 0;
                Intent intent = new Intent();
-               if ((changes & AltosDroid.SETUP_BAUD) != 0)
+
+               if (set_telemetry_rate != AltosPreferences.telemetry_rate(1)) {
+                       changes |= AltosDroid.SETUP_BAUD;
                        AltosPreferences.set_telemetry_rate(1, set_telemetry_rate);
-               if ((changes & AltosDroid.SETUP_UNITS) != 0)
+               }
+               if (set_imperial_units != AltosPreferences.imperial_units()) {
+                       changes |= AltosDroid.SETUP_UNITS;
                        AltosPreferences.set_imperial_units(set_imperial_units);
-               if ((changes & AltosDroid.SETUP_MAP_SOURCE) != 0)
+               }
+               if (set_map_source != AltosDroidPreferences.map_source()) {
+                       changes |= AltosDroid.SETUP_MAP_SOURCE;
                        AltosDroidPreferences.set_map_source(set_map_source);
-               if ((changes & AltosDroid.SETUP_MAP_TYPE) != 0)
+               }
+               if (set_map_type != AltosPreferences.map_type()) {
+                       changes |= AltosDroid.SETUP_MAP_TYPE;
                        AltosPreferences.set_map_type(set_map_type);
+               }
+               if (set_font_size != AltosDroidPreferences.font_size()) {
+                       changes |= AltosDroid.SETUP_FONT_SIZE;
+                       AltosDroidPreferences.set_font_size(set_font_size);
+               }
                intent.putExtra(EXTRA_SETUP_CHANGES, changes);
                setResult(Activity.RESULT_OK, intent);
                finish();
        }
 
        private void add_strings(Spinner spinner, String[] strings, int def) {
-               ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item);
+               ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item);
 
                for (int i = 0; i < strings.length; i++)
                        adapter.add(strings[i]);
@@ -139,12 +156,7 @@ public class SetupActivity extends Activity {
        }
 
        private void setBaud(int baud) {
-               try {
-                       service.send(Message.obtain(null, TelemetryService.MSG_SETBAUD, baud));
-                       set_telemetry_rate = baud;
-                       add_change(AltosDroid.SETUP_BAUD);
-               } catch (RemoteException e) {
-               }
+               set_telemetry_rate = baud;
        }
 
        private int string_to_rate(String baud) {
@@ -197,7 +209,10 @@ public class SetupActivity extends Activity {
                        set_imperial_units = true;
                        break;
                }
-               add_change(AltosDroid.SETUP_UNITS);
+       }
+
+       private void set_font_size(int pos) {
+               set_font_size = pos;
        }
 
        private int default_map_type_pos() {
@@ -211,7 +226,6 @@ public class SetupActivity extends Activity {
 
        private void select_map_type(int pos) {
                set_map_type = map_type_values[pos];
-               add_change(AltosDroid.SETUP_MAP_TYPE);
        }
 
        private int default_map_source_pos() {
@@ -234,7 +248,6 @@ public class SetupActivity extends Activity {
                        set_map_source = AltosDroidPreferences.MAP_SOURCE_OFFLINE;
                        break;
                }
-               add_change(AltosDroid.SETUP_MAP_SOURCE);
        }
 
        private void manage_frequencies(){
@@ -249,6 +262,7 @@ public class SetupActivity extends Activity {
 
        @Override
        protected void onCreate(Bundle savedInstanceState) {
+               setTheme(AltosDroid.dialog_themes[AltosDroidPreferences.font_size()]);
                super.onCreate(savedInstanceState);
 
                AltosDebug.init(this);
@@ -258,13 +272,13 @@ public class SetupActivity extends Activity {
                AltosDroidPreferences.init(this);
 
                // Setup the window
-               requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
                setContentView(R.layout.setup);
 
                select_rate = (Spinner) findViewById(R.id.select_rate);
                add_strings(select_rate, rates, default_rate_pos());
                select_rate.setOnItemSelectedListener(new OnItemSelectedListener() {
                                public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+                                       AltosDebug.debug("rate selected pos %d id %d", pos, id);
                                        select_rate(pos);
                                }
                                public void onNothingSelected(AdapterView<?> parent) {
@@ -281,6 +295,16 @@ public class SetupActivity extends Activity {
                                }
                        });
 
+               font_size = (Spinner) findViewById(R.id.font_size);
+               add_strings(font_size, sizes, AltosDroidPreferences.font_size());
+               font_size.setOnItemSelectedListener(new OnItemSelectedListener() {
+                               public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+                                       set_font_size(pos);
+                               }
+                               public void onNothingSelected(AdapterView<?> parent) {
+                               }
+                       });
+
                map_type = (Spinner) findViewById(R.id.map_type);
                add_strings(map_type, map_types, default_map_type_pos());
                map_type.setOnItemSelectedListener(new OnItemSelectedListener() {
index b2e7e197aae77617ecafc6d2c523dd920daa094a..ba45c47eff202c4ab185b9798e91ff7a11f573c1 100644 (file)
@@ -18,7 +18,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import android.os.Bundle;
 import android.view.*;
@@ -83,16 +83,16 @@ public class TabFlight extends AltosDroidTab {
 
        public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) {
                if (state != null) {
-                       set_value(speed_view, AltosConvert.speed, 6, state.speed());
-                       set_value(height_view, AltosConvert.height, 6, state.height());
-                       set_value(max_speed_view, AltosConvert.speed, 6, state.max_speed());
-                       set_value(max_height_view, AltosConvert.height, 6, state.max_height());
+                       set_value(speed_view, AltosConvert.speed, 1, state.speed());
+                       set_value(height_view, AltosConvert.height, 1, state.height());
+                       set_value(max_speed_view, AltosConvert.speed, 1, state.max_speed());
+                       set_value(max_height_view, AltosConvert.height, 1, state.max_height());
                        if (from_receiver != null) {
-                               elevation_view.setText(AltosDroid.number("%3.0f°", from_receiver.elevation));
-                               set_value(range_view, AltosConvert.distance, 6, from_receiver.range);
-                               bearing_view.setText(AltosDroid.number("%3.0f°", from_receiver.bearing));
+                               elevation_view.setText(AltosDroid.number("%1.0f°", from_receiver.elevation));
+                               set_value(range_view, AltosConvert.distance, 1, from_receiver.range);
+                               bearing_view.setText(AltosDroid.number("%1.0f°", from_receiver.bearing));
                                compass_view.setText(from_receiver.bearing_words(AltosGreatCircle.BEARING_LONG));
-                               set_value(distance_view, AltosConvert.distance, 6, from_receiver.distance);
+                               set_value(distance_view, AltosConvert.distance, 1, from_receiver.distance);
                        } else { 
                                elevation_view.setText("<unknown>");
                                range_view.setText("<unknown>");
@@ -108,7 +108,7 @@ public class TabFlight extends AltosDroidTab {
                        if (state.apogee_voltage == AltosLib.MISSING) {
                                apogee_view.setVisibility(View.GONE);
                        } else {
-                               apogee_voltage_view.setText(AltosDroid.number("%4.2f V", state.apogee_voltage));
+                               apogee_voltage_view.setText(AltosDroid.number("%1.2f V", state.apogee_voltage));
                                apogee_lights.set(state.apogee_voltage > 3.2, state.apogee_voltage == AltosLib.MISSING);
                                apogee_view.setVisibility(View.VISIBLE);
                        }
@@ -116,7 +116,7 @@ public class TabFlight extends AltosDroidTab {
                        if (state.main_voltage == AltosLib.MISSING) {
                                main_view.setVisibility(View.GONE);
                        } else {
-                               main_voltage_view.setText(AltosDroid.number("%4.2f V", state.main_voltage));
+                               main_voltage_view.setText(AltosDroid.number("%1.2f V", state.main_voltage));
                                main_lights.set(state.main_voltage > 3.2, state.main_voltage == AltosLib.MISSING);
                                main_view.setVisibility(View.VISIBLE);
                        }
index 53bfd2749e918b0c53cef13016be7a3818808c44..55acd5d68a88201b3b6bfb64372b9c1c2af5f2bd 100644 (file)
@@ -18,7 +18,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import android.app.Activity;
 import android.os.Bundle;
@@ -42,16 +42,6 @@ public class TabMap extends AltosDroidTab implements AltosDroidMapSourceListener
        private View view;
        private int map_source;
 
-       @Override
-       public void onAttach(Activity activity) {
-               super.onAttach(activity);
-       }
-
-       @Override
-       public void onCreate(Bundle savedInstanceState) {
-               super.onCreate(savedInstanceState);
-       }
-
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                view = inflater.inflate(R.layout.tab_map, container, false);
index 6e343f9fbe7a109bd9b50dcda6c8a84de40a2d66..f526857f00ccedb3a67011dc9b606309dc2394f1 100644 (file)
@@ -18,7 +18,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import android.os.Bundle;
 import android.view.*;
@@ -159,19 +159,19 @@ public class TabPad extends AltosDroidTab {
 
        public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) {
                if (state != null) {
-                       battery_voltage_view.setText(AltosDroid.number(" %4.2f V", state.battery_voltage));
+                       battery_voltage_view.setText(AltosDroid.number("%1.2f V", state.battery_voltage));
                        battery_lights.set(state.battery_voltage >= AltosLib.ao_battery_good, state.battery_voltage == AltosLib.MISSING);
                        if (state.apogee_voltage == AltosLib.MISSING) {
                                apogee_row.setVisibility(View.GONE);
                        } else {
-                               apogee_voltage_view.setText(AltosDroid.number(" %4.2f V", state.apogee_voltage));
+                               apogee_voltage_view.setText(AltosDroid.number("%1.2f V", state.apogee_voltage));
                                apogee_row.setVisibility(View.VISIBLE);
                        }
                        apogee_lights.set(state.apogee_voltage >= AltosLib.ao_igniter_good, state.apogee_voltage == AltosLib.MISSING);
                        if (state.main_voltage == AltosLib.MISSING) {
                                main_row.setVisibility(View.GONE);
                        } else {
-                               main_voltage_view.setText(AltosDroid.number(" %4.2f V", state.main_voltage));
+                               main_voltage_view.setText(AltosDroid.number("%1.2f V", state.main_voltage));
                                main_row.setVisibility(View.VISIBLE);
                        }
                        main_lights.set(state.main_voltage >= AltosLib.ao_igniter_good, state.main_voltage == AltosLib.MISSING);
@@ -183,7 +183,7 @@ public class TabPad extends AltosDroidTab {
                                if (voltage == AltosLib.MISSING) {
                                        ignite_row[i].setVisibility(View.GONE);
                                } else {
-                                       ignite_voltage_view[i].setText(AltosDroid.number(" %4.2f V", voltage));
+                                       ignite_voltage_view[i].setText(AltosDroid.number("%1.2f V", voltage));
                                        ignite_row[i].setVisibility(View.VISIBLE);
                                }
                                ignite_lights[i].set(voltage >= AltosLib.ao_igniter_good, voltage == AltosLib.MISSING);
@@ -219,7 +219,7 @@ public class TabPad extends AltosDroidTab {
                        if (telem_state.receiver_battery == AltosLib.MISSING) {
                                receiver_row.setVisibility(View.GONE);
                        } else {
-                               receiver_voltage_view.setText(AltosDroid.number(" %4.2f V", telem_state.receiver_battery));
+                               receiver_voltage_view.setText(AltosDroid.number("%1.2f V", telem_state.receiver_battery));
                                receiver_row.setVisibility(View.VISIBLE);
                        }
                        receiver_voltage_lights.set(telem_state.receiver_battery >= AltosLib.ao_battery_good, telem_state.receiver_battery == AltosLib.MISSING);
index 11c82f04e4f7b7c2e0238b0eb68c02628513c14e..df1ee8fa36202a14c5acd12ea654ca07664c27cb 100644 (file)
@@ -18,7 +18,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import android.os.Bundle;
 import android.view.LayoutInflater;
@@ -61,8 +61,8 @@ public class TabRecover extends AltosDroidTab {
 
        public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) {
                if (from_receiver != null) {
-                       mBearingView.setText(String.format("%3.0f°", from_receiver.bearing));
-                       set_value(mDistanceView, AltosConvert.distance, 6, from_receiver.distance);
+                       mBearingView.setText(String.format("%1.0f°", from_receiver.bearing));
+                       set_value(mDistanceView, AltosConvert.distance, 1, from_receiver.distance);
                        String direction = AltosDroid.direction(from_receiver, receiver);
                        if (direction == null)
                                mDirectionView.setText("");
@@ -80,9 +80,9 @@ public class TabRecover extends AltosDroidTab {
                }
 
                if (state != null) {
-                       set_value(mMaxHeightView, AltosConvert.height, 6, state.max_height());
-                       set_value(mMaxAccelView, AltosConvert.accel, 6, state.max_acceleration());
-                       set_value(mMaxSpeedView, AltosConvert.speed, 6, state.max_speed());
+                       set_value(mMaxHeightView, AltosConvert.height, 1, state.max_height());
+                       set_value(mMaxAccelView, AltosConvert.accel, 1, state.max_acceleration());
+                       set_value(mMaxSpeedView, AltosConvert.speed, 1, state.max_speed());
                }
        }
 }
index 315808017c531fd23ae9c4b329e6caf0e5bd5823..23d365b4492e06c136e3f008eaf6304adde8d759 100644 (file)
@@ -83,7 +83,7 @@ public class TabsAdapter extends FragmentPagerAdapter
                mViewPager = pager;
                mTabHost.setOnTabChangedListener(this);
                mViewPager.setAdapter(this);
-               mViewPager.setOnPageChangeListener(this);
+               mViewPager.addOnPageChangeListener(this);
        }
 
        public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
index 49ba54766d2c8264cd392d00505098d7f52d0e7b..589e15d07a351d96e6f1d0011521f2726191b758 100644 (file)
@@ -1,6 +1,6 @@
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import android.content.BroadcastReceiver;
 import android.content.Context;
index de967e1c6d34129d6f357599c15bd2b657b0b1fa..077d66936fe46fe089d7fae8ed0203808edbf660 100644 (file)
@@ -25,7 +25,7 @@ import java.io.*;
 import java.util.concurrent.*;
 import android.os.Handler;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 
 public class TelemetryReader extends Thread {
index 5dba24ba071897316143d6a2ab21cf0addf10fef..31616c825371d5e4f2f411343edf4c2464b622b0 100644 (file)
@@ -31,8 +31,9 @@ import android.content.Intent;
 import android.content.Context;
 import android.os.*;
 import android.widget.Toast;
+import androidx.core.app.NotificationCompat;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class TelemetryService extends Service implements AltosIdleMonitorListener {
 
@@ -132,7 +133,9 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
                        case MSG_SETFREQUENCY:
                                AltosDebug.debug("MSG_SETFREQUENCY");
                                s.telemetry_state.frequency = (Double) msg.obj;
-                               if (s.telemetry_state.connect == TelemetryState.CONNECT_CONNECTED) {
+                               if (s.idle_monitor != null) {
+                                       s.idle_monitor.set_frequency(s.telemetry_state.frequency);
+                               } else if (s.telemetry_state.connect == TelemetryState.CONNECT_CONNECTED) {
                                        try {
                                                s.altos_link.set_radio_frequency(s.telemetry_state.frequency);
                                                s.altos_link.save_frequency();
@@ -250,12 +253,11 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
        private void telemetry(AltosTelemetry telem) {
                AltosState      state;
 
-               if (telemetry_state.states.containsKey(telem.serial()))
-                       state = telemetry_state.states.get(telem.serial());
-               else
+               state = telemetry_state.get(telem.serial());
+               if (state == null)
                        state = new AltosState(new AltosCalData());
                telem.provide_data(state);
-               telemetry_state.states.put(telem.serial(), state);
+               telemetry_state.put(telem.serial(), state);
                telemetry_state.quiet = false;
                if (state != null) {
                        AltosPreferences.set_state(state,telem.serial());
@@ -268,8 +270,6 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
        private Message message() {
                if (telemetry_state == null)
                        AltosDebug.debug("telemetry_state null!");
-               if (telemetry_state.states == null)
-                       AltosDebug.debug("telemetry_state.states null!");
                return Message.obtain(null, AltosDroid.MSG_STATE, telemetry_state);
        }
 
@@ -410,7 +410,7 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
        }
 
        private void delete_serial(int serial) {
-               telemetry_state.states.remove((Integer) serial);
+               telemetry_state.remove(serial);
                AltosPreferences.remove_state(serial);
                send_to_clients();
        }
@@ -437,6 +437,8 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
                        telemetry_stop();
                        idle_monitor = new AltosIdleMonitor(this, altos_link, true, false);
                        idle_monitor.set_callsign(AltosPreferences.callsign());
+                       idle_monitor.set_frequency(telemetry_state.frequency);
+                       telemetry_state.idle_mode = true;
                        idle_monitor.start();
                        send_idle_mode_to_clients();
                }
@@ -449,6 +451,7 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
                        } catch (InterruptedException ie) {
                        }
                        idle_monitor = null;
+                       telemetry_state.idle_mode = false;
                        telemetry_start();
                        send_idle_mode_to_clients();
                }
@@ -614,9 +617,6 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
                for (int serial : serials) {
                        AltosState saved_state = AltosPreferences.state(serial);
                        if (saved_state != null) {
-                               if (telemetry_state.latest_serial == 0)
-                                       telemetry_state.latest_serial = serial;
-
                                AltosDebug.debug("recovered old state serial %d flight %d",
                                                 serial,
                                                 saved_state.cal_data().flight);
@@ -624,7 +624,7 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
                                        AltosDebug.debug("\tposition %f,%f",
                                                         saved_state.gps.lat,
                                                         saved_state.gps.lon);
-                               telemetry_state.states.put(serial, saved_state);
+                               telemetry_state.put(serial, saved_state);
                        } else {
                                AltosDebug.debug("Failed to recover state for %d", serial);
                                AltosPreferences.remove_state(serial);
@@ -657,7 +657,7 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
                                                : "";
 
                // Create notification to be displayed while the service runs
-               Notification notification = new Notification.Builder(this, channelId)
+               Notification notification = new NotificationCompat.Builder(this, channelId)
                                .setContentTitle(getText(R.string.telemetry_service_label))
                                .setContentText(getText(R.string.telemetry_service_started))
                                .setContentIntent(contentIntent)
@@ -709,7 +709,9 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
 
        /* AltosIdleMonitorListener */
        public void update(AltosState state, AltosListenerState listener_state) {
-               telemetry_state.states.put(state.cal_data().serial, state);
+               if (state != null)
+                       AltosDebug.debug("update call %s freq %7.3f", state.cal_data().callsign, state.frequency);
+               telemetry_state.put(state.cal_data().serial, state);
                telemetry_state.receiver_battery = listener_state.battery;
                send_to_clients();
        }
index d292c7bff6331924f2933696b7041bf724f39c12..3cd119b591122f1c50bebaa30ed048d31b48b9d5 100644 (file)
@@ -19,7 +19,7 @@
 package org.altusmetrum.AltosDroid;
 
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class TelemetryState {
        public static final int CONNECT_NONE         = 0;
@@ -35,11 +35,44 @@ public class TelemetryState {
        double          frequency;
        int             telemetry_rate;
 
+       boolean         idle_mode;
        boolean         quiet;
 
-       HashMap<Integer,AltosState>     states;
+       private HashMap<Integer,AltosState>     states;
 
        int             latest_serial;
+       long            latest_received_time;
+
+       public void put(int serial, AltosState state) {
+               long received_time = state.received_time;
+               if (received_time > latest_received_time || latest_serial == 0) {
+                       latest_serial = serial;
+                       latest_received_time = received_time;
+               }
+               states.put(serial, state);
+       }
+
+       public AltosState get(int serial) {
+               if (states.containsKey(serial))
+                       return states.get(serial);
+               return null;
+       }
+
+       public void remove(int serial) {
+               states.remove((Integer) serial);
+       }
+
+       public Set<Integer> keySet() {
+               return states.keySet();
+       }
+
+       public Collection<AltosState> values() {
+               return states.values();
+       }
+
+       public boolean containsKey(int serial) {
+               return states.containsKey(serial);
+       }
 
        public TelemetryState() {
                connect = CONNECT_NONE;
diff --git a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/Tracker.java b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/Tracker.java
new file mode 100644 (file)
index 0000000..614b4c2
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+ * Copyright © 2020 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, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.AltosDroid;
+
+import java.lang.ref.WeakReference;
+import java.util.*;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.bluetooth.BluetoothAdapter;
+import android.content.Intent;
+import android.content.Context;
+import android.content.ComponentName;
+import android.content.ServiceConnection;
+import android.content.DialogInterface;
+import android.os.IBinder;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.RemoteException;
+import android.os.Parcelable;
+import android.os.Parcel;
+import androidx.fragment.app.FragmentActivity;
+import androidx.fragment.app.FragmentManager;
+import android.view.*;
+import android.widget.*;
+import android.app.AlertDialog;
+import android.location.Location;
+import android.location.LocationManager;
+import android.location.LocationListener;
+import android.hardware.usb.*;
+import android.content.pm.PackageManager;
+import androidx.core.app.ActivityCompat;
+import org.altusmetrum.altoslib_14.*;
+
+public class Tracker implements CharSequence, Comparable, Parcelable {
+       int     serial;
+       String  call;
+       double  frequency;
+       long    received_time;
+       String  display;
+
+       private void make_display() {
+               if (frequency == 0.0)
+                       display = "Auto";
+               else if (frequency == AltosLib.MISSING) {
+                       display = String.format("%-8.8s  %6d", call, serial);
+               } else {
+                       display = String.format("%-8.8s %7.3f %6d", call, frequency, serial);
+               }
+       }
+
+       public Tracker(int serial, String call, double frequency, long received_time) {
+               if (call == null)
+                       call = "none";
+
+               this.serial = serial;
+               this.call = call;
+               this.frequency = frequency;
+               this.received_time = received_time;
+               make_display();
+       }
+
+       public Tracker(int serial, String call, double frequency) {
+               this(serial, call, frequency, 0);
+       }
+
+       public Tracker(AltosState s) {
+               this(s == null ? 0 : s.cal_data().serial,
+                    s == null ? null : s.cal_data().callsign,
+                    s == null ? 0.0 : s.frequency,
+                    s == null ? 0 : s.received_time);
+       }
+
+       /* CharSequence */
+       public char charAt(int index) {
+               return display.charAt(index);
+       }
+
+       public int length() {
+               return display.length();
+       }
+
+       public CharSequence subSequence(int start, int end) throws IndexOutOfBoundsException {
+               return display.subSequence(start, end);
+       }
+
+       public String toString() {
+               return display.toString();
+       }
+
+       /* Comparable */
+       public int compareTo (Object other) {
+               Tracker o = (Tracker) other;
+               if (frequency == 0.0) {
+                       if (o.frequency == 0.0)
+                               return 0;
+                       return -1;
+               }
+               if (o.frequency == 0.0)
+                       return 1;
+
+               int     a = serial - o.serial;
+               int     b = call.compareTo(o.call);
+               int     c = (int) Math.signum(frequency - o.frequency);
+
+               if (b != 0)
+                       return b;
+               if (c != 0)
+                       return c;
+               return a;
+       }
+
+       /* Parcelable */
+
+       public int describeContents() {
+               AltosDebug.debug("describe contents %d", serial);
+               return 0;
+       }
+
+       public void writeToParcel(Parcel out, int flags) {
+               AltosDebug.debug("write to parcel %s", display);
+               out.writeInt(serial);
+               out.writeString(call);
+               out.writeDouble(frequency);
+               out.writeLong(received_time);
+       }
+
+       public static final Parcelable.Creator<Tracker> CREATOR
+       = new Parcelable.Creator<Tracker>() {
+                       public Tracker createFromParcel(Parcel in) {
+                               AltosDebug.debug("createFromParcel");
+                               return new Tracker(in);
+                       }
+
+                       public Tracker[] newArray(int size) {
+                               AltosDebug.debug("newArray %d", size);
+                               return new Tracker[size];
+                       }
+               };
+
+       /* newer (-1), same (0), older(1) */
+       public int compareAge(Tracker o) {
+               if (received_time == o.received_time)
+                       return 0;
+               if (received_time == 0)
+                       return -1;
+               if (o.received_time == 0)
+                       return 1;
+               if (received_time > o.received_time)
+                       return -1;
+               return 1;
+       }
+
+       public int compareCall(Tracker o) {
+               int v = call.compareTo(o.call);
+               if (v == 0)
+                       return v;
+               if (call.equals("auto"))
+                       return -1;
+               if (o.call.equals("auto"))
+                       return 1;
+               return v;
+       }
+
+       public int compareSerial(Tracker o) {
+               return serial - o.serial;
+       }
+
+       public int compareFrequency(Tracker o) {
+               return (int) Math.signum(frequency - o.frequency);
+       }
+
+       private Tracker(Parcel in) {
+               serial = in.readInt();
+               call = in.readString();
+               frequency = in.readDouble();
+               received_time = in.readLong();
+               make_display();
+               AltosDebug.debug("Create from parcel %s", display);
+       }
+}
+
diff --git a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/makefile b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/makefile
new file mode 100644 (file)
index 0000000..578197c
--- /dev/null
@@ -0,0 +1,5 @@
+all:
+       make -C ../../../../../../.. $@
+
+%:
+       make -C ../../../../../../.. $@
index 8fa358c97c8ae018fc6eca7528ffc11214e382ff..fa09eaa332d280f49978acfd44aa5b266dbd576c 100644 (file)
@@ -16,6 +16,5 @@
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:textSize="18sp"
     android:padding="5dp"
-/>
\ No newline at end of file
+/>
index 6c598c1cbb4d5cdc2e3d5fffaa87f860ef807d82..adae80eb4a8c0a87a1f89e2c0156f1fc359b945c 100644 (file)
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     >
-      <TextView android:id="@+id/set_callsign_label"
+    <LinearLayout
+       android:orientation="horizontal"
+       android:layout_width="match_parent"
+       android:layout_height="wrap_content"
+       >
+       <TextView android:id="@+id/set_callsign_label"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:text="@string/set_callsign_label"
+                 />
+       <EditText android:id="@+id/set_callsign"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:layout_weight="1"
+                 android:hint="@string/set_callsign_label"/>
+    </LinearLayout>
+      <TextView android:id="@+id/frequency"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
-               android:text="@string/set_callsign_label"
+               android:text=""
                />
-      <EditText android:id="@+id/set_callsign"
-               android:layout_width="fill_parent"
-               android:layout_height="wrap_content"
-               android:hint="@string/set_callsign_label"/>
       <Button android:id="@+id/connect_idle"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
index eeaf60ab6a6ff50af4c853ae81b179f38ec39660..38ba8394d6ccb344d1ff6ff500aca1c25ca2fd76 100644 (file)
               android:spinnerMode="dropdown"
               />
     </TableRow>
+    <TableRow
+       android:layout_gravity="center"
+       android:layout_weight="1"
+       android:padding="2dip"
+       android:layout_width="wrap_content"
+       android:layout_height="wrap_content">
+      <TextView
+         android:id="@+id/font_size_label"
+         android:layout_width="wrap_content"
+         android:layout_height="wrap_content"
+         android:text="@string/font_size"
+         />
+      <Spinner android:id="@+id/font_size"
+              android:layout_width="fill_parent"
+              android:layout_height="wrap_content"
+              android:prompt="@string/font_size"
+              android:spinnerMode="dropdown"
+              />
+    </TableRow>
     <TableRow
        android:layout_gravity="center"
        android:layout_weight="1"
index 36d277d7cc962ebb79617bdbe1581b863d3e0e28..545bf047ed18f348138f503a91e67d082b534245 100644 (file)
     android:layout_height="wrap_content"
     android:orientation="vertical" >
 
-  <LinearLayout
+  <TableLayout
+      xmlns:android="http://schemas.android.com/apk/res/android"
+      android:stretchColumns="2,3"
       android:layout_weight="0"
-      android:layout_width="fill_parent"
-      android:layout_height="wrap_content"
-      android:orientation="vertical" >
-
-    <LinearLayout
-       xmlns:android="http://schemas.android.com/apk/res/android"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content"
-       android:layout_weight="0"
-       android:baselineAligned="true"
-       android:orientation="horizontal" >
-
-      <RelativeLayout
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-
-       <TextView
-           android:id="@+id/speed_label"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:text="@string/speed_label" />
-
-       <TextView
-           android:id="@+id/speed_value"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentRight="true"
-           android:layout_below="@id/speed_label"
-           android:text=""
-           android:textAppearance="?android:attr/textAppearanceSmall" />
-      </RelativeLayout>
-
-      <RelativeLayout
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-
-       <TextView
-           android:id="@+id/height_label"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:text="@string/height_label" />
-
-       <TextView
-           android:id="@+id/height_value"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentRight="true"
-           android:layout_below="@id/height_label"
-           android:text=""
-           android:textAppearance="?android:attr/textAppearanceSmall" />
-      </RelativeLayout>
-
-    </LinearLayout>
-
-    <LinearLayout
-       xmlns:android="http://schemas.android.com/apk/res/android"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content"
-       android:layout_weight="0"
-       android:baselineAligned="true"
-       android:orientation="horizontal" >
-
-      <RelativeLayout
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-
-       <TextView
-           android:id="@+id/max_speed_label"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:text="@string/max_speed_label" />
-
-       <TextView
-           android:id="@+id/max_speed_value"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentRight="true"
-           android:layout_below="@id/max_speed_label"
-           android:text=""
-           android:textAppearance="?android:attr/textAppearanceSmall" />
-      </RelativeLayout>
-
-      <RelativeLayout
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-
-       <TextView
-           android:id="@+id/max_height_label"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:text="@string/max_height_label" />
-
-       <TextView
-           android:id="@+id/max_height_value"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentRight="true"
-           android:layout_below="@id/max_height_label"
-           android:text=""
-           android:textAppearance="?android:attr/textAppearanceSmall" />
-      </RelativeLayout>
-
-    </LinearLayout>
-
-    <LinearLayout
-       xmlns:android="http://schemas.android.com/apk/res/android"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content"
-       android:layout_weight="0"
-       android:baselineAligned="true"
-       android:orientation="horizontal"
-       android:paddingTop="5dp" >
-
-      <RelativeLayout
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-
-       <TextView
-           android:id="@+id/elevation_label"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:text="@string/elevation_label" />
-
-       <TextView
-           android:id="@+id/elevation_value"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentRight="true"
-           android:layout_below="@id/elevation_label"
-           android:text=""
-           android:textAppearance="?android:attr/textAppearanceSmall" />
-      </RelativeLayout>
-
-      <RelativeLayout
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-
-       <TextView
-           android:id="@+id/range_label"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:text="@string/range_label" />
-
-       <TextView
-           android:id="@+id/range_value"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentRight="true"
-           android:layout_below="@id/range_label"
-           android:text=""
-           android:textAppearance="?android:attr/textAppearanceSmall" />
-      </RelativeLayout>
-
-    </LinearLayout>
-
-    <LinearLayout
-       xmlns:android="http://schemas.android.com/apk/res/android"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content"
-       android:layout_weight="0"
-       android:baselineAligned="true"
-       android:orientation="horizontal"
-       android:paddingTop="5dp" >
-
-      <RelativeLayout
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-
-       <TextView
-           android:id="@+id/bearing_label"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:text="@string/bearing_label" />
-
-       <TextView
-           android:id="@+id/bearing_value"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentRight="true"
-           android:layout_below="@id/bearing_label"
-           android:text=""
-           android:textAppearance="?android:attr/textAppearanceSmall" />
-      </RelativeLayout>
-
-      <RelativeLayout
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-
-       <TextView
-           android:id="@+id/compass_label"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:text="" />
-
-       <TextView
-           android:id="@+id/compass_value"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentRight="true"
-           android:layout_below="@id/compass_label"
-           android:text=""
-           android:textAppearance="?android:attr/textAppearanceSmall" />
-      </RelativeLayout>
-
-    </LinearLayout>
-
-    <LinearLayout
-       xmlns:android="http://schemas.android.com/apk/res/android"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content"
-       android:layout_weight="0"
-       android:baselineAligned="true"
-       android:orientation="horizontal"
-       android:paddingTop="5dp" >
-
-      <RelativeLayout
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-
-       <TextView
-           android:id="@+id/distance_label"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:text="@string/gnd_distance_label" />
-
-       <TextView
-           android:id="@+id/distance_value"
-           android:layout_width="wrap_content"
-           android:layout_height="wrap_content"
-           android:layout_alignParentRight="true"
-           android:layout_below="@id/distance_label"
-           android:text=""
-           android:textAppearance="?android:attr/textAppearanceSmall" />
-      </RelativeLayout>
-
-      <TextView
-         android:layout_width="0dp"
-         android:layout_height="wrap_content"
-         android:layout_weight="1" >
-      </TextView>
-
-    </LinearLayout>
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content">
 
-    <RelativeLayout
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content"
-       android:paddingTop="5dp" >
-
-      <TextView
-         android:id="@+id/lat_label"
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:text="@string/latitude_label" />
-
-      <TextView
-         android:id="@+id/lat_value"
+         >
+
+         <TextView
+             android:id="@+id/speed_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/speed_label" />
+
+         <TextView
+             android:id="@+id/speed_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+
+      <TableRow
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@id/lat_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content"
-       android:paddingTop="5dp" >
-
-      <TextView
-         android:id="@+id/lon_label"
+         >
+
+         <TextView
+             android:id="@+id/height_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/height_label" />
+
+         <TextView
+             android:id="@+id/height_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignParentRight="true"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:text="@string/longitude_label" />
-
-      <TextView
-         android:id="@+id/lon_value"
+         >
+
+         <TextView
+             android:id="@+id/max_speed_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/max_speed_label" />
+
+         <TextView
+             android:id="@+id/max_speed_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@id/lon_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:id="@+id/apogee_view"
-       android:visibility="gone"
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content"
-       android:paddingTop="5dp" >
-
-      <ImageView
-         android:id="@+id/apogee_redled"
+         >
+
+         <TextView
+             android:id="@+id/max_height_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/max_height_label" />
+
+         <TextView
+             android:id="@+id/max_height_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+
+      <TableRow
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:contentDescription="@string/apogee_voltage_label"
-         android:src="@drawable/grayled" />
-
-      <ImageView
-         android:id="@+id/apogee_greenled"
+         >
+
+         <TextView
+             android:id="@+id/elevation_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/elevation_label" />
+
+         <TextView
+             android:id="@+id/elevation_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+
+      <TableRow
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/apogee_redled"
-         android:contentDescription="@string/apogee_voltage_label"
-         android:paddingRight="5dp"
-         android:src="@drawable/grayled" />
-
-      <TextView
-         android:id="@+id/apogee_voltage_label"
+         >
+
+         <TextView
+             android:id="@+id/range_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/range_label" />
+
+         <TextView
+             android:id="@+id/range_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignParentRight="true"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+
+      <TableRow
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/apogee_greenled"
-         android:text="@string/apogee_voltage_label" />
-
-      <TextView
-         android:id="@+id/apogee_voltage_value"
+         >
+
+         <TextView
+             android:id="@+id/bearing_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/bearing_label" />
+
+         <TextView
+             android:id="@+id/bearing_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignParentRight="true"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+
+      <TableRow
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:id="@+id/main_view"
-       android:visibility="gone"
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content"
-       android:paddingTop="5dp" >
-
-      <ImageView
-         android:id="@+id/main_redled"
+         >
+
+         <TextView
+             android:id="@+id/compass_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignParentRight="true"
+             android:layout_column="3"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+
+      <TableRow
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:contentDescription="@string/main_voltage_label"
-         android:src="@drawable/grayled" />
-
-      <ImageView
-         android:id="@+id/main_greenled"
+         >
+
+         <TextView
+             android:id="@+id/distance_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/gnd_distance_label" />
+
+         <TextView
+             android:id="@+id/distance_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignParentRight="true"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+
+
+      <TableRow
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/main_redled"
-         android:contentDescription="@string/main_voltage_label"
-         android:paddingRight="5dp"
-         android:src="@drawable/grayled" />
-
-      <TextView
-         android:id="@+id/main_voltage_label"
+         >
+
+         <TextView
+             android:id="@+id/lat_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/latitude_label" />
+
+         <TextView
+             android:id="@+id/lat_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignParentRight="true"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+
+      <TableRow
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/main_greenled"
-         android:text="@string/main_voltage_label" />
-
-      <TextView
-         android:id="@+id/main_voltage_value"
+         >
+
+         <TextView
+             android:id="@+id/lon_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_column="2"
+             android:text="@string/longitude_label" />
+
+         <TextView
+             android:id="@+id/lon_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignParentRight="true"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+
+      <TableRow
+         android:id="@+id/apogee_view"
+         android:visibility="gone"
+         android:layout_weight="1"
+         android:padding="2dip"
+         android:layout_width="wrap_content"
+         android:layout_height="wrap_content"
+         >
+
+         <ImageView
+             android:id="@+id/apogee_redled"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"
+             android:scaleType="centerInside"
+             android:contentDescription="@string/apogee_voltage_label"
+             android:src="@drawable/grayled" />
+
+         <ImageView
+             android:id="@+id/apogee_greenled"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"
+             android:scaleType="centerInside"
+             android:contentDescription="@string/apogee_voltage_label"
+             android:src="@drawable/grayled" />
+
+         <TextView
+             android:id="@+id/apogee_voltage_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_toRightOf="@id/apogee_greenled"
+             android:text="@string/apogee_voltage_label" />
+
+         <TextView
+             android:id="@+id/apogee_voltage_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignParentRight="true"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+
+      <TableRow
+         android:id="@+id/main_view"
+         android:visibility="gone"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-  </LinearLayout>
+         >
+
+         <ImageView
+             android:id="@+id/main_redled"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"
+             android:scaleType="centerInside"
+             android:paddingRight="5dp"
+             android:contentDescription="@string/main_voltage_label"
+             android:src="@drawable/grayled" />
+
+         <ImageView
+             android:id="@+id/main_greenled"
+             android:layout_width="match_parent"
+             android:layout_height="match_parent"
+             android:scaleType="centerInside"
+             android:contentDescription="@string/main_voltage_label"
+             android:paddingRight="5dp"
+             android:src="@drawable/grayled" />
+
+         <TextView
+             android:id="@+id/main_voltage_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_toRightOf="@id/main_greenled"
+             android:text="@string/main_voltage_label" />
+
+         <TextView
+             android:id="@+id/main_voltage_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignParentRight="true"
+             android:text=""
+             android:textAppearance="?android:attr/textAppearanceSmall" />
+      </TableRow>
+  </TableLayout>
 </LinearLayout>
index 2c21c6483a68c90e3bab05b235c64e198897561e..96f50c15cd77988a1923a3ad7ee6ed5ff4238a74 100644 (file)
@@ -7,7 +7,6 @@
         android:id="@+id/tabLabel"
         android:layout_height="wrap_content"
         android:layout_width="match_parent"
-        android:textSize="13dp"
         android:textColor="#ffffff"
        android:gravity="center_horizontal"
        android:background="#808080"
index 25ae3a8b7a626f5aae4990a3fc5e6d470c746f3c..17c6d3cf81f5fe53ed6e1183f2d38b424297d211 100644 (file)
        android:layout_weight="1"/>
   </FrameLayout>
   
-  <LinearLayout
+  <TableLayout
       xmlns:android="http://schemas.android.com/apk/res/android"
+      android:stretchColumns="1,3"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:baselineAligned="true"
       android:orientation="horizontal" >
 
-    <RelativeLayout
-       android:layout_width="0dp"
-       android:layout_height="wrap_content"
-       android:layout_weight="1"
-       android:paddingTop="5dp" >
-
-      <TextView
-         android:id="@+id/distance_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:paddingRight="4dp"
-         android:text="@string/distance_label" />
-
-      <TextView
-         android:id="@+id/distance_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/distance_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_width="0dp"
-       android:layout_height="wrap_content"
-       android:layout_weight="1"
-       android:paddingTop="5dp" >
-
-      <TextView
-         android:id="@+id/bearing_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:paddingRight="4dp"
-         android:text="@string/bearing_label" />
-
-      <TextView
-         android:id="@+id/bearing_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/bearing_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-  </LinearLayout>
-
-  <LinearLayout
-      xmlns:android="http://schemas.android.com/apk/res/android"
-      android:layout_width="fill_parent"
-      android:layout_height="wrap_content"
-      android:baselineAligned="true"
-      android:orientation="horizontal" >
-
-    <RelativeLayout
-       android:layout_width="0dp"
-       android:layout_height="wrap_content"
-       android:layout_weight="1"
-       android:paddingTop="5dp" >
-
-      <TextView
-         android:id="@+id/target_lat_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:paddingRight="4dp"
-         android:text="@string/target_latitude_label" />
-
-      <TextView
-         android:id="@+id/target_lat_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/target_lat_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_width="0dp"
-       android:layout_height="wrap_content"
-       android:layout_weight="1"
-       android:paddingTop="5dp" >
-
-      <TextView
-         android:id="@+id/target_lon_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:paddingRight="4dp"
-         android:text="@string/target_longitude_label" />
-
-      <TextView
-         android:id="@+id/target_lon_value"
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/target_lon_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-  </LinearLayout>
-
-  <LinearLayout
+         android:layout_height="wrap_content">
+         <TextView
+             android:id="@+id/distance_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:paddingRight="4dp"
+             android:text="@string/distance_label" />
+
+         <TextView
+             android:id="@+id/distance_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_weight="1"
+             android:text="" />
+
+         <TextView
+             android:id="@+id/bearing_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:paddingRight="4dp"
+             android:text="@string/bearing_label" />
+
+         <TextView
+             android:id="@+id/bearing_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+  </TableLayout>
+
+  <TableLayout
       xmlns:android="http://schemas.android.com/apk/res/android"
-      android:layout_width="fill_parent"
+      android:stretchColumns="1,2"
+      android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:baselineAligned="true"
       android:orientation="horizontal" >
 
-    <RelativeLayout
-       android:layout_width="0dp"
-       android:layout_height="wrap_content"
-       android:layout_weight="1"
-       android:paddingTop="5dp" >
-
-      <TextView
-         android:id="@+id/receiver_lat_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:paddingRight="4dp"
-         android:text="@string/receiver_latitude_label" />
-
-      <TextView
-         android:id="@+id/receiver_lat_value"
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/receiver_lat_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_width="0dp"
-       android:layout_height="wrap_content"
-       android:layout_weight="1"
-       android:paddingTop="5dp" >
-
-      <TextView
-         android:id="@+id/receiver_lon_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:paddingRight="4dp"
-         android:text="@string/receiver_longitude_label" />
-
-      <TextView
-         android:id="@+id/receiver_lon_value"
+         android:layout_height="wrap_content">
+
+         <TextView
+             android:id="@+id/target_pos_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:paddingRight="4dp"
+             android:text="@string/target_pos_label" />
+
+         <TextView
+             android:id="@+id/target_lat_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+
+         <TextView
+             android:id="@+id/target_lon_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_toRightOf="@id/receiver_lon_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-  </LinearLayout>
+         android:layout_height="wrap_content">
+
+         <TextView
+             android:id="@+id/receiver_pos_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:paddingRight="4dp"
+             android:text="@string/receiver_pos_label" />
+
+         <TextView
+             android:id="@+id/receiver_lat_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+
+         <TextView
+             android:id="@+id/receiver_lon_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+  </TableLayout>
 </LinearLayout>
index 990a6be356a06b7768ac6fcbab1c994a1a925bb5..981f45a880bc7901868618054b07f4aa4e35d365 100644 (file)
       
       <ImageView
          android:id="@+id/battery_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/battery_voltage_label"
          android:src="@drawable/grayled"
          />
 
       <ImageView
          android:id="@+id/battery_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
          android:contentDescription="@string/battery_voltage_label"
+         android:paddingRight="5dp"
          android:src="@drawable/grayled" />
 
       <TextView
 
       <ImageView
          android:id="@+id/receiver_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/receiver_voltage_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/receiver_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/receiver_voltage_label"
          android:src="@drawable/grayled" />
 
 
       <ImageView
          android:id="@+id/logging_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/logging_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/logging_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/logging_label"
          android:src="@drawable/grayled" />
 
 
       <ImageView
          android:id="@+id/gps_locked_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/gps_locked_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/gps_locked_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/gps_locked_label"
          android:src="@drawable/grayled" />
 
 
       <ImageView
          android:id="@+id/gps_ready_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/gps_ready_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/gps_ready_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/gps_ready_label"
          android:src="@drawable/grayled" />
 
 
       <ImageView
          android:id="@+id/apogee_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/apogee_voltage_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/apogee_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/apogee_voltage_label"
          android:src="@drawable/grayled" />
 
 
       <ImageView
          android:id="@+id/main_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/main_voltage_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/main_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/main_voltage_label"
          android:src="@drawable/grayled" />
 
 
       <ImageView
          android:id="@+id/ignite_a_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/ignite_a_voltage_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/ignite_a_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/ignite_a_voltage_label"
          android:src="@drawable/grayled" />
 
 
       <ImageView
          android:id="@+id/ignite_b_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/ignite_b_voltage_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/ignite_b_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/ignite_b_voltage_label"
          android:src="@drawable/grayled" />
 
 
       <ImageView
          android:id="@+id/ignite_c_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/ignite_c_voltage_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/ignite_c_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/ignite_c_voltage_label"
          android:src="@drawable/grayled" />
 
 
       <ImageView
          android:id="@+id/ignite_d_redled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/ignite_d_voltage_label"
          android:src="@drawable/grayled" />
 
       <ImageView
          android:id="@+id/ignite_d_greenled"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:scaleType="centerInside"
+         android:paddingRight="5dp"
          android:contentDescription="@string/ignite_d_voltage_label"
          android:src="@drawable/grayled" />
 
index 7d1e750de9a33d4b8d8f2977f502a915f0c68ced..090f3ddae3839e2630829b46ba25c74b97b67bda 100644 (file)
     android:layout_height="wrap_content"
     android:orientation="vertical" >
 
-  <LinearLayout
-      xmlns:android="http://schemas.android.com/apk/res/android"
-      android:layout_weight="0"
-      android:layout_width="fill_parent"
-      android:layout_height="wrap_content"
-      android:orientation="vertical" >
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
+    <TableLayout
+       xmlns:android="http://schemas.android.com/apk/res/android"
+       android:stretchColumns="0,1"
+       android:layout_weight="0"
        android:layout_width="wrap_content"
-       android:layout_height="wrap_content" >
-
-      <TextView
-         android:id="@+id/bearing_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/bearing_label" />
-
-      <TextView
-         android:id="@+id/bearing_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@+id/bearing_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content" >
+       android:layout_height="wrap_content">
 
-      <TextView
-         android:id="@+id/direction_label"
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:text="@string/direction_label" />
+         >
 
-      <TextView
-         android:id="@+id/direction_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@+id/direction_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content">
+         <TextView
+             android:id="@+id/bearing_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/bearing_label" />
 
-      <TextView
-         android:id="@+id/distance_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/distance_label" />
+         <TextView
+             android:id="@+id/bearing_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
 
-      <TextView
-         android:id="@+id/distance_value"
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@+id/distance_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content">
+         >
 
-      <TextView
-         android:id="@+id/target_lat_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/target_latitude_label" />
+         <TextView
+             android:id="@+id/direction_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/direction_label" />
 
-      <TextView
-         android:id="@+id/target_lat_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@id/target_lat_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content">
+         <TextView
+             android:id="@+id/direction_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
 
-      <TextView
-         android:id="@+id/target_lon_label"
-         android:layout_width="wrap_content"
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
+         android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:text="@string/target_longitude_label" />
+         >
 
-      <TextView
-         android:id="@+id/target_lon_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@id/target_lon_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content">
+         <TextView
+             android:id="@+id/distance_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/distance_label" />
 
-      <TextView
-         android:id="@+id/receiver_lat_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/receiver_latitude_label" />
+         <TextView
+             android:id="@+id/distance_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
 
-      <TextView
-         android:id="@+id/receiver_lat_value"
-         android:layout_width="wrap_content"
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
+         android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@id/receiver_lat_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content">
+         >
+
+         <TextView
+             android:id="@+id/target_lat_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/target_latitude_label" />
 
-      <TextView
-         android:id="@+id/receiver_lon_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/receiver_longitude_label" />
+         <TextView
+             android:id="@+id/target_lat_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
 
-      <TextView
-         android:id="@+id/receiver_lon_value"
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@id/receiver_lon_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content">
+         >
 
-      <TextView
-         android:id="@+id/max_height_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/max_height_label" />
+         <TextView
+             android:id="@+id/target_lon_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/target_longitude_label" />
 
-      <TextView
-         android:id="@+id/max_height_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@id/max_height_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content">
+         <TextView
+             android:id="@+id/target_lon_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
 
-      <TextView
-         android:id="@+id/max_speed_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/max_speed_label" />
+      </TableRow>
 
-      <TextView
-         android:id="@+id/max_speed_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@id/max_speed_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-
-    <RelativeLayout
-       android:layout_gravity="fill"
-       android:layout_weight="1"
-       android:layout_width="wrap_content"
-       android:layout_height="wrap_content">
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
+         android:layout_width="wrap_content"
+         android:layout_height="wrap_content"
+         >
+
+         <TextView
+             android:id="@+id/receiver_lat_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/receiver_latitude_label" />
+
+         <TextView
+             android:id="@+id/receiver_lat_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
+         android:layout_width="wrap_content"
+         android:layout_height="wrap_content"
+         >
+
+         <TextView
+             android:id="@+id/receiver_lon_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/receiver_longitude_label" />
+
+         <TextView
+             android:id="@+id/receiver_lon_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text=""/>
+      </TableRow>
+
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
+         android:layout_width="wrap_content"
+         android:layout_height="wrap_content"
+         >
+
+         <TextView
+             android:id="@+id/max_height_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/max_height_label" />
 
-      <TextView
-         android:id="@+id/max_accel_label"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/max_accel_label" />
+         <TextView
+             android:id="@+id/max_height_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
+         android:layout_width="wrap_content"
+         android:layout_height="wrap_content"
+         >
+
+
+         <TextView
+             android:id="@+id/max_speed_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/max_speed_label" />
 
-      <TextView
-         android:id="@+id/max_accel_value"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_alignParentRight="true"
-         android:layout_below="@id/max_accel_label"
-         android:text=""
-         android:textAppearance="?android:attr/textAppearanceSmall" />
-    </RelativeLayout>
-  </LinearLayout>
+         <TextView
+             android:id="@+id/max_speed_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+
+      <TableRow
+         android:layout_gravity="center"
+         android:layout_weight="1"
+         android:padding="2dip"
+         android:layout_width="wrap_content"
+         android:layout_height="wrap_content"
+         >
+
+         <TextView
+             android:id="@+id/max_accel_label"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="@string/max_accel_label" />
+
+         <TextView
+             android:id="@+id/max_accel_value"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:text="" />
+      </TableRow>
+  </TableLayout>
 </LinearLayout>
diff --git a/altosdroid/app/src/main/res/layout/tracker_ent.xml b/altosdroid/app/src/main/res/layout/tracker_ent.xml
new file mode 100644 (file)
index 0000000..4b06663
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Copyright © 2020 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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.
+
+-->
+<TableRow
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_gravity="center"
+    android:layout_weight="1"
+    android:padding="2dip"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    >
+    <TextView
+       android:id="@+id/call_view"
+       android:layout_width="wrap_content"
+       android:layout_height="wrap_content"
+       android:paddingRight="3dp"
+       android:text="" />
+    <TextView
+       android:id="@+id/serial_view"
+       android:layout_width="wrap_content"
+       android:layout_height="wrap_content"
+       android:paddingRight="3dp"
+       android:text="" />
+    <TextView
+       android:id="@+id/frequency_view"
+       android:layout_width="wrap_content"
+       android:layout_height="wrap_content"
+       android:paddingRight="3dp"
+       android:text="" />
+    <TextView
+       android:id="@+id/age_view"
+       android:layout_width="wrap_content"
+       android:layout_height="wrap_content"
+       android:text="" />
+</TableRow>
diff --git a/altosdroid/app/src/main/res/layout/tracker_list.xml b/altosdroid/app/src/main/res/layout/tracker_list.xml
new file mode 100644 (file)
index 0000000..a5123a7
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Copyright © 2020 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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.
+
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    >
+    <ScrollView
+       android:layout_width="match_parent"
+       android:layout_height="match_parent"
+       >
+       <TableLayout
+           xmlns:android="http://schemas.android.com/apk/res/android"
+           android:id="@+id/tracker_list"
+           android:orientation="vertical"
+           android:layout_width="match_parent"
+           android:layout_height="wrap_content"
+           android:stretchColumns="1,2,3,4">
+           <TableRow
+               android:id="@+id/tracker_row"
+               android:layout_gravity="center"
+               android:layout_weight="1"
+               android:padding="2dip"
+               android:layout_width="match_parent"
+               android:layout_height="wrap_content"
+               >
+               <RadioButton
+                   android:id="@+id/call_button"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:text="@string/callsign_label" />
+               <RadioButton
+                   android:id="@+id/serial_button"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:text="@string/serial_label" />
+               <RadioButton
+                   android:id="@+id/frequency_button"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:text="@string/freq_label" />
+               <RadioButton
+                   android:id="@+id/age_button"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:text="@string/age_label" />
+           </TableRow>
+       </TableLayout>
+    </ScrollView>
+</LinearLayout>
index 435809665dcd382956eda1aa68f751cfd9b47175..c61451d93fa3019810dc838a3be5d2d7c14a0b74 100644 (file)
@@ -1,6 +1,44 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <resources>
-  <style name="CustomTheme" parent="android:Theme.Material.Light">
-  </style>
+    <style name="Small" parent="android:Theme.Material.Light">
+       <item name="android:textColor">#000000</item>
+       <item name="android:textSize">12sp</item>
+       <item name="android:lineHeight">14sp</item>
+    </style>
+    <style name="Medium" parent="android:Theme.Material.Light">
+       <item name="android:textColor">#000000</item>
+       <item name="android:textSize">15sp</item>
+       <item name="android:lineHeight">18sp</item>
+    </style>
+    <style name="Large" parent="android:Theme.Material.Light">
+       <item name="android:textColor">#000000</item>
+       <item name="android:textSize">20sp</item>
+       <item name="android:lineHeight">40sp</item>
+    </style>
+    <style name="Extra" parent="android:Theme.Material.Light">
+       <item name="android:textColor">#000000</item>
+       <item name="android:textSize">27sp</item>
+       <item name="android:lineHeight">32sp</item>
+    </style>
+    <style name="Small.Dialog" parent="android:Theme.Material.Light.Dialog">
+       <item name="android:textColor">#000000</item>
+       <item name="android:textSize">12sp</item>
+       <item name="android:lineHeight">14sp</item>
+    </style>
+    <style name="Medium.Dialog" parent="android:Theme.Material.Light.Dialog">
+       <item name="android:textColor">#000000</item>
+       <item name="android:textSize">15sp</item>
+       <item name="android:lineHeight">18sp</item>
+    </style>
+    <style name="Large.Dialog" parent="android:Theme.Material.Light.Dialog">
+       <item name="android:textColor">#000000</item>
+       <item name="android:textSize">20sp</item>
+       <item name="android:lineHeight">40sp</item>
+    </style>
+    <style name="Extra.Dialog" parent="android:Theme.Material.Light.Dialog">
+       <item name="android:textColor">#000000</item>
+       <item name="android:textSize">27sp</item>
+       <item name="android:lineHeight">32sp</item>
+    </style>
 </resources>
index 55dc845b1c90d0828f690b1dedb3b4e2fdbe353e..12b6d04f98c209f2be83cb84ec381f5a7540d827 100644 (file)
        <string name="select_tracker">Select Tracker</string>
        <string name="delete_track">Delete Track</string>
        <string name="map_type">Map Type</string>
-       <string name="map_source">Toggle Online/Offline maps</string>
+       <string name="map_source">Map Source</string>
 
        <!-- MapTypeActivity -->
        <!-- <string name="map_type">Map Type</string> -->
 
        <!-- DeviceListActivity -->
-       <string name="scanning">scanning for devices…</string>
-       <string name="select_device">select a device to connect</string>
+       <string name="scanning">Scanning…</string>
+       <string name="select_device">Select device</string>
        <string name="none_paired">No devices have been paired</string>
        <string name="none_found">No devices found</string>
        <string name="title_paired_devices">Paired Devices</string>
        <string name="title_other_devices">Other Available Devices</string>
        <string name="button_scan">Scan for devices</string>
 
+       <!-- TrackerListActivity -->
+       <string name="freq_label">Freq</string>
+
        <!-- Service -->
        <string name="telemetry_service_label">AltosDroid Telemetry Service</string>
        <string name="telemetry_service_started">Telemetry Service Started</string>
@@ -59,7 +62,7 @@
 
        <!-- UI fields -->
        <!-- Header -->
-       <string name="callsign_label">Callsign</string>
+       <string name="callsign_label">Call</string>
        <string name="serial_label">Serial</string>
        <string name="flight_label">Flight</string>
        <string name="state_label">State</string>
@@ -92,6 +95,8 @@
        <string name="gps_ready_label">GPS Ready</string>
        <string name="latitude_label">Latitude</string>
        <string name="longitude_label">Longitude</string>
+       <string name="target_pos_label">Tar</string>
+       <string name="receiver_pos_label">Me</string>
        <string name="target_latitude_label">Tar Lat</string>
        <string name="target_longitude_label">Tar Lon</string>
        <string name="receiver_latitude_label">My Lat</string>
 
        <!-- Idle mode -->
        <string name="idle_mode">Idle Mode</string>
-       <string name="set_callsign_label">Callsign</string>
+       <string name="set_callsign_label">Callsign</string>
        <string name="connect_idle">Monitor</string>
        <string name="disconnect_idle">Disconnect</string>
        <string name="reboot_idle">Reboot</string>
        <!-- <string name="map_type">Map Type</string> -->
        <!-- <string name="map_source">Map Source</string> -->
        <!-- <string name="preload_maps">Preload Maps</string> -->
+       <string name="font_size">Text Size</string>
        <string name="manage_frequencies">Manage Frequencies</string>
        <string name="done">OK</string>
        
index 8bc6db6dd8c8e439f92ecab1e6961d922f23b6c1..8087ad8a12b3a798a7ed63ffc925ce50c5d682f9 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index be5497a36690e85f080775bae3cc0beef07a73cf..38c4182cfef5da2b5fe9cb997722473e0e471b7a 100644 (file)
@@ -16,7 +16,7 @@
  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.concurrent.*;
index 2c5439b4bf7588c5e1cda961fdd08e48741be31e..f94f136d5f69f2d20972ae9c4f3e5751f8b2459e 100644 (file)
@@ -16,7 +16,7 @@
  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.concurrent.*;
index 2129ed6eca825eec988addb7e75f9a06a56926b0..621cceeb723f1e7f5d4ecc38b46de16635455d99 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.*;
 
@@ -31,13 +31,11 @@ public class AltosAdxl375 implements Cloneable {
 
        public boolean parse_line(String line) throws NumberFormatException {
                if (line.startsWith("ADXL375 value")) {
-                       System.out.printf("adxl parse line %s\n", line);
                        String[] items = line.split("\\s+");
                        if (axis == AltosLib.MISSING)
                                throw new NumberFormatException("No ADXL375 axis specified");
                        if (items.length >= 3) {
                                accel = Integer.parseInt(items[2 + axis]);
-                               System.out.printf("accel %d\n", accel);
                                return true;
                        }
                }
index f9687654cb0157cf8b3187ca2905b77c3a141ceb..39bd7fa7ae3356bd4f3129abde83a15960d1aa4d 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosCRCException extends Exception {
        public int rssi;
index a08db23e5e938f9ebe53d93925300f9cc2c2ebab..d09ad93b11ac6ce9a88eb1d76cc21a92219415c3 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index 22d19def1ba9397fbdec3ab510131407afe8bdf8..6667d926ed91229a0597c099b5eb53cab972c235 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 /*
  * Calibration and other data needed to construct 'real' values from various data
@@ -247,6 +247,10 @@ public class AltosCalData {
 
        public int              state = AltosLib.MISSING;
 
+       public String state_name() {
+               return AltosLib.state_name(state);
+       }
+
        public void set_state(int state) {
                if (state >= AltosLib.ao_flight_boost && boost_tick == AltosLib.MISSING)
                        set_boost_tick();
@@ -301,6 +305,12 @@ public class AltosCalData {
                return temp_gps;
        }
 
+       public int      imu_type = AltosLib.MISSING;;
+
+       public void set_imu_type(int imu_type) {
+               this.imu_type = imu_type;
+       }
+
        public double   accel_zero_along, accel_zero_across, accel_zero_through;
 
        public void set_accel_zero(double zero_along, double zero_across, double zero_through) {
@@ -312,15 +322,15 @@ public class AltosCalData {
        }
 
        public double accel_along(double counts) {
-               return AltosIMU.convert_accel(counts - accel_zero_along);
+               return AltosIMU.convert_accel(counts - accel_zero_along, imu_type);
        }
 
        public double accel_across(double counts) {
-               return AltosIMU.convert_accel(counts - accel_zero_across);
+               return AltosIMU.convert_accel(counts - accel_zero_across, imu_type);
        }
 
        public double accel_through(double counts) {
-               return AltosIMU.convert_accel(counts - accel_zero_through);
+               return AltosIMU.convert_accel(counts - accel_zero_through, imu_type);
        }
 
        public double   gyro_zero_roll, gyro_zero_pitch, gyro_zero_yaw;
@@ -338,19 +348,19 @@ public class AltosCalData {
                if (gyro_zero_roll == AltosLib.MISSING || counts == AltosLib.MISSING)
                        return AltosLib.MISSING;
 
-               return AltosIMU.gyro_degrees_per_second(counts, gyro_zero_roll);
+               return AltosIMU.gyro_degrees_per_second(counts - gyro_zero_roll, imu_type);
        }
 
        public double gyro_pitch(double counts) {
                if (gyro_zero_pitch == AltosLib.MISSING || counts == AltosLib.MISSING)
                        return AltosLib.MISSING;
-               return AltosIMU.gyro_degrees_per_second(counts, gyro_zero_pitch);
+               return AltosIMU.gyro_degrees_per_second(counts - gyro_zero_pitch, imu_type);
        }
 
        public double gyro_yaw(double counts) {
                if (gyro_zero_yaw == AltosLib.MISSING || counts == AltosLib.MISSING)
                        return AltosLib.MISSING;
-               return AltosIMU.gyro_degrees_per_second(counts, gyro_zero_yaw);
+               return AltosIMU.gyro_degrees_per_second(counts - gyro_zero_yaw, imu_type);
        }
 
        private double gyro_zero_overflow(double first) {
@@ -383,19 +393,19 @@ public class AltosCalData {
        public double mag_along(double along) {
                if (along == AltosLib.MISSING)
                        return AltosLib.MISSING;
-               return AltosMag.convert_gauss(along);
+               return AltosIMU.convert_gauss(along, imu_type, AltosIMU.mag_along_axis(imu_type));
        }
 
        public double mag_across(double across) {
                if (across == AltosLib.MISSING)
                        return AltosLib.MISSING;
-               return AltosMag.convert_gauss(across);
+               return AltosIMU.convert_gauss(across, imu_type, AltosIMU.mag_across_axis(imu_type));
        }
 
        public double mag_through(double through) {
                if (through == AltosLib.MISSING)
                        return AltosLib.MISSING;
-               return AltosMag.convert_gauss(through);
+               return AltosIMU.convert_gauss(through, imu_type, AltosIMU.mag_through_axis(imu_type));
        }
 
        public AltosCalData() {
index 1e1bad98b25330d27261ce239517b467df4a01e6..9342af3a40b96531d8554ca8f34d66a95da3b9d6 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index 04129c44d456d901d7449fd3d505a521aded2471..474af359a5fc926103d4a9794431275e4a49f449 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 import java.text.*;
@@ -200,6 +200,7 @@ public class AltosConfigData {
                case AltosLib.AO_LOG_FORMAT_TELEMETRUM:
                case AltosLib.AO_LOG_FORMAT_TELEMEGA:
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_3:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        return 4095 - value;
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
                        return -value;
@@ -591,6 +592,8 @@ public class AltosConfigData {
                                return true;
                        if (product.startsWith("TeleMetrum-v3"))
                                return true;
+                       if (product.startsWith("TeleMega-v4"))
+                               return true;
                }
                throw new AltosUnknownProduct(product);
        }
@@ -601,6 +604,8 @@ public class AltosConfigData {
                                return AltosAdxl375.X_AXIS;
                        if (product.startsWith("TeleMetrum-v3"))
                                return AltosAdxl375.X_AXIS;
+                       if (product.startsWith("TeleMega-v4"))
+                               return AltosAdxl375.X_AXIS;
                }
                throw new AltosUnknownProduct(product);
        }
index 48ec35df09f2a4e0a63fb163fb7e43b3bfb614c2..b538d90fc83111d4e641f980e7721d6e891756e8 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosConfigDataException extends Exception {
 
index 9d02b2f0d42a61abab74964ef5b48e60d7a2bb32..b12a610ceeaabc36e16b2e49c6b1664c6ad3eb9a 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosConfigValues {
        /* set and get all of the dialog values */
index ce1b8f7f14f7733a29722e6eedd62090733ed63f..63cdfa6092db2e30b2f70bb00491cde2c4ff47b5 100644 (file)
@@ -19,7 +19,7 @@
 /*
  * Sensor data conversion functions
  */
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 
@@ -473,7 +473,7 @@ public class AltosConvert {
 
        public static AltosPyroName pyro_name = new AltosPyroName();
 
-       public static AltosUnits magnetic_field = null;
+       public static AltosUnits magnetic_field = new AltosGauss();
 
        public static String show_gs(String format, double a) {
                a = meters_to_g(a);
index 496235c3c843fa5f2595a6b74d7f12ced91f35bc..ad76f833456fc0985572774f097134776bbe486d 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public abstract class AltosDataListener {
 
@@ -70,6 +70,10 @@ public abstract class AltosDataListener {
                return time;
        }
 
+       public String state_name() {
+               return cal_data().state_name();
+       }
+
        public void set_state(int state) {
                cal_data().set_state(state);
        }
@@ -114,7 +118,7 @@ public abstract class AltosDataListener {
        public abstract void set_apogee_voltage(double volts);
        public abstract void set_main_voltage(double volts);
 
-       public void set_gps(AltosGPS gps) {
+       public void set_gps(AltosGPS gps, boolean set_location, boolean set_sats) {
                AltosCalData cal_data = cal_data();
                cal_data.set_cal_gps(gps);
        }
index bb179580c7f7588422ce35bb7206ec911bebdd61..3425af7ca9d3d9c1482a6f8f03704bbffe4002f8 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosDataProvider {
        public void     provide_data(AltosDataListener listener) throws InterruptedException, AltosUnknownProduct;
index 57e97a18fe36cd50e92479b47ab05583d30625b2..117b04504ee4968de26ce14480a44fcd228a0182 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index 6560f9ed10a51ab2b554ff21505e29605028c71c..9531a27e4e56c751d4231f5161f5929bcdfdbaa0 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosDistance extends AltosUnits {
 
index 1ececde19bca9e61371aa1077cb6adad645fe14c..08c323fb0c071036201f8973e6c91796c79002a1 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 import java.io.*;
index 1c1e80c7d20714ac821af6c35841174edaf2a999..6eecde3bf099654f6445b3c01211e2d367a2a4ab 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.text.*;
 import java.util.concurrent.*;
index f305ed336ece9d7c9f68bc753deab5107c5dae65..8d0738dc941ee0618aa65e8c1b388959b2966ed4 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
@@ -45,8 +45,8 @@ class AltosEepromNameData extends AltosDataListener {
                avoid_duplicate_files = true;
        }
 
-       public void set_gps(AltosGPS gps) {
-               super.set_gps(gps);
+       public void set_gps(AltosGPS gps, boolean set_location, boolean set_sats) {
+               super.set_gps(gps, set_location, set_sats);
                if (gps != null &&
                    gps.year != AltosLib.MISSING &&
                    gps.month != AltosLib.MISSING &&
index 328a0fabf5f1f277c6e7bbecee2e303b409cd7a7..22d9d3f4cea999c9e666dfaea4065ea795753d10 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index a9551d85b4b9b97924c1072c192caac93e853724..1abc638b8290f681a88991cf29e2a69f1ace16f4 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index 0da3e991dcee4b13dd7348771fcd277a44c4d58b..d3407715afe2ea58fe03fe01ce55a38e822b4f38 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.text.*;
index f58df11b7e13a54a14259943e36bc47bce9c2cf6..e480f224d40ee0bcc0a32b7a60576dbabfd3befd 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index 22cb8f894b2f7d73ac5078032b09026304d01b06..bad50329a2c0b75f1ceffa62bd6ae8d5b8a73522 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public abstract class AltosEepromRecord implements Comparable<AltosEepromRecord> {
 
@@ -106,7 +106,7 @@ public abstract class AltosEepromRecord implements Comparable<AltosEepromRecord>
                if (!AltosLib.is_gps_cmd(cmd())) {
                        AltosGPS gps = listener.temp_gps();
                        if (gps != null)
-                               listener.set_gps(gps);
+                               listener.set_gps(gps, true, true);
                }
        }
 
index 38b6c841518983e39a9ff0c8dc73e081a89284f7..7b772e9a49e6b8a98af8679b2c8b9b096ee6ae28 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index dc421d8dd70b948ad5613ea95b691bceee416597..3e255f8a6a5e57903eeb7da77c5cbc0bea078e2a 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosEepromRecordFull extends AltosEepromRecord {
        public static final int record_length = 8;
index e2fd7928aa2b9ffdf590ec096b1b6b0d4bc7d939..83fb9f18cdd41e0a18c904440847c654d4c86d36 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
@@ -123,7 +123,7 @@ public class AltosEepromRecordGps extends AltosEepromRecord {
                                if (gps.vdop < 0.8)
                                        gps.vdop += 2.56;
                        }
-                       listener.set_gps(gps);
+                       listener.set_gps(gps, true, true);
                        break;
                }
        }
index ce9dbc109e4955c40766c484b738e1d51aa947f4..b858e7098d7f8907938fd8da40c3ccc7e04bc827 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosEepromRecordMega extends AltosEepromRecord {
        public static final int record_length = 32;
@@ -33,6 +33,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                case AltosLib.AO_LOG_FORMAT_TELEMEGA:
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_3:
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        return data32(16);
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
                        return data16(14);
@@ -45,6 +46,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                case AltosLib.AO_LOG_FORMAT_TELEMEGA:
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_3:
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        return data32(20);
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
                        return data16(16);
@@ -57,6 +59,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                case AltosLib.AO_LOG_FORMAT_TELEMEGA:
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_3:
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        return data32(24);
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
                        return data16(18);
@@ -82,6 +85,22 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
        private int mag_z() { return data16(22); }
        private int mag_y() { return data16(24); }
 
+       private int imu_type() {
+               switch (log_format) {
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
+                       return AltosIMU.imu_type_telemega_v1_v2;
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_3:
+                       return AltosIMU.imu_type_telemega_v3;
+               case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+                       return AltosIMU.imu_type_easymega_v2;
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
+                       return AltosIMU.imu_type_telemega_v4;
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
        private int accel_across() {
                switch (log_format) {
                case AltosLib.AO_LOG_FORMAT_TELEMEGA:
@@ -89,6 +108,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
                        return accel_x();
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        return -accel_y();
                default:
                        return AltosLib.MISSING;
@@ -102,6 +122,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
                        return accel_y();
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        return accel_x();
                default:
                        return AltosLib.MISSING;
@@ -120,6 +141,8 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                        return gyro_x();
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
                        return -gyro_y();
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
+                       return -gyro_y();
                default:
                        return AltosLib.MISSING;
                }
@@ -132,6 +155,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
                        return gyro_y();
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        return gyro_x();
                default:
                        return AltosLib.MISSING;
@@ -150,6 +174,8 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                        return mag_x();
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
                        return -mag_y();
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
+                       return mag_y();
                default:
                        return AltosLib.MISSING;
                }
@@ -162,6 +188,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
                        return mag_y();
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        return mag_x();
                default:
                        return AltosLib.MISSING;
@@ -212,14 +239,16 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
 
                AltosGPS        gps;
 
+               cal_data.set_imu_type(imu_type());
+
                switch (cmd()) {
                case AltosLib.AO_LOG_FLIGHT:
                        cal_data.set_flight(flight());
                        cal_data.set_ground_accel(ground_accel());
                        cal_data.set_ground_pressure(ground_pres());
-                       listener.set_accel_ground(ground_accel_along(),
-                                                 ground_accel_across(),
-                                                 ground_accel_through());
+                       listener.set_accel_ground(cal_data.accel_along(ground_accel_along()),
+                                                 cal_data.accel_across(ground_accel_across()),
+                                                 cal_data.accel_through(ground_accel_through()));
                        cal_data.set_gyro_zero(ground_roll() / 512.0,
                                               ground_pitch() / 512.0,
                                               ground_yaw() / 512.0);
@@ -258,16 +287,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord {
                                         cal_data.mag_across(mag_across),
                                         cal_data.mag_through(mag_through));
 
-
-                       final double lsb_per_g = 1920.0/105.5;
-
-                       double acceleration = AltosConvert.acceleration_from_sensor(
-                               accel(),
-                               cal_data.ground_accel,
-                               cal_data.ground_accel + 2 * lsb_per_g,
-                               cal_data.ground_accel);
-
-                       listener.set_acceleration(acceleration);
+                       listener.set_acceleration(cal_data.acceleration(accel()));
                        break;
                case AltosLib.AO_LOG_TEMP_VOLT:
                        listener.set_battery_voltage(AltosConvert.mega_battery_voltage(v_batt()));
index 102d1407f7ce3121c7111fed312c8b084672f0f8..848f4fb16eecd682d530ec20a976a7efa9bf2ba8 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosEepromRecordMetrum extends AltosEepromRecord {
        public static final int record_length = 16;
index 06ae71f8b3f55186278824ef025abf4525cf8269..5f201c2f80d7de8c9cc79b1399c8a9531f69d48e 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosEepromRecordMicroPeak2 extends AltosEepromRecord {
        public static final int record_length = 2;
index 2d212df09df88074a87a3068a7c312bc340e4aef..d440e929559b859719b285f019e25b9d8a4b3da5 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosEepromRecordMini extends AltosEepromRecord {
        public static final int record_length = 16;
index 5e2adba34c00ae9cf4e4a9915f52d8b531d75252..689eaea67553f725aa3fc8b598af8d354309d00b 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
@@ -27,24 +27,32 @@ public class AltosEepromRecordSet implements AltosRecordSet {
                return eeprom.config_data();
        }
 
+       private void init_cal_data() {
+               for (AltosEepromRecord record : ordered) {
+                       if (record.cmd() == AltosLib.AO_LOG_FLIGHT) {
+                               cal_data.set_tick(record.tick());
+                               cal_data.set_boost_tick();
+                               cal_data.set_state(AltosLib.ao_flight_pad);
+                               break;
+                       }
+               }
+       }
+
        public AltosCalData cal_data() {
                if (cal_data == null) {
                        cal_data = new AltosCalData(config_data());
-                       for (AltosEepromRecord record : ordered) {
-                               if (record.cmd() == AltosLib.AO_LOG_FLIGHT) {
-                                       cal_data.set_tick(record.tick());
-                                       cal_data.set_boost_tick();
-                                       break;
-                               }
-                       }
+                       init_cal_data();
                }
                return cal_data;
        }
 
        public void capture_series(AltosDataListener listener) {
-               AltosCalData    cal_data = cal_data();
-
-               cal_data.reset();
+               if (cal_data == null) {
+                       cal_data();
+               } else {
+                       cal_data.reset();
+                       init_cal_data();
+               }
                listener.set_log_format(config_data().log_format);
 
                for (AltosEepromRecord record : ordered) {
@@ -77,6 +85,7 @@ public class AltosEepromRecordSet implements AltosRecordSet {
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_3:
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
                case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        record = new AltosEepromRecordMega(eeprom);
                        break;
                case AltosLib.AO_LOG_FORMAT_TELEMETRUM:
index 428a9fc59a8709fd8b1a06fa5a506d8a58bd59de..8dd6f9c061903c8aae98caaf38f70b6a64130122 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosEepromRecordTiny extends AltosEepromRecord implements AltosDataProvider {
        public static final int record_length = 2;
index e96b19db823c87cd274ded9002bb6ef1f6432f40..1cc9da889d16b7a94dc010eb7bc1f7dccdc9ac5b 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.File;
 import java.util.*;
index d870c08326ddd0014202d5c6ad48df1c40242dce..8a61a4a2b6ba8457322af2ddb7cec5e89f4ab550 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosFilterListener {
        void filter_changed(double speed_filter, double accel_filter);
index 434a02653a2eec993b55e794222f416e6a554404..30ae65a7a77316bcd0a446c9b3b4d39096565e82 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index 120e714688533dc45aef64f99dc738b4b2e08f30..7fcbb5411dd13025ceee66f466cf42c6f907903b 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosFlashListener {
 
index 7743fda546249d2e7b068c48ba8f827d17fd49c3..4be621e198714c1cdd2c5069ed40a502cdfb08ae 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosFlightDisplay extends AltosUnitsListener, AltosFontListener {
        void reset();
index a4724f0450986f355e303f9191129b5b4aa6210b..8cde36193469f58d86699d9271f30b66cbc5c547 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.text.*;
 import java.io.*;
index 32bd6c5ef63f6aae98d0fef1fb0141f45efc7fcd..ef4ef4dfc6dcebb8432a5192b793e06b0b650006 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 
@@ -380,8 +380,10 @@ public class AltosFlightSeries extends AltosDataListener {
        }
 
        public AltosTimeSeries orient_series;
+       public AltosTimeSeries azimuth_series;
 
        public static final String orient_name = "Tilt Angle";
+       public static final String azimuth_name = "Azimuth Angle";
 
        private void compute_orient() {
 
@@ -391,21 +393,26 @@ public class AltosFlightSeries extends AltosDataListener {
                if (accel_ground_across == AltosLib.MISSING)
                        return;
 
-               if (cal_data().pad_orientation == AltosLib.MISSING)
+               AltosCalData cal_data = cal_data();
+
+               if (cal_data.pad_orientation == AltosLib.MISSING)
                        return;
 
-               if (cal_data().accel_zero_across == AltosLib.MISSING)
+               if (cal_data.accel_zero_across == AltosLib.MISSING)
                        return;
 
-               AltosRotation rotation = new AltosRotation(AltosIMU.convert_accel(accel_ground_across - cal_data().accel_zero_across),
-                                                          AltosIMU.convert_accel(accel_ground_through - cal_data().accel_zero_through),
-                                                          AltosIMU.convert_accel(accel_ground_along - cal_data().accel_zero_along),
-                                                          cal_data().pad_orientation);
+               AltosRotation rotation = new AltosRotation(accel_ground_across,
+                                                          accel_ground_through,
+                                                          accel_ground_along,
+                                                          cal_data.pad_orientation);
                double prev_time = ground_time;
 
                orient_series = add_series(orient_name, AltosConvert.orient);
                orient_series.add(ground_time, rotation.tilt());
 
+               azimuth_series = add_series(azimuth_name, AltosConvert.orient);
+               azimuth_series.add(ground_time, rotation.azimuth());
+
                for (AltosTimeValue roll_v : gyro_roll) {
                        double  time = roll_v.time;
                        double  dt = time - prev_time;
@@ -417,6 +424,7 @@ public class AltosFlightSeries extends AltosDataListener {
 
                                rotation.rotate(pitch, yaw, roll);
                                orient_series.add(time, rotation.tilt());
+                               azimuth_series.add(time, rotation.azimuth());
                        }
                        prev_time = time;
                }
@@ -540,63 +548,68 @@ public class AltosFlightSeries extends AltosDataListener {
        public static final String gps_vdop_name = "GPS Vertical Dilution of Precision";
        public static final String gps_hdop_name = "GPS Horizontal Dilution of Precision";
 
-       public void set_gps(AltosGPS gps) {
-               super.set_gps(gps);
+       public void set_gps(AltosGPS gps, boolean new_location, boolean new_sats) {
+               super.set_gps(gps, new_location, new_sats);
+               AltosCalData cal_data = cal_data();
                if (gps_series == null)
                        gps_series = new ArrayList<AltosGPSTimeValue>();
                gps_series.add(new AltosGPSTimeValue(time(), gps));
 
-               if (sats_in_soln == null) {
-                       sats_in_soln = add_series(sats_in_soln_name, null);
-               }
-               sats_in_soln.add(time(), gps.nsat);
-               if (gps.pdop != AltosLib.MISSING) {
-                       if (gps_pdop == null)
-                               gps_pdop = add_series(gps_pdop_name, null);
-                       gps_pdop.add(time(), gps.pdop);
-               }
-               if (gps.hdop != AltosLib.MISSING) {
-                       if (gps_hdop == null)
-                               gps_hdop = add_series(gps_hdop_name, null);
-                       gps_hdop.add(time(), gps.hdop);
-               }
-               if (gps.vdop != AltosLib.MISSING) {
-                       if (gps_vdop == null)
-                               gps_vdop = add_series(gps_vdop_name, null);
-                       gps_vdop.add(time(), gps.vdop);
-               }
-               if (gps.locked) {
-                       if (gps.alt != AltosLib.MISSING) {
-                               if (gps_altitude == null)
-                                       gps_altitude = add_series(gps_altitude_name, AltosConvert.height);
-                               gps_altitude.add(time(), gps.alt);
+               if (new_location) {
+                       if (sats_in_soln == null) {
+                               sats_in_soln = add_series(sats_in_soln_name, null);
                        }
-                       if (gps.ground_speed != AltosLib.MISSING) {
-                               if (gps_ground_speed == null)
-                                       gps_ground_speed = add_series(gps_ground_speed_name, AltosConvert.speed);
-                               gps_ground_speed.add(time(), gps.ground_speed);
+                       sats_in_soln.add(time(), gps.nsat);
+                       if (gps.pdop != AltosLib.MISSING) {
+                               if (gps_pdop == null)
+                                       gps_pdop = add_series(gps_pdop_name, null);
+                               gps_pdop.add(time(), gps.pdop);
                        }
-                       if (gps.climb_rate != AltosLib.MISSING) {
-                               if (gps_ascent_rate == null)
-                                       gps_ascent_rate = add_series(gps_ascent_rate_name, AltosConvert.speed);
-                               gps_ascent_rate.add(time(), gps.climb_rate);
+                       if (gps.hdop != AltosLib.MISSING) {
+                               if (gps_hdop == null)
+                                       gps_hdop = add_series(gps_hdop_name, null);
+                               gps_hdop.add(time(), gps.hdop);
                        }
-                       if (gps.course != AltosLib.MISSING) {
-                               if (gps_course == null)
-                                       gps_course = add_series(gps_course_name, null);
-                               gps_course.add(time(), gps.course);
+                       if (gps.vdop != AltosLib.MISSING) {
+                               if (gps_vdop == null)
+                                       gps_vdop = add_series(gps_vdop_name, null);
+                               gps_vdop.add(time(), gps.vdop);
                        }
-                       if (gps.ground_speed != AltosLib.MISSING && gps.climb_rate != AltosLib.MISSING) {
-                               if (gps_speed == null)
-                                       gps_speed = add_series(gps_speed_name, null);
-                               gps_speed.add(time(), Math.sqrt(gps.ground_speed * gps.ground_speed +
-                                                               gps.climb_rate * gps.climb_rate));
+                       if (gps.locked) {
+                               if (gps.alt != AltosLib.MISSING) {
+                                       if (gps_altitude == null)
+                                               gps_altitude = add_series(gps_altitude_name, AltosConvert.height);
+                                       gps_altitude.add(time(), gps.alt);
+                               }
+                               if (gps.ground_speed != AltosLib.MISSING) {
+                                       if (gps_ground_speed == null)
+                                               gps_ground_speed = add_series(gps_ground_speed_name, AltosConvert.speed);
+                                       gps_ground_speed.add(time(), gps.ground_speed);
+                               }
+                               if (gps.climb_rate != AltosLib.MISSING) {
+                                       if (gps_ascent_rate == null)
+                                               gps_ascent_rate = add_series(gps_ascent_rate_name, AltosConvert.speed);
+                                       gps_ascent_rate.add(time(), gps.climb_rate);
+                               }
+                               if (gps.course != AltosLib.MISSING) {
+                                       if (gps_course == null)
+                                               gps_course = add_series(gps_course_name, null);
+                                       gps_course.add(time(), gps.course);
+                               }
+                               if (gps.ground_speed != AltosLib.MISSING && gps.climb_rate != AltosLib.MISSING) {
+                                       if (gps_speed == null)
+                                               gps_speed = add_series(gps_speed_name, null);
+                                       gps_speed.add(time(), Math.sqrt(gps.ground_speed * gps.ground_speed +
+                                                                       gps.climb_rate * gps.climb_rate));
+                               }
                        }
                }
-               if (gps.cc_gps_sat != null) {
-                       if (sats_in_view == null)
-                               sats_in_view = add_series(sats_in_view_name, null);
-                       sats_in_view.add(time(), gps.cc_gps_sat.length);
+               if (new_sats) {
+                       if (gps.cc_gps_sat != null) {
+                               if (sats_in_view == null)
+                                       sats_in_view = add_series(sats_in_view_name, null);
+                               sats_in_view.add(time(), gps.cc_gps_sat.length);
+                       }
                }
        }
 
@@ -615,8 +628,10 @@ public class AltosFlightSeries extends AltosDataListener {
        public static final String mag_along_name = "Magnetic Field Along";
        public static final String mag_across_name = "Magnetic Field Across";
        public static final String mag_through_name = "Magnetic Field Through";
+       public static final String mag_total_name = "Magnetic Field Strength";
+       public static final String compass_name = "Compass";
 
-       public AltosTimeSeries mag_along, mag_across, mag_through;
+       public AltosTimeSeries mag_along, mag_across, mag_through, mag_total, compass;
 
        public  void set_accel(double along, double across, double through) {
                if (accel_along == null) {
@@ -658,10 +673,14 @@ public class AltosFlightSeries extends AltosDataListener {
                        mag_along = add_series(mag_along_name, AltosConvert.magnetic_field);
                        mag_across = add_series(mag_across_name, AltosConvert.magnetic_field);
                        mag_through = add_series(mag_through_name, AltosConvert.magnetic_field);
+                       mag_total = add_series(mag_total_name, AltosConvert.magnetic_field);
+                       compass = add_series(compass_name, AltosConvert.orient);
                }
                mag_along.add(time(), along);
                mag_across.add(time(), across);
                mag_through.add(time(), through);
+               mag_total.add(time(), Math.sqrt(along * along + across * across + through *through));
+               compass.add(time(), Math.atan2(across, through) * 180 / Math.PI);
        }
 
        public void set_orient(double orient) {
index 7c8ed85e589d7f89623c116b7f32d2830d0d070e..f3f20201824ed84fc8c8ed5af41210c9dcd1efff 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index 736d24265d69bd8741af9b300dc7e864d0ad1a12..52c9da7d0155a1f4dc71c98707554c4fadbb471b 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosFontListener {
        void font_size_changed(int font_size);
index 99fe2671e9696496d0677f6435609970053710d7..c8a7ec864dec4497276dd773b43d25c0c0725b56 100644 (file)
@@ -15,7 +15,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosForce extends AltosUnits {
 
index 85e7dbf8dc5a513bf09dcc64f2e84d5d5057c05d..e325c1a19ba4efe73503a2825a8f28647eeeb15d 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index 57ac4061dbadde59678979119add0c6a7aae8adf..b659ba2cbdfbdda4ea970dced981f36c1f50ff6f 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.text.*;
 import java.util.concurrent.*;
@@ -391,7 +391,7 @@ public class AltosGPS implements Cloneable {
                try {
                        AltosGPS gps = new AltosGPS(link, link.config_data());
                        if (gps != null)
-                               listener.set_gps(gps);
+                               listener.set_gps(gps, true, true);
                } catch (TimeoutException te) {
                }
        }
index 6c045a31289f8188ec857da1a1378ae360d2e542..14bbeb51b642f00ab489a863dbbd85c560b5765c 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.text.*;
index 5ad1afa1fa71be5b4909c1c70262531f7a39d061..51a0857be185b0ac7e37a103f8e7d05e55cb1382 100644 (file)
@@ -15,7 +15,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosGPSTimeValue {
        public double   time;
diff --git a/altoslib/AltosGauss.java b/altoslib/AltosGauss.java
new file mode 100644 (file)
index 0000000..e9123af
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2020 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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_14;
+
+import java.io.*;
+
+public class AltosGauss extends AltosUnits {
+
+       public double value(double v, boolean imperial_units) {
+               return v;
+       }
+
+       public double inverse(double v, boolean imperial_units) {
+               return v;
+       }
+
+       public String show_units(boolean imperial_units) {
+               return "G";
+       }
+
+       public String say_units(boolean imperial_units) {
+               return "gauss";
+       }
+
+       public int show_fraction(int width, boolean imperial_units) {
+               return width - 1;
+       }
+
+       public AltosGauss() {
+               range_metric = new AltosUnitsRange[1];
+
+               range_metric[0] = new AltosUnitsRange(0, "µT", "microtesla") {
+                               double value(double v) {
+                                       return v * 100;
+                               }
+                               int show_fraction(int width) {
+                                       return width / 9;
+                               }
+                               int say_fraction() {
+                                       return 0;
+                               }
+                       };
+
+               range_imperial = range_metric;
+       }
+}
index cd5b9636a4bea28957048bc87f2accf7dc6f712d..ab970b427d5490fb8e17c40e653ecc648a730ce8 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.lang.Math;
 import java.io.*;
index f65ca89931e1bdd2be489e0219d5cee1c7a791ba..ab957bfbd6846cc3dbb9d4cbd12ad56ea8dd0d3c 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosHeight extends AltosUnits {
 
index cf99cded5ade7303fb337b299d2613cfc561021d..14f660a0bbcb0c4d38f406d31d2029d3fea3c711 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.LinkedList;
index a2ba6935f0ee58ac895ef6ed477bffc99449566a..2e51e64145dbcf1485556b6f99303bcf2ace98ad 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosHexsym {
        String  name;
index 8adf710e028a03f8e401ec4c48de5c1e9138a805..87b9f08bedb58360decd8fa2c44ea14ca85da5be 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.*;
 import java.io.*;
@@ -34,18 +34,79 @@ public class AltosIMU implements Cloneable {
        public int              mag_y = AltosLib.MISSING;
        public int              mag_z = AltosLib.MISSING;
 
-       public static final double      counts_per_g = 2048.0;
+       public static final double      counts_per_g_mpu = 2048.0;
+       public static final double      counts_per_g_bmx = 2048.0;
+
+       private static double counts_per_g(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
+               case imu_type_easymega_v2:
+                       return counts_per_g_mpu;
+               case  imu_type_telemega_v4:
+                       return counts_per_g_bmx;
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       public static double convert_accel(double counts, int imu_type) {
+               return counts / counts_per_g(imu_type) * AltosConvert.gravity;
+       }
+
+       public static final double      GYRO_FULLSCALE_DEGREES_MPU = 2000.0;
+       public static final double      GYRO_COUNTS_MPU = 32767.0;
+       public static final double      counts_per_degree_mpu = GYRO_COUNTS_MPU / GYRO_FULLSCALE_DEGREES_MPU;
+       public static final double      GYRO_FULLSCALE_DEGREES_BMX = 2000.0;
+       public static final double      GYRO_COUNTS_BMX = 32767.0;
+       public static final double      counts_per_degree_bmx = GYRO_COUNTS_BMX / GYRO_FULLSCALE_DEGREES_BMX;
+
+       private static double counts_per_degree(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
+               case imu_type_easymega_v2:
+                       return counts_per_degree_mpu;
+               case  imu_type_telemega_v4:
+                       return counts_per_degree_bmx;
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
 
-       public static double convert_accel(double counts) {
-               return counts / counts_per_g * AltosConvert.gravity;
+       public static double gyro_degrees_per_second(double counts, int imu_type) {
+               return counts / counts_per_degree(imu_type);
        }
 
-       /* In radians */
-       public static final double      GYRO_FULLSCALE_DEGREES = 2000.0;
-       public static final double      GYRO_COUNTS = 32767.0;
+       public static final int imu_axis_x = 0;
+       public static final int imu_axis_y = 1;
+       public static final int imu_axis_z = 2;
+
+       public static final double MAG_FULLSCALE_GAUSS_MPU = 48.00;     /* 4800µT */
+       public static final double MAG_COUNTS_MPU = 32767.0;
+       public static final double counts_per_gauss_mpu = MAG_COUNTS_MPU / MAG_FULLSCALE_GAUSS_MPU;
+
+       public static final double counts_per_gauss_bmx = 100.0;        /* BMX driver converts to µT */
+
+       public static double counts_per_gauss(int imu_type, int axis) {
+               switch(imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_easymega_v1:
+                       return AltosMag.counts_per_gauss;
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v2:
+                       return counts_per_gauss_mpu;
+               case imu_type_telemega_v4:
+                       return 100.0;
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
 
-       public static double gyro_degrees_per_second(double counts, double cal) {
-               return (counts - cal) * GYRO_FULLSCALE_DEGREES / GYRO_COUNTS;
+       public static double convert_gauss(double counts, int imu_type, int imu_axis) {
+               return counts / counts_per_gauss(imu_type, imu_axis);
        }
 
        public boolean parse_string(String line) {
@@ -88,103 +149,165 @@ public class AltosIMU implements Cloneable {
                return n;
        }
 
-       public static final int orient_telemega = 0;
-       public static final int orient_easymega_v2 = 1;
+       public static final int imu_type_telemega_v1_v2 = 0;    /* MPU6000 */
+       public static final int imu_type_telemega_v3 = 1;       /* MPU9250 */
+       public static final int imu_type_telemega_v4 = 2;       /* BMX160 */
+
+       public static final int imu_type_easymega_v1 = 3;       /* MPU6000 */
+       public static final int imu_type_easymega_v2 = 4;       /* MPU9250 */
 
-       private int accel_across(int orient) {
-               switch (orient) {
-               case orient_telemega:
+       private int accel_across(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
                        return accel_x;
-               case orient_easymega_v2:
+               case imu_type_easymega_v2:
+                       return -accel_y;
+               case  imu_type_telemega_v4:
                        return -accel_y;
                default:
                        return AltosLib.MISSING;
                }
        }
 
-       private int accel_along(int orient) {
-               switch (orient) {
-               case orient_telemega:
+       private int accel_along(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
                        return accel_y;
-               case orient_easymega_v2:
+               case imu_type_easymega_v2:
+               case imu_type_telemega_v4:
                        return accel_x;
                default:
                        return AltosLib.MISSING;
                }
        }
 
-       private int accel_through(int orient) {
+       private int accel_through(int imu_type) {
                return accel_z;
        }
 
-       private int gyro_roll(int orient) {
-               switch (orient) {
-               case orient_telemega:
+       private int gyro_roll(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
                        return gyro_y;
-               case orient_easymega_v2:
+               case imu_type_easymega_v2:
+               case imu_type_telemega_v4:
                        return gyro_x;
                default:
                        return AltosLib.MISSING;
                }
        }
 
-       private int gyro_pitch(int orient) {
-               switch (orient) {
-               case orient_telemega:
+       private int gyro_pitch(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
                        return gyro_x;
-               case orient_easymega_v2:
+               case imu_type_easymega_v2:
+                       return -gyro_y;
+               case imu_type_telemega_v4:
                        return -gyro_y;
                default:
                        return AltosLib.MISSING;
                }
        }
 
-       private int gyro_yaw(int orient) {
+       private int gyro_yaw(int imu_type) {
                return gyro_z;
        }
 
-       private int mag_across(int orient) {
-               switch (orient) {
-               case orient_telemega:
+       public static int mag_across_axis(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
+                       return imu_axis_x;
+               case imu_type_telemega_v4:
+               case imu_type_easymega_v2:
+                       return imu_axis_y;
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       private int mag_across(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
                        return mag_x;
-               case orient_easymega_v2:
+               case imu_type_easymega_v2:
                        return -mag_y;
+               case imu_type_telemega_v4:
+                       return mag_y;
                default:
                        return AltosLib.MISSING;
                }
        }
 
-       private int mag_along(int orient) {
-               switch (orient) {
-               case orient_telemega:
+       public static int mag_along_axis(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
+                       return imu_axis_y;
+               case imu_type_easymega_v2:
+               case imu_type_telemega_v4:
+                       return imu_axis_x;
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       private int mag_along(int imu_type) {
+               switch (imu_type) {
+               case imu_type_telemega_v1_v2:
+               case imu_type_telemega_v3:
+               case imu_type_easymega_v1:
                        return mag_y;
-               case orient_easymega_v2:
+               case imu_type_easymega_v2:
+               case imu_type_telemega_v4:
                        return mag_x;
                default:
                        return AltosLib.MISSING;
                }
        }
 
-       private int mag_through(int orient) {
+       public static int mag_through_axis(int imu_type) {
+               return imu_axis_z;
+       }
+
+       private int mag_through(int imu_type) {
                return mag_z;
        }
 
-       static public void provide_data(AltosDataListener listener, AltosLink link, int orient) throws InterruptedException {
+       static public void provide_data(AltosDataListener listener, AltosLink link, int imu_type) throws InterruptedException {
                try {
                        AltosIMU        imu = new AltosIMU(link);
                        AltosCalData    cal_data = listener.cal_data();
 
+                       cal_data.set_imu_type(imu_type);
+
                        if (imu != null) {
-                               listener.set_gyro(cal_data.gyro_roll(imu.gyro_roll(orient)),
-                                                 cal_data.gyro_pitch(imu.gyro_pitch(orient)),
-                                                 cal_data.gyro_yaw(imu.gyro_yaw(orient)));
-                               listener.set_accel_ground(imu.accel_along(orient),
-                                                         imu.accel_across(orient),
-                                                         imu.accel_through(orient));
+                               listener.set_gyro(cal_data.gyro_roll(imu.gyro_roll(imu_type)),
+                                                 cal_data.gyro_pitch(imu.gyro_pitch(imu_type)),
+                                                 cal_data.gyro_yaw(imu.gyro_yaw(imu_type)));
+                               listener.set_accel_ground(cal_data.accel_along(imu.accel_along(imu_type)),
+                                                         cal_data.accel_across(imu.accel_across(imu_type)),
+                                                         cal_data.accel_through(imu.accel_through(imu_type)));
+                               listener.set_accel(cal_data.accel_along(imu.accel_along(imu_type)),
+                                                  cal_data.accel_across(imu.accel_across(imu_type)),
+                                                  cal_data.accel_through(imu.accel_through(imu_type)));
                                if (imu.mag_x != AltosLib.MISSING) {
-                                       listener.set_mag(cal_data.mag_along(imu.mag_along(orient)),
-                                                        cal_data.mag_across(imu.mag_across(orient)),
-                                                        cal_data.mag_through(imu.mag_through(orient)));
+                                       listener.set_mag(cal_data.mag_along(imu.mag_along(imu_type)),
+                                                        cal_data.mag_across(imu.mag_across(imu_type)),
+                                                        cal_data.mag_through(imu.mag_through(imu_type)));
                                }
                        }
                } catch (TimeoutException te) {
index 6c6758ca0c414986bc9fa9d33571c40709d13d1c..160c5cb0896abdab3a157aa652aaaf590b7fa941 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index 4b9a52542241c1cd3a6f1908bb842c80fd97fbe6..2a36983f93b4cec07c3783f49cc34182da6b653e 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
@@ -28,12 +28,15 @@ class AltosIdler {
        int[]   idlers;
 
        static final int        idle_gps = 0;
-       static final int        idle_imu = 1;
-       static final int        idle_imu_em_v2 = 2;
-       static final int        idle_mag = 3;
-       static final int        idle_mma655x = 4;
-       static final int        idle_ms5607 = 5;
-       static final int        idle_adxl375 = 6;
+       static final int        idle_imu_tm_v1_v2 = 1;
+       static final int        idle_imu_tm_v3 = 2;
+       static final int        idle_imu_tm_v4 = 3;
+       static final int        idle_imu_em_v1 = 4;
+       static final int        idle_imu_em_v2 = 5;
+       static final int        idle_mag = 6;
+       static final int        idle_mma655x = 7;
+       static final int        idle_ms5607 = 8;
+       static final int        idle_adxl375 = 9;
 
        static final int        idle_sensor_tm = 10;
        static final int        idle_sensor_metrum = 11;
@@ -51,11 +54,20 @@ class AltosIdler {
                        case idle_gps:
                                AltosGPS.provide_data(listener, link);
                                break;
-                       case idle_imu:
-                               AltosIMU.provide_data(listener, link, AltosIMU.orient_telemega);
+                       case idle_imu_tm_v1_v2:
+                               AltosIMU.provide_data(listener, link, AltosIMU.imu_type_telemega_v1_v2);
+                               break;
+                       case idle_imu_tm_v3:
+                               AltosIMU.provide_data(listener, link, AltosIMU.imu_type_telemega_v3);
+                               break;
+                       case idle_imu_tm_v4:
+                               AltosIMU.provide_data(listener, link, AltosIMU.imu_type_telemega_v4);
+                               break;
+                       case idle_imu_em_v1:
+                               AltosIMU.provide_data(listener, link, AltosIMU.imu_type_easymega_v1);
                                break;
                        case idle_imu_em_v2:
-                               AltosIMU.provide_data(listener, link, AltosIMU.orient_easymega_v2);
+                               AltosIMU.provide_data(listener, link, AltosIMU.imu_type_easymega_v2);
                                break;
                        case idle_mag:
                                AltosMag.provide_data(listener, link);
@@ -154,30 +166,36 @@ public class AltosIdleFetch implements AltosDataProvider {
                               AltosIdler.idle_gps,
                               AltosIdler.idle_mma655x,
                               AltosIdler.idle_ms5607,
-                              AltosIdler.idle_imu, AltosIdler.idle_mag,
+                              AltosIdler.idle_imu_tm_v1_v2, AltosIdler.idle_mag,
                               AltosIdler.idle_sensor_mega),
                new AltosIdler("TeleMega-v1",
                               AltosIdler.idle_gps,
                               AltosIdler.idle_mma655x,
                               AltosIdler.idle_ms5607,
-                              AltosIdler.idle_imu, AltosIdler.idle_mag,
+                              AltosIdler.idle_imu_tm_v1_v2, AltosIdler.idle_mag,
                               AltosIdler.idle_sensor_mega),
                new AltosIdler("TeleMega-v2",
                               AltosIdler.idle_gps,
                               AltosIdler.idle_mma655x,
                               AltosIdler.idle_ms5607,
-                              AltosIdler.idle_imu, AltosIdler.idle_mag,
+                              AltosIdler.idle_imu_tm_v1_v2, AltosIdler.idle_mag,
                               AltosIdler.idle_sensor_mega),
                new AltosIdler("TeleMega-v3",
                               AltosIdler.idle_gps,
                               AltosIdler.idle_mma655x,
                               AltosIdler.idle_ms5607,
-                              AltosIdler.idle_imu,
+                              AltosIdler.idle_imu_tm_v3,
+                              AltosIdler.idle_sensor_mega),
+               new AltosIdler("TeleMega-v4",
+                              AltosIdler.idle_gps,
+                              AltosIdler.idle_adxl375,
+                              AltosIdler.idle_ms5607,
+                              AltosIdler.idle_imu_tm_v4,
                               AltosIdler.idle_sensor_mega),
                new AltosIdler("EasyMega-v1",
                               AltosIdler.idle_mma655x,
                               AltosIdler.idle_ms5607,
-                              AltosIdler.idle_imu, AltosIdler.idle_mag,
+                              AltosIdler.idle_imu_em_v1, AltosIdler.idle_mag,
                               AltosIdler.idle_sensor_mega),
                new AltosIdler("EasyMega-v2",
                               AltosIdler.idle_adxl375,
index 99d3192133f116e3cdbc5a89f48b9c34d548d160..84db49cac22b0d574cf0c61cc8cc8a01e8db5f80 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.concurrent.*;
@@ -30,7 +30,7 @@ public class AltosIdleMonitor extends Thread {
 
        boolean                 remote;
        boolean                 close_on_exit;
-       double                  frequency;
+       double                  frequency = AltosLib.MISSING;
        String                  callsign;
 
        AltosState              state;
@@ -63,6 +63,8 @@ public class AltosIdleMonitor extends Thread {
                        if (state == null)
                                state = new AltosState(new AltosCalData(link.config_data()));
                        fetch.provide_data(state);
+                       if (frequency != AltosLib.MISSING)
+                               state.set_frequency(frequency);
                        if (!link.has_error && !link.reply_abort)
                                worked = true;
                } finally {
index 43e2376f110410b277d8e44650befa48b4715ace..a89bb00a1f0b44ea39e51c7761c5a25ff1bf6300 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosIdleMonitorListener {
        public void update(AltosState state, AltosListenerState listener_state);
index 24477d623bcbb997f352938488010bc9caab7915..e124ad64b6c577a2a1a53087c12fcfc00ca3aec4 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.text.*;
 import java.io.*;
index 50c0f22d570deb779acb70a35f8dbec3be1a82b6..d4acda374c6a30de2689e998d20411576052e670 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 import java.io.*;
index 210a37c17f9af8be7585bfdc0319392aadc676f0..3030c0c09baa1b8ebce01763b7bf46ee8e27f998 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index 8f6897bb8efabad56da8a3007b4a081969d75ea6..cbeeee8785ba26319f60fc439af0b6a142987a37 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index cafc7f96bf0e11591f1a861463575b7974f987b0..131bdf4982584c8240fd6d25fb93e0b7905cf44f 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index 277858ff3b5155c2e1619b6f8f56795136ad20aa..d867ca462e24f65b49343dc0c0364a429922603a 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosLatLon {
        public double   lat;
index 4c8ea0b24dc5da1b521cffde8f65fa2b227a3902..abb3876b2f9a4e134a7244f0f598d39697c16b41 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosLatitude extends AltosLocation {
        public String pos() { return "N"; }
index a71e138d30d67d70eb95dc768af03a455a859d7b..aef5fd0670e716d6dc851d495f598ac15345ce01 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.*;
index ecae488c35ac6d789dfd3ba89e236b38ecc1efbe..9f776149232784b1f14fb9e3b039fbabba5426c4 100644 (file)
@@ -15,7 +15,7 @@
  * 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_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.*;
index 2c04c90eeeb50a28d905a1b1233dbcc61e40a21a..67d163bc073bf4454553448de6741ce1778e67fe 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.*;
index cfc326245049e5eb04758433c97f26c1465a7a70..14cec543eb5f9d9dc374250b4a034be338ea2aa1 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 import java.io.*;
@@ -377,6 +377,7 @@ public class AltosLib {
        public static final int AO_LOG_FORMAT_EASYMEGA_2 = 16;
        public static final int AO_LOG_FORMAT_TELESTATIC = 17;
        public static final int AO_LOG_FORMAT_MICROPEAK2 = 18;
+       public static final int AO_LOG_FORMAT_TELEMEGA_4 = 19;
        public static final int AO_LOG_FORMAT_NONE = 127;
 
        public static boolean isspace(int c) {
index a18366ed24cbd35cba4fd589841f1186c80aee0e..7858dc549f8b85588c3289258caeae2e25560ef8 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosLine {
        public String   line;
index 44202c0c80eb0b6ebe1a53d4d46cadd78d3b7a2d..9946b83586f18d082268fb86a0761da1ac92f7f9 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.concurrent.*;
@@ -392,7 +392,7 @@ public abstract class AltosLink implements Runnable {
                                        int cal) {
                if (debug)
                        System.out.printf("set_radio_frequency %7.3f (freq %b) (set %b) %d\n", frequency, has_frequency, has_setting, cal);
-               if (frequency == 0)
+               if (frequency == 0 || frequency == AltosLib.MISSING)
                        return;
                if (has_frequency)
                        set_radio_freq((int) Math.floor (frequency * 1000 + 0.5));
@@ -519,7 +519,7 @@ public abstract class AltosLink implements Runnable {
        public String name;
 
        public void start_remote() throws TimeoutException, InterruptedException {
-               if (frequency == 0.0)
+               if (frequency == 0.0 || frequency == AltosLib.MISSING)
                        frequency = AltosPreferences.frequency(serial);
                if (debug)
                        System.out.printf("start remote %7.3f\n", frequency);
index 448204714db32d0ab901455f2d8652c425d80455..7aa9a28fc0848f17fd47c5fee8b4c7d30707872d 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index 0ffc044e944afe86c3c078c6d3acd73d1a71f4c3..889ec96fe30ea859af0cc78f39a40b4142a1bf6f 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public abstract class AltosLocation extends AltosUnits {
 
index 3111a2cda462bd153e1345ca7a27f27032e18669..7065614b21c50f52a5f59eca71dc691084282c03 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.text.*;
index 6c7f715b216116360851e35be8ee8eabc534ef26..46a22b3ec760787e8fa671ee8590a30e20165f92 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosLongitude extends AltosLocation {
        public String pos() { return "E"; }
index cbf9ecff21917b716dc60b2a1b05235220a9202e..ab5d3f57e38cb5385350f673912b1df35b566c73 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.*;
 import java.io.*;
index 8fc40e8af307057a269e2552271ed09f0a47d060..519ecfdf1f31f800a89a02484930e0bae897ff04 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.*;
index 01b39b472d00f0fbb2851525e2a99e4904e1d459..2671cd7ef764409bd08cf00b431b5d5ea93573ff 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.net.*;
index b7d851b877eebef98400111ca50defbd28cb3f83..4ce9b88dea83cb3d59b7744f5de1e974a79bdf12 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosMapCacheListener {
        public void map_cache_changed(int map_cache);
index e407e0feadff8065efa56ad9ad65843bf83370f8..0ce49d128c4babbad57ddc3d514e579fd38d8203 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.net.*;
index b971711e6d3f0aa0654855a4a6a7fcf7e3e7e016..05b0effe4e8562bc616e7f0521f5f9f6c0f6608e 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.Math;
index 4047907d89d4a92fea4ca5b5f60f783d784e10ed..f1a5ce36eeeffb663c4382c6c626e83f78d45f6d 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index 3ef8789d1e5822ecace758315a3270d451ba356e..275d8a1a27a0d356aaacf70dd40f3a63bf2771ac 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosMapLoaderListener {
        public abstract void loader_start(int max);
index a263f814400ef3ad1b460835d41cb281879a7c34..dcb75430d1bca0df099c107eff583dfa15f46531 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.Math;
index bbb6c994aae11833dc9853797c7305ad5204f99c..67f35f6c367ac1a226e4f2bc19e67adb55028469 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.Math;
index 88a8bfcf28db86706154f397688f647a4845127b..3c28ae12ed51845bbce3248f1a715cdb4fd47db8 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.Math;
index 8a28f21846f3ea292134d379371fddca2876655a..8a8af1a0671d1491e817388bb3d744d1661993ce 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosMapRectangle {
        AltosLatLon     ul, lr;
index 2f85fb8db49602828ead9ca853796f3fc9fd9a06..f852f5604993be0f974d77dd17e2f954132b541d 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.net.*;
index 6d9a00a8e3be2d186e610924ebdc3943866a68bb..3870d67cf48cc37f609593f883db39ee08128014 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosMapStoreListener {
        abstract void notify_store(AltosMapStore store, int status);
index 6318c40d0c46a66ed0078859ae26818a0b348585..6f1d169d2e75ad3615ded0894c60ad153041c6ca 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index 971d7744cb268d6b5b5cca4511ec2ef0c8f9bccf..72dee7b951ffc315fc2e6d531c33f480fc4ec5e5 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosMapTileListener {
        abstract public void notify_tile(AltosMapTile tile, int status);
index 9eac2654220150ac29ea114bf04b23015b41e45a..ba9d1ae46121ca5ce72895562dd13ec736e88a38 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.Math;
index f1b9d0747654c70a55b399ed3e69d730dbc7385f..6a63203263bc05429e8e6df326044a2232194abf 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosMapTypeListener {
        public void map_type_changed(int map_type);
index 7044a220eeabe46a31986b67d8d869853438fb33..0504356aa10d68141a8c99a86d11f031486616a7 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosMapZoomListener {
        abstract public void zoom_changed(int zoom);
index 3a728ac4d3f6092af73c3301c8316f7340d315df..c009b8209b97e82dcda1430d0e98f789f915b621 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.*;
 
index c4ddaea9528ce14caae4b06d2eb388b69afe3e6a..6bd2847e86dd212984c270a425c1943dc635ef2d 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.*;
 import java.io.*;
index b824b7f1871a2fb6a425a996f83875ca3fb86119..36a84b29defc89cc8f1096f0cba86985a1c54bab 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosNoSymbol extends Exception {
        public AltosNoSymbol(String name) {
index 8f532da10bd858da6a8ca95a91ef9e224f7d40ea..f67dfb32050e31e0e2794788f419ee7821dba488 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosOrient extends AltosUnits {
 
index 8ba4d5b2ee5e3cbadd8272a123c10854dc07f76f..19e9be3e678bca90c323ba59e2ce4c6ae4d54000 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 import java.text.*;
index f775738a38185a4643892c3923d30e4f56039d1c..9cff675f1a56c309c4983a15d1537d7c99307278 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosPointDouble {
        public double   x, y;
index 50503cd87b59658e1999dc7fd0b5383d14d6ba93..6598ef7c1fccae8a37dc4bb6781bc8c743a42f02 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosPointInt {
        public int      x, y;
index f277f31a2eac62e5c686c501f390702276708dfc..00b4c4b30829e3cbd9b774283bba8efba4efab4c 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index 559cff07a057412b2b98e19fd312769c61b3793b..7de186cd52b6aa727cafd7409795ee5d2b35e224 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index 3869528e2eb6fe9114a644bbd7c289f161d72de3..446475e7282355cf6eec638d05cd7eee346189ac 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosPresTemp {
        double  pres = AltosLib.MISSING;
index 63884a44960be9c37620e3d16fa6777e0d4923dd..e199bb1db7b44ea2c3f6416b8a989192b3520f90 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosPressure extends AltosUnits {
 
index f87e334c26a79e7576b1d718fbbd33de64efe713..9a73f69f49b1ceb071b575f45b713b304df0505b 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index b716f4e3c8532a0c91793922ab90615c08725f4d..ad55bffbc3e0d6d80881e8c169605309d9767f33 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 import java.text.*;
index 0a2c5a6675d9fcc4e26508438510343622a2e4c9..c92fc5a8fcd4c519ba92977919fd496cdcb27403 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosPyroName extends AltosUnits {
 
index 98790f5fcfecbc68701dd28b930434a5d69eff5c..b0a4e177eacfe206da12862fb6f316030696fe9c 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosQuaternion {
        double  r;              /* real bit */
index 4c459cba68cb3080963802c09e71df4ea4fe4d5a..c889cdab0619acf33be7748579f08e18465a91ba 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 
index 3b46bd7c12435afff4cf18ce30763fff2ee41582..2db7bfdb2f26ee8287c9237f4f78b7fcde6e96a9 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosRectangle {
        public int      x, y, width, height;
index 1960aac002269476d54a185511d1b9d54de2f8fe..07f62427a3861ac92de1f433b9755e859d3e4f42 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
@@ -35,13 +35,15 @@ class AltosReplay extends AltosDataListener implements Runnable {
        boolean         done = false;
 
        public void set_time(double time) {
-               if (last_time != AltosLib.MISSING) {
-                       semaphore.release();
-                       double  delay = Math.min(time - last_time,10);
-                       if (delay > 0) {
-                               try {
-                                       Thread.sleep((int) (delay * 1000));
-                               } catch (InterruptedException ie) {
+               if (time > -2) {
+                       if (last_time != AltosLib.MISSING) {
+                               semaphore.release();
+                               double  delay = Math.min(time - last_time,10);
+                               if (delay > 0) {
+                                       try {
+                                               Thread.sleep((int) (delay * 1000));
+                                       } catch (InterruptedException ie) {
+                                       }
                                }
                        }
                }
@@ -70,7 +72,10 @@ class AltosReplay extends AltosDataListener implements Runnable {
        public void set_apogee_voltage(double volts) { state.set_apogee_voltage(volts); }
        public void set_main_voltage(double volts) { state.set_main_voltage(volts); }
 
-       public void set_gps(AltosGPS gps) { super.set_gps(gps); state.set_gps(gps); }
+       public void set_gps(AltosGPS gps, boolean set_location, boolean set_sats) {
+               super.set_gps(gps, set_location, set_sats);
+               state.set_gps(gps, set_location, set_sats);
+       }
 
        public void set_orient(double orient) { state.set_orient(orient); }
        public void set_gyro(double roll, double pitch, double yaw) { state.set_gyro(roll, pitch, yaw); }
@@ -105,31 +110,17 @@ public class AltosReplayReader extends AltosFlightReader {
        File            file;
        AltosReplay     replay;
        Thread          t;
-       int             reads;
 
        public AltosCalData cal_data() {
                return replay.state.cal_data();
        }
 
        public AltosState read() {
-               switch (reads) {
-               case 0:
-                       /* Tell the display that we're in pad mode */
-                       replay.state.set_state(AltosLib.ao_flight_pad);
-                       break;
-               case 1:
-                       t = new Thread(replay);
-                       t.start();
-                       /* fall through */
-               default:
-                       /* Wait for something to change */
-                       try {
-                               replay.semaphore.acquire();
-                       } catch (InterruptedException ie) {
-                       }
-                       break;
+               /* Wait for something to change */
+               try {
+                       replay.semaphore.acquire();
+               } catch (InterruptedException ie) {
                }
-               reads++;
 
                /* When done, let the display know */
                if (replay.done)
@@ -146,9 +137,10 @@ public class AltosReplayReader extends AltosFlightReader {
        public File backing_file() { return file; }
 
        public AltosReplayReader(AltosRecordSet record_set, File in_file) {
-               reads = 0;
                file = in_file;
                name = file.getName();
                replay = new AltosReplay(record_set);
+               t = new Thread(replay);
+               t.start();
        }
 }
index 00811ce7e4702d89a69da7289bb060096844642d..d868b9aa444cfc488476ea7b244de71e24053691 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.concurrent.*;
index 54b3b1f939a46d1d12fff739fe8b658994afd035..7bcea4874095e4d8c83610ffc23c71b07e4dfc5e 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosRotation extends AltosQuaternion {
        private AltosQuaternion         rotation;
@@ -29,7 +29,7 @@ public class AltosRotation extends AltosQuaternion {
         *
         * rot = ao_rotation * vertical * ao_rotation°
         * rot = ao_rotation * (0,0,0,1) * ao_rotation°
-        *     = ((a.z, a.y, -a.x, a.r) * (a.r, -a.x, -a.y, -a.z)) .z
+        *     = ((-a.z, a.y, -a.x, a.r) * (a.r, -a.x, -a.y, -a.z)) .z
         *
         *     = (-a.z * -a.z) + (a.y * -a.y) - (-a.x * -a.x) + (a.r * a.r)
         *     = a.z² - a.y² - a.x² + a.r²
@@ -50,6 +50,34 @@ public class AltosRotation extends AltosQuaternion {
                return tilt;
        }
 
+       /* Compute azimuth angle from a reference line pointing out the side
+        * of the airframe
+        *
+        * rot = ao_rotation * x_axis * ao_rotation°
+        * rot = ao_rotation * (0,1,0,0) * ao_rotation°
+        *     = (-a.x, a.r, a.z, -a.y) * (a.r, -a.x, -a.y, -a.z) . x
+        *     = (-a.x * -a.x) + (a.r * a.r) + (a.z * -a.z) - (-a.y * -a.y)
+        *     = a.x² + a.r² - a.z² - a.y²
+        *
+        *     = (-a.x, a.r, a.z, -a.y) * (a.r, -a.x, -a.y, -a.z) . y
+        *     = (-a.x * -a.y) - (a.r * -a.z) + (a.z * a.r) + (-a.y * -a.x)
+        *     = a.x * a.y + a.r * a.z + a.z * a.r + a.y * a.x
+        *
+        * The X value will be the cosine of the rotation. The Y value will be the
+        * sine of the rotation; use the sign of that to figure out which direction from
+        * zero we've headed
+        */
+
+       public double azimuth() {
+               double rotx = rotation.x * rotation.x + rotation.r * rotation.r - rotation.z * rotation.z - rotation.y * rotation.y;
+               double roty = rotation.x * rotation.y + rotation.r * rotation.z + rotation.z * rotation.r + rotation.y * rotation.x;
+
+               double az = Math.acos(rotx) * 180.0 / Math.PI;
+               if (roty < 0)
+                       return -az;
+               return az;
+       }
+
        /* Given euler rotations in three axes, perform a combined rotation using
         * quaternions
         */
index b8490d79d981b8537854458b0fa719ead79a6b88..bb7f02f19d37ac7dd6826d5a03ed254c5a641fc7 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosRotationRate extends AltosUnits {
 
index 3e572dc3cee78cc85baedf1a6bec3d0dcb145ffb..72c20519b1b824a4c0c419b4f8adc46716b80def 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index 70a5ced5e8db0ffc551946e0740813fc4824cc2d..6646bfb6795dde752953e38005d50b862dc28b69 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 
index e7f540fde55d76ab5c26d6cc26c666b113d0210b..67f3c8e66e6f353a4167ddfadf6d975073f5a77b 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.TimeoutException;
 
index a689aef013610eb37f6748fee8bb49d0d73462bd..7f6281810357891ec50533ed8d8f2c75bc319cc4 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.TimeoutException;
 
index 0aa52176d48b03ba6fdad5c5fb892414bf26bf38..076acc6252dec7b97c93fac5215954ee5af874c9 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.TimeoutException;
 
index efed1a6f55883b0b54a0c9d99c3db1049b017567..591be15bebb289cafce2b26c4d4cf503e888e333 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.TimeoutException;
 
index cdd19217ac2df9b75ad134aeed975af91f0f5ff5..eb1c010e73224f9449155efe7f82c26dfd96f301 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.TimeoutException;
 
index ceca977eab308c9889b5fbc6336e25369731a545..aceab58e104416f4b61f310ca6d89597f7e671a5 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.TimeoutException;
 
index a25f4d1962474eaeedd613ba6af8d7eec1fe6ed4..624a561e9238d1c4296c00e905a60f85c3ab692f 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.TimeoutException;
 
index 941e82a2c271540c3648e3015a606bda9be4144c..415bde0456b8dca874cb793b59c77431f9edcbca 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.TimeoutException;
 
index e43c05c5b3f8adb7c3ecf3637190899df0caee37..94e3190ccd02f6228f2892a60a5e4f67331ff6fc 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.concurrent.TimeoutException;
 
index af10ad274642666c53ccf2168108ec22fe9e319d..365343c5101af967f702a48f63b69feb910a9754 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosSpeed extends AltosUnits {
 
index 93104fb0878c946468aaec1f898b3e844de4c6af..e3ea0524e90b8bd3d873aeb50d7ba722e6a80340 100644 (file)
@@ -20,7 +20,7 @@
  * Track flight state from telemetry or eeprom data stream
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosState extends AltosDataListener {
 
@@ -513,26 +513,27 @@ public class AltosState extends AltosDataListener {
        }
 
        public double height() {
-               double k = kalman_height.value();
-               if (k != AltosLib.MISSING)
-                       return k;
-
                double b = baro_height();
                if (b != AltosLib.MISSING)
                        return b;
 
+               double k = kalman_height.value();
+               if (k != AltosLib.MISSING)
+                       return k;
+
                return gps_height();
        }
 
        public double max_height() {
-               double  k = kalman_height.max();
-               if (k != AltosLib.MISSING)
-                       return k;
-
                double a = altitude.max();
                double g = ground_altitude();
                if (a != AltosLib.MISSING && g != AltosLib.MISSING)
                        return a - g;
+
+               double  k = kalman_height.max();
+               if (k != AltosLib.MISSING)
+                       return k;
+
                return max_gps_height();
        }
 
@@ -842,6 +843,8 @@ public class AltosState extends AltosDataListener {
                                                        gps.climb_rate * gps.climb_rate), time);
                        if (gps.course != AltosLib.MISSING)
                                gps_course.set(gps.course, time);
+               } else if (state() == AltosLib.ao_flight_pad || state() == AltosLib.ao_flight_stateless) {
+                       set_npad(0);
                }
                if (gps.lat != 0 && gps.lon != 0 &&
                    pad_lat != AltosLib.MISSING &&
@@ -858,10 +861,6 @@ public class AltosState extends AltosDataListener {
                }
        }
 
-       public String state_name() {
-               return AltosLib.state_name(state());
-       }
-
        public void set_state(int state) {
                super.set_state(state);
                ascent = (AltosLib.ao_flight_boost <= state() &&
@@ -886,8 +885,8 @@ public class AltosState extends AltosDataListener {
                received_time = ms;
        }
 
-       public void set_gps(AltosGPS gps) {
-               super.set_gps(gps);
+       public void set_gps(AltosGPS gps, boolean set_location, boolean set_sats) {
+               super.set_gps(gps, set_location, set_sats);
                if (gps != null) {
                        this.gps = gps;
                        update_gps();
@@ -901,9 +900,9 @@ public class AltosState extends AltosDataListener {
 
        void update_pad_rotation() {
                if (cal_data().pad_orientation != AltosLib.MISSING && accel_ground_along != AltosLib.MISSING) {
-                       rotation = new AltosRotation(AltosIMU.convert_accel(accel_ground_across - cal_data().accel_zero_across),
-                                                    AltosIMU.convert_accel(accel_ground_through - cal_data().accel_zero_through),
-                                                    AltosIMU.convert_accel(accel_ground_along - cal_data().accel_zero_along),
+                       rotation = new AltosRotation(accel_ground_across,
+                                                    accel_ground_through,
+                                                    accel_ground_along,
                                                     cal_data().pad_orientation);
                        orient.set_computed(rotation.tilt(), time);
                }
index e5292d307fb3b23facf9db907a27d2e3039bde9a..8cc256960f490da33c38e60dac059b3973718e3d 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosStateName extends AltosUnits {
 
index ee2415caafce894c444ce16c89405441131dfa27..de27d105a9592b6dcd634ba716654e74b294e68e 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 import java.io.*;
index a19e4226160a7e7d561a8c36a003191b26789419..ec3d8495dc1efff7fe65071e42aefecec471936e 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.text.*;
 
@@ -74,12 +74,13 @@ public abstract class AltosTelemetry implements AltosDataProvider {
        final static int packet_type_location = 0x05;
        final static int packet_type_satellite = 0x06;
        final static int packet_type_companion = 0x07;
-       final static int packet_type_mega_sensor = 0x08;
+       final static int packet_type_mega_sensor_mpu = 0x08;
        final static int packet_type_mega_data = 0x09;
        final static int packet_type_metrum_sensor = 0x0a;
        final static int packet_type_metrum_data = 0x0b;
        final static int packet_type_mini2 = 0x10;
        final static int packet_type_mini3 = 0x11;
+       final static int packet_type_mega_sensor_bmx160 = 0x12;
 
        static AltosTelemetry parse_hex(String hex)  throws ParseException, AltosCRCException {
                AltosTelemetry  telem = null;
index 091c8bd88d20e16a12c5290ad29cbe31d0801c68..c5faef3e2709f4a541c3eff801dc9a02dbd11db5 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosTelemetryCompanion extends AltosTelemetryStandard {
 
index 22fd8568cab896f9cf42bfa1268901ba68bf6fe6..f85025778be7c2b6b835f0cd06e21d842bc7bde6 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 
 public class AltosTelemetryConfiguration extends AltosTelemetryStandard {
index 01d82c242bd3ef7e1915269eee57ad1d40ac0db6..052b0fbad247c1af1b52b6134a9eeb839346dfec 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
@@ -95,6 +95,7 @@ public class AltosTelemetryFile implements AltosRecordSet {
 
        AltosTelemetryIterable  telems;
        AltosCalData            cal_data;
+       int                     first_state;
 
        public void write_comments(PrintStream out) {
        }
@@ -108,8 +109,11 @@ public class AltosTelemetryFile implements AltosRecordSet {
                        cal_data = new AltosCalData();
                        AltosTelemetryNullListener l = new AltosTelemetryNullListener(cal_data);
 
+                       first_state = AltosLib.ao_flight_startup;
                        for (AltosTelemetry telem : telems) {
                                telem.provide_data(l);
+                               if (cal_data.state == AltosLib.ao_flight_pad)
+                                       first_state = cal_data.state;
                                if (l.cal_data_complete())
                                        break;
                        }
@@ -122,16 +126,11 @@ public class AltosTelemetryFile implements AltosRecordSet {
        }
 
        public void capture_series(AltosDataListener listener) {
-               AltosCalData    cal_data = cal_data();
-
+               cal_data();
                cal_data.reset();
+               cal_data.state = first_state;
                for (AltosTelemetry telem : telems) {
-                       int tick = telem.tick();
-                       cal_data.set_tick(tick);
-
-                       /* Try to pick up at least one pre-boost value */
-                       if (cal_data.time() >= -2)
-                               telem.provide_data(listener);
+                       telem.provide_data(listener);
                        if (listener.state() == AltosLib.ao_flight_landed)
                                break;
                }
index 8cd0c9c7a274c94dfc50672dc972d44b59154023..70efe92c058729359f870e8a7a5ebc38f1fca225 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.util.*;
index d2b29835616432bcf5b0ccbd54b217b66e7d42a1..1012a4ec84ed63e2d4c2d3a66d4559a3f4652621 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.text.*;
 
@@ -568,6 +568,6 @@ public class AltosTelemetryLegacy extends AltosTelemetry {
                listener.set_apogee_voltage(AltosConvert.cc_igniter_to_voltage(apogee));
                listener.set_main_voltage(AltosConvert.cc_igniter_to_voltage(main));
                if (gps != null)
-                       listener.set_gps(gps);
+                       listener.set_gps(gps, true, true);
        }
 }
index 25570bf934f8c923d3fed8da473eff1852136408..7a281fdf7422f81253ea42fbca786f97f5486b44 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 
 public class AltosTelemetryLocation extends AltosTelemetryStandard {
@@ -78,6 +78,6 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard {
                        gps.course = course() * 2;
                        gps.climb_rate = climb_rate() * 1.0e-2;
                }
-               listener.set_gps(gps);
+               listener.set_gps(gps, true, false);
        }
 }
index fa275e1df8a5b00a89111da78e19ab78a4c1812f..7fb21d4a48501a3b35d3d19ab8c2f54129f7eaca 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 import java.text.*;
 import java.util.HashMap;
 
index 1a0bff315f3474109d508bf85995be71574f1dff..3e1e3c95d1fff00cb8958088803a204e79b61bc6 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosTelemetryMegaData extends AltosTelemetryStandard {
 
index e97e18e2872da723093e5fbf4704d1dd55102e08..cda977eb36b3a54f071caa1f550bee33239ad1c0 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {
        int     orient() { return int8(5); }
@@ -37,8 +37,152 @@ public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {
        int     mag_z() { return int16(28); }
        int     mag_y() { return int16(30); }
 
-       public AltosTelemetryMegaSensor(int[] bytes) throws AltosCRCException {
+       int imu_type;
+
+       private int accel_across(int imu_type) {
+               switch (imu_type) {
+               case AltosIMU.imu_type_telemega_v1_v2:
+               case AltosIMU.imu_type_telemega_v3:
+               case AltosIMU.imu_type_easymega_v1:
+                       return accel_x();
+               case AltosIMU.imu_type_easymega_v2:
+                       return -accel_y();
+               case  AltosIMU.imu_type_telemega_v4:
+                       return -accel_y();
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       private int accel_along(int imu_type) {
+               switch (imu_type) {
+               case AltosIMU.imu_type_telemega_v1_v2:
+               case AltosIMU.imu_type_telemega_v3:
+               case AltosIMU.imu_type_easymega_v1:
+                       return accel_y();
+               case AltosIMU.imu_type_easymega_v2:
+               case AltosIMU.imu_type_telemega_v4:
+                       return accel_x();
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       private int accel_through(int imu_type) {
+               return accel_z();
+       }
+
+       private int gyro_roll(int imu_type) {
+               switch (imu_type) {
+               case AltosIMU.imu_type_telemega_v1_v2:
+               case AltosIMU.imu_type_telemega_v3:
+               case AltosIMU.imu_type_easymega_v1:
+                       return gyro_y();
+               case AltosIMU.imu_type_easymega_v2:
+               case AltosIMU.imu_type_telemega_v4:
+                       return gyro_x();
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       private int gyro_pitch(int imu_type) {
+               switch (imu_type) {
+               case AltosIMU.imu_type_telemega_v1_v2:
+               case AltosIMU.imu_type_telemega_v3:
+               case AltosIMU.imu_type_easymega_v1:
+                       return gyro_x();
+               case AltosIMU.imu_type_easymega_v2:
+                       return -gyro_y();
+               case AltosIMU.imu_type_telemega_v4:
+                       return gyro_y();
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       private int gyro_yaw(int imu_type) {
+               return gyro_z();
+       }
+
+       public static int mag_across_axis(int imu_type) {
+               switch (imu_type) {
+               case AltosIMU.imu_type_telemega_v1_v2:
+               case AltosIMU.imu_type_telemega_v3:
+               case AltosIMU.imu_type_easymega_v1:
+                       return AltosIMU.imu_axis_x;
+               case AltosIMU.imu_type_telemega_v4:
+               case AltosIMU.imu_type_easymega_v2:
+                       return AltosIMU.imu_axis_y;
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       private int mag_across(int imu_type) {
+               switch (imu_type) {
+               case AltosIMU.imu_type_telemega_v1_v2:
+               case AltosIMU.imu_type_telemega_v3:
+               case AltosIMU.imu_type_easymega_v1:
+                       return mag_x();
+               case AltosIMU.imu_type_telemega_v4:
+               case AltosIMU.imu_type_easymega_v2:
+                       return -mag_y();
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       public static int mag_along_axis(int imu_type) {
+               switch (imu_type) {
+               case AltosIMU.imu_type_telemega_v1_v2:
+               case AltosIMU.imu_type_telemega_v3:
+               case AltosIMU.imu_type_easymega_v1:
+                       return AltosIMU.imu_axis_y;
+               case AltosIMU.imu_type_easymega_v2:
+               case AltosIMU.imu_type_telemega_v4:
+                       return AltosIMU.imu_axis_x;
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       private int mag_along(int imu_type) {
+               switch (imu_type) {
+               case AltosIMU.imu_type_telemega_v1_v2:
+               case AltosIMU.imu_type_telemega_v3:
+               case AltosIMU.imu_type_easymega_v1:
+                       return mag_y();
+               case AltosIMU.imu_type_easymega_v2:
+               case AltosIMU.imu_type_telemega_v4:
+                       return mag_x();
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       public static int mag_through_axis(int imu_type) {
+               return AltosIMU.imu_axis_z;
+       }
+
+       private int mag_through(int imu_type) {
+               return mag_z();
+       }
+
+       public AltosTelemetryMegaSensor(int[] bytes, int imu_type) throws AltosCRCException {
                super(bytes);
+               switch (imu_type) {
+               case AltosIMU.imu_type_telemega_v1_v2:
+               case AltosIMU.imu_type_telemega_v3:
+                       if (serial() < 3000)
+                               imu_type = AltosIMU.imu_type_telemega_v1_v2;
+                       else
+                               imu_type = AltosIMU.imu_type_telemega_v3;
+                       break;
+               default:
+                       break;
+               }
+               this.imu_type = imu_type;
        }
 
        public void provide_data(AltosDataListener listener) {
@@ -51,6 +195,7 @@ public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {
                listener.set_temperature(temp() / 100.0);
 
                listener.set_orient(orient());
+               cal_data.set_imu_type(imu_type);
 
                /* XXX we have no calibration data for these values */
 
@@ -59,16 +204,17 @@ public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {
                if (cal_data.gyro_zero_roll == AltosLib.MISSING)
                        cal_data.set_gyro_zero(0, 0, 0);
 
-               int     accel_along = accel_y();
-               int     accel_across = accel_x();
-               int     accel_through = accel_z();
-               int     gyro_roll = gyro_y();
-               int     gyro_pitch = gyro_x();
-               int     gyro_yaw = gyro_z();
+               int     accel_along = accel_along(imu_type);
+               int     accel_across = accel_across(imu_type);
+               int     accel_through = accel_through(imu_type);
+
+               int     gyro_roll = gyro_roll(imu_type);
+               int     gyro_pitch = gyro_pitch(imu_type);
+               int     gyro_yaw = gyro_yaw(imu_type);
 
-               int     mag_along = mag_y();
-               int     mag_across = mag_x();
-               int     mag_through = mag_z();
+               int     mag_along = mag_along(imu_type);
+               int     mag_across = mag_across(imu_type);
+               int     mag_through = mag_through(imu_type);
 
                listener.set_accel(cal_data.accel_along(accel_along),
                                   cal_data.accel_across(accel_across),
index 4a9dcd64d31a3fd1234fd57c163f51ac18e53510..c97c7379f84801221225255fcca67dd137e74d51 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 
 public class AltosTelemetryMetrumData extends AltosTelemetryStandard {
index 383f645ad7e2244c5b4bbe3573155873152ac7d0..b26bff64e2f842365e8f35c056fa2e906a20089f 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 
 public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard {
index 86e10539bc46737962183dfaed9a38aedee42ba4..7d01ec4ed430793f849aa8ad62756c5816793f93 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 
 public class AltosTelemetryMini2 extends AltosTelemetryStandard {
index b18314420203f1053f9ae42f66f96a3dac8bdae1..97327651f9f53263c2c1449db84227d673314381 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 
 public class AltosTelemetryMini3 extends AltosTelemetryStandard {
index 88f23f5e07615a98838f94ac01f42429bcf18264..556ea25852fed6c830445a0811375fe19ab55556 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosTelemetryRaw extends AltosTelemetryStandard {
        public AltosTelemetryRaw(int[] bytes) throws AltosCRCException {
index de957f65b34005fccc1f87b0f33eab6b56ff0057..1cfd5a5a43052f5d6bce9de7cbd41a47d92751a6 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.text.*;
 import java.io.*;
index 8213a43eda437694d44fb81e5991c1d33fe40f00..201e872723480e54742b44d5e8add91d78149196 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosTelemetrySatellite extends AltosTelemetryStandard {
        int             channels() { return uint8(5); }
@@ -52,6 +52,6 @@ public class AltosTelemetrySatellite extends AltosTelemetryStandard {
                AltosGPS        gps = listener.make_temp_gps(true);
 
                gps.cc_gps_sat = sats();
-               listener.set_gps(gps);
+               listener.set_gps(gps, false, true);
        }
 }
index c0a5e9e34e7c3bee6d2b263662b3c2d5f9468302..897976623cc5245a3549815a45e852dcef84187e 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 
 public class AltosTelemetrySensor extends AltosTelemetryStandard {
index 3f585ceafb49f5721ceef61907231342fc1a4a12..b8e5d3d6f95979c28810dcf0263e3106d8583fc6 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public abstract class AltosTelemetryStandard extends AltosTelemetry {
        public int int8(int off) {
@@ -75,8 +75,11 @@ public abstract class AltosTelemetryStandard extends AltosTelemetry {
                case packet_type_companion:
                        telem = new AltosTelemetryCompanion(bytes);
                        break;
-               case packet_type_mega_sensor:
-                       telem = new AltosTelemetryMegaSensor(bytes);
+               case packet_type_mega_sensor_mpu:
+                       telem = new AltosTelemetryMegaSensor(bytes, AltosIMU.imu_type_telemega_v3);
+                       break;
+               case packet_type_mega_sensor_bmx160:
+                       telem = new AltosTelemetryMegaSensor(bytes, AltosIMU.imu_type_telemega_v4);
                        break;
                case packet_type_mega_data:
                        telem = new AltosTelemetryMegaData(bytes);
index b1526a4b8ce0dcb4b4863bb94f96926c4d2417a5..5a21ebd82474468aa198192c635c9cb3263cdeb4 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosTemperature extends AltosUnits {
 
index d0057969017caaf02b7e258632636ffe9a55ef3d..cf96d57730245e80ef4dade3fae5a77096192f45 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosTime extends AltosUnits {
        public double value(double v, boolean imperial_units) { return v; }
index 75225e1558d236ae45bdd34e72509fcce48905ab..80720f152c3bf3d232d6c8ae33d768fe1f1478fd 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 
@@ -21,14 +21,17 @@ public class AltosTimeSeries implements Iterable<AltosTimeValue>, Comparable<Alt
        public AltosUnits               units;
        ArrayList<AltosTimeValue>       values;
        boolean                         data_changed;
+       double                          min_time = -2;
 
        public int compareTo(AltosTimeSeries other) {
                return label.compareTo(other.label);
        }
 
        public void add(AltosTimeValue tv) {
-               data_changed = true;
-               values.add(tv);
+               if (tv.time >= min_time) {
+                       data_changed = true;
+                       values.add(tv);
+               }
        }
 
        public void erase_values() {
index e94370a7e853ddd9ed03b99ef20b5c2fa5d3893c..b3bef8e3d4b66b6ef49318df670e1573723b643d 100644 (file)
@@ -15,7 +15,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosTimeValue {
        public double   time;
index 2a9f470a9e7cd74d5f7cca64fd56dce1138613cb..04d8f0b1ed227fe5072698b92b76762156fd3f88 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.io.*;
 import java.lang.*;
index 3753df46708cc916b3230c7bf033451599e44bfb..ae1b702d7794442fca7e292a9bca2adec974e56d 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosUnitInfoListener {
        public abstract void notify_unit_info(AltosUnitInfo unit_info);
index 6e492149b426744ccd03f1fd268533f4b4f0de2f..02ea0827f0140d254bae853c9afbf06f637f8528 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.text.*;
 
index e37027a60fa94e86151240e8d165267c3f9bc2da..5ddb67b14337ab51a221acc52998b055ce5aad14 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosUnitsListener {
        public void units_changed(boolean imperial_units);
index 58f918bacf9167522c8e7b4e45cb8e5dadeb92df..06042fc8c02c55d13e497d53b0c725028bcf6e9c 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.text.*;
 
index dd108a2e74a111c5c7a04c3d2ee3b8d069b7f4c4..671855986812f1d5e1da88af0e73a807dddb602b 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosUnknownProduct extends Exception {
        public String product;
index 5c70341d6b089a10c49899ec5575612cc57a4f0b..150754eb543aea7c19c0c670a764512f56060153 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosUsbId {
        public int      vid;
index 6b660bb5494613ec442371cbb63ecf69808b5e2d..6358aa94bc23a2b97d10ee62cf41e2f99efb95f1 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosVersion {
        public final static String version = "@VERSION@";
index aca82e281661f3d18cde0bbb099994c0acbd484b..7c73dbb3099dfa8d0e5f3af9a50d92ef9b7ec219 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public class AltosVoltage extends AltosUnits {
 
index 7bb0ec0d55ef417d9628cdc24f6b5980dcea0d43..91f3bbdb4a2023571d55bb30e29564bd65609e51 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 public interface AltosWriter {
 
index 59a3b2ca89ab3e09a39887108fecc74d2208b9b5..b7d30051f87d351da8c061e129a6b6a9a9e4e2d4 100644 (file)
@@ -70,6 +70,7 @@ altoslib_JAVA = \
        AltosGPS.java \
        AltosGPSTimeValue.java \
        AltosGPSSat.java \
+       AltosGauss.java \
        AltosGreatCircle.java \
        AltosHexfile.java \
        AltosHexsym.java \
index 36b951e3c2c99ce283753fa97411be2749a5150c..ab40693013898c94a4541879028db418efe3e89b 100644 (file)
@@ -21,8 +21,8 @@ package altosui;
 import java.awt.*;
 import libaltosJNI.*;
 
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class Altos extends AltosUILib {
 
index be3f9ce757897c69bce8b746bf28337e77c40b4c..0768b12e25be784386a6471105b517343b597de7 100644 (file)
@@ -22,8 +22,8 @@ import java.util.*;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosAscent extends AltosUIFlightTab {
        JLabel  cur, max;
index 9c788971f78056996e5eeabb5170d16896f7b7dd..7d838aeac720adb8e49dfcb840de60f0c34b4897 100644 (file)
@@ -20,8 +20,8 @@ package altosui;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosCompanionInfo extends JTable implements AltosFlightDisplay {
        private AltosFlightInfoTableModel model;
index 01ba9c0d37639c02417a21b3a10f42935e86ad77..66afd8a0d3521f89d01ddd1e9aa4ea8fbc1aab1c 100644 (file)
@@ -23,8 +23,8 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.text.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosConfigFC implements ActionListener {
 
index 39752b1dd771f8eaa8e67d5cb072768c28c820f8..624c7246d91cdcca18e44266127c171872c2b34a 100644 (file)
@@ -23,8 +23,8 @@ import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
 import java.text.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosConfigFCUI
        extends AltosUIDialog
index c05b6e9197d8d1b66c4708094be327cd20cafb19..309bb8ee80c7c35fdbdbfe096926423157d3cdba 100644 (file)
@@ -23,8 +23,8 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosConfigPyroUI
        extends AltosUIDialog
index 4c6d18469b7a2881fe7d59f77b05e33049e25b1f..fd407d543f03ff5e07aa0cc8dcf6caf7840fd929 100644 (file)
@@ -22,8 +22,8 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosConfigTD implements ActionListener {
 
index 12b6e4bf55b943a32556bd6d8a22553ec9744d7f..0fdf4449938a06cabc7eaaf5e5383e409e800747 100644 (file)
@@ -22,8 +22,8 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosConfigTDUI
        extends AltosUIDialog
index 8b62a212a0e8350526b2db1dfff9fa95e20653ea..4cce0315dbe9df60b550752f56ca8eee9568d08d 100644 (file)
@@ -23,7 +23,7 @@ import java.awt.event.*;
 import java.beans.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosConfigureUI
        extends AltosUIConfigure
index 09db6ac01be20e762c5cd6a593f0d66cd08d1c3c..644c12b92e224871cd35b0b473c53f4dc335cfcb 100644 (file)
@@ -22,8 +22,8 @@ import java.util.*;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosDescent extends AltosUIFlightTab {
 
index 207c44b48da275e086944f5b1dbef1521fb254e1..6d110886afc785fe04eb5fcd090aa774c0cf6153 100644 (file)
@@ -20,8 +20,8 @@ package altosui;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosFlightStatus extends JComponent implements AltosFlightDisplay {
        GridBagLayout   layout;
index 823dbc3c01072b68683c17af41d7b89009b26dbf..ee00f3c1d7a1f49b5e6a53583a719344ea111003 100644 (file)
@@ -28,7 +28,7 @@ import java.util.*;
 import java.text.*;
 import java.util.prefs.*;
 import java.util.concurrent.LinkedBlockingQueue;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosFlightStatusTableModel extends AbstractTableModel {
        private String[] columnNames = {
index 2f9c728c79ffa70ae7fef405b7906a6d4cbd09c8..674ab2afe89ee7d27d441e8032c608f475ff4044 100644 (file)
@@ -19,7 +19,7 @@
 package altosui;
 
 import java.awt.event.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosFlightStatusUpdate implements ActionListener {
 
index 8742b8ca33210b8983c2d5504b2266a472d8e58d..608042a544947e05521e8213987a071d2c15fd42 100644 (file)
@@ -23,8 +23,8 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.util.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
        AltosVoice              voice;
index c1fdc3a3f25f46d21f597f6893153e892a034e6e..127a5beb0fd1566dc8ca28ca56a25b68ca892f15 100644 (file)
@@ -24,8 +24,8 @@ import java.util.ArrayList;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 import org.jfree.chart.ChartPanel;
 import org.jfree.chart.JFreeChart;
index fc76b2b658c87db172a8043bce7e6912679ae7fa..26bc06e40f648ba4aa8df345826d685c4fe57106 100644 (file)
@@ -25,8 +25,8 @@ import javax.swing.event.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.Arrays;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDisplay, AltosIdleMonitorListener, DocumentListener {
        AltosDevice             device;
@@ -297,6 +297,8 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
 
                thread = new AltosIdleMonitor(this, link, (boolean) remote);
 
+               thread.set_frequency(AltosUIPreferences.frequency(serial));
+
                status_update = new AltosFlightStatusUpdate(flightStatus);
 
                new javax.swing.Timer(100, status_update).start();
index 406b51cf2f1ef25edd7f3a2342745471ab98f802..0d848ab86fea079e2c39780f9eecf03533b678e6 100644 (file)
@@ -25,8 +25,8 @@ import java.io.*;
 import java.text.*;
 import java.util.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosIgniteUI
        extends AltosUIDialog
index 38332b2f367c28d579f5122efcf75174313daa61..c430c35c1a497a944d77d81c585d2a118430c060 100644 (file)
@@ -21,8 +21,8 @@ package altosui;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosIgnitor extends AltosUIFlightTab {
 
index 5952238a3f772b725e6c7f3ba7f7dcc930ee3c37..316594d8873d643ec1f5c44a31e36fa960126680 100644 (file)
@@ -22,8 +22,8 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosLanded extends AltosUIFlightTab implements ActionListener {
 
index 7e47586d17be8d40d0a633268aa8a68c1ebbe2da..fe33d7153849fd98c15388e322bf992b686eb62a 100644 (file)
@@ -21,7 +21,7 @@ package altosui;
 import java.io.*;
 import java.util.concurrent.*;
 import java.awt.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosLaunch {
        AltosDevice     device;
index 56b211acd146e26a532d05a8f767fc03b928af71..875b786e7c77e6fdb295b26644b05f433ca3079a 100644 (file)
@@ -24,7 +24,7 @@ import javax.swing.*;
 import java.io.*;
 import java.text.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altosuilib_14.*;
 
 class FireButton extends JButton {
        protected void processMouseEvent(MouseEvent e) {
index 60f5890588cd218a00b6f34d693b060b3221c89a..004bd5344619f30702c9db30a6c6f731d228abc4 100644 (file)
@@ -19,8 +19,8 @@
 package altosui;
 
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosPad extends AltosUIFlightTab {
 
index 56e46436beaafccc2261cd3438852ce48a61bf74..cbd4800a60c1dafb8abc3527c57166c8a97e3736 100644 (file)
@@ -23,8 +23,8 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class AltosUI extends AltosUIFrame implements AltosEepromGrapher {
        public AltosVoice voice = new AltosVoice();
index eab29cbe7a4c5692d7df09fc3d7ae8d7bf40ae6b..4bf3db120cf380bded3c04e6fd19a863e05b88b2 100644 (file)
@@ -135,7 +135,8 @@ FIRMWARE_TBT=$(FIRMWARE_TBT_3_0) $(FIRMWARE_TBT_4_0)
 FIRMWARE_TMEGA_1_0=$(top_srcdir)/src/telemega-v1.0/telemega-v1.0-$(VERSION).ihx
 FIRMWARE_TMEGA_2_0=$(top_srcdir)/src/telemega-v2.0/telemega-v2.0-$(VERSION).ihx
 FIRMWARE_TMEGA_3_0=$(top_srcdir)/src/telemega-v3.0/telemega-v3.0-$(VERSION).ihx
-FIRMWARE_TMEGA=$(FIRMWARE_TMEGA_1_0) $(FIRMWARE_TMEGA_2_0) $(FIRMWARE_TMEGA_3_0)
+FIRMWARE_TMEGA_4_0=$(top_srcdir)/src/telemega-v4.0/telemega-v4.0-$(VERSION).ihx
+FIRMWARE_TMEGA=$(FIRMWARE_TMEGA_1_0) $(FIRMWARE_TMEGA_2_0) $(FIRMWARE_TMEGA_3_0) $(FIRMWARE_TMEGA_4_0)
 
 FIRMWARE_EMINI_1_0=$(top_srcdir)/src/easymini-v1.0/easymini-v1.0-$(VERSION).ihx
 FIRMWARE_EMINI_2_0=$(top_srcdir)/src/easymini-v2.0/easymini-v2.0-$(VERSION).ihx
index 2666fc332704ec8f3298880bb9a498a0658872e1..9fbc845c44014714d5f2b6a900e7b8a904b12a6a 100644 (file)
@@ -131,6 +131,7 @@ Section "Firmware"
        File "../src/telemega-v1.0/telemega-v1.0-${VERSION}.ihx"
        File "../src/telemega-v2.0/telemega-v2.0-${VERSION}.ihx"
        File "../src/telemega-v3.0/telemega-v3.0-${VERSION}.ihx"
+       File "../src/telemega-v4.0/telemega-v4.0-${VERSION}.ihx"
        File "../src/easymini-v1.0/easymini-v1.0-${VERSION}.ihx"
        File "../src/easymini-v2.0/easymini-v2.0-${VERSION}.ihx"
        File "../src/easymega-v1.0/easymega-v1.0-${VERSION}.ihx"
index dcc1f39f02cd958a93e112821c32d6df659d4c2d..0f8622e35a9f986a11f008404b74dccc61f9a81b 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import libaltosJNI.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosBTDevice extends altos_bt_device implements AltosDevice {
 
index 11d9dacdc8ba706130acdc54f77c3f2a23cc6203..3bf7bb4615c5f805d9b302a91adbd6f692bb9dfd 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.util.*;
 import libaltosJNI.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosBTDeviceIterator implements Iterator<AltosBTDevice> {
        AltosBTDevice   current;
index e8efc2c654adb98852be7e4110e64fc721562668..c94822dc9cecc8fdd91f94e0e9c5111040261227 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosBTKnown implements Iterable<AltosBTDevice> {
        LinkedList<AltosBTDevice>       devices = new LinkedList<AltosBTDevice>();
index ee0b56ee101aa5b41a4d2236679662e090b07730..1726190d58bbdb7b20751bf784643ac260b4775e 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -24,7 +24,7 @@ import javax.swing.*;
 import javax.swing.plaf.basic.*;
 import java.util.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosBTManage extends AltosUIDialog implements ActionListener, Iterable<AltosBTDevice> {
        LinkedBlockingQueue<AltosBTDevice> found_devices;
index c8c6161c7978e6b9ec3a8ccc59b000d2c8b437b9..24720e9cb168e7ee914de8aaa8c2fb3cbae9f060 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosCSVUI
        extends AltosUIDialog
index 618d6517339d9fe9f762cf1fd3c6118d063c2707..d24480b33fb7869d37632fd3c5dd95f18db16e74 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.text.*;
 import java.awt.event.*;
 import javax.swing.*;
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 class AltosEditFreqUI extends AltosUIDialog implements ActionListener {
        Frame           frame;
index caa63e7a4deb702ab0a5a1b54437c06828c90cab..cd8d42fcb482aa6eaddbdbf75b95c9f26490d01a 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosDataChooser extends JFileChooser {
        JFrame  frame;
index a5a068b4d95f2eef7d7694c43b425f195558a2c5..d9e228a63cf66ba827f72536ab6309f093bb4a15 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import libaltosJNI.*;
 
index d8a24b1841d0e0c58c3606907055c8622e96863e..a400d15eca3c14a84d3f5a86b43bc8d5127a008b 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import javax.swing.*;
 import java.awt.*;
index 8ea9e233e330a71c53bb984edac349896a2e4161..604d1d80519d79f37665bf697dcfc3ca9fa29721 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import javax.swing.*;
 import java.awt.*;
index 3726f51526c92f4ad0a34a2ad8a7d49f12f8c894..eb77f0a94b5ae4e15b20295123d61b4875d193c1 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import javax.swing.*;
 import java.io.*;
 import java.text.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosDisplayThread extends Thread {
 
index d7d0b2b7608ed9c84f6b6f24495133d365538515..ff1b15c85719c319a616ddd2fb763b5ab1ce96b3 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosEepromDelete implements Runnable {
        AltosEepromList         flights;
index b8d3bdaa171c4c18a0fcf3fb5f6347c3afada8e4..b6af7ce6657b7326e95d5786e3634bf91362906e 100644 (file)
@@ -12,9 +12,9 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public interface AltosEepromGrapher {
 
index cab3e8c70f1249428d59ecf4515a66ce8c826fdf..19a9bb8052a911d97d3a8a509166612125cb9e7b 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosEepromManage implements ActionListener {
 
index 8f6a9b9e1ea5b4b96cfc3c3182a5d333c445590d..7da9786cce698bc510ecd14c66669b92a2d107a4 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.*;
@@ -24,7 +24,7 @@ import java.util.concurrent.*;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
        class result_holder {
                static int result;
index 427826fad46b49feb40fdb2b8ed0bf99fa3975b7..fff90032614ac4eebed5858630bbe4523154be24 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import javax.swing.*;
 import javax.swing.border.*;
 import java.awt.*;
 import java.awt.event.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 class AltosEepromItem implements ActionListener {
        AltosEepromLog  log;
index 7186e91b33024f14fc7c1e21d3c0dda5f99a6cfe..e61b397337c8b35828e7397746496fabe2764109 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -24,7 +24,7 @@ import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosFlashUI
        extends AltosUIDialog
index 0bb346aec9797ac59ea0385a7accd73356d3f739..5c3d0759ac1880bdafba78015cebfe0bea6cd924 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import javax.swing.table.*;
 
index 49fb4fbcadd53e50d94d76aa818d26a864ac3da3..f354401b43d3b4f24a7f27e68b218875d63af320 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import javax.swing.*;
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosFlightStatsTable extends JComponent implements AltosFontListener {
        GridBagLayout   layout;
index 60eae96247c787dc8f96ad1350371d3db3282b7e..c4a49d683cfa16d65b9d8ab53c720e2436ed1863 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
@@ -45,6 +45,8 @@ public class AltosGraph extends AltosUIGraph {
        static final private AltosUILineStyle accel_color = new AltosUILineStyle();
        static final private AltosUILineStyle vert_accel_color = new AltosUILineStyle();
        static final private AltosUILineStyle orient_color = new AltosUILineStyle();
+       static final private AltosUILineStyle azimuth_color = new AltosUILineStyle();
+       static final private AltosUILineStyle compass_color = new AltosUILineStyle();
 
        static final private AltosUILineStyle gps_height_color = new AltosUILineStyle();
        static final private AltosUILineStyle altitude_color = new AltosUILineStyle();
@@ -84,6 +86,7 @@ public class AltosGraph extends AltosUIGraph {
        static final private AltosUILineStyle mag_along_color = new AltosUILineStyle();
        static final private AltosUILineStyle mag_across_color = new AltosUILineStyle();
        static final private AltosUILineStyle mag_through_color = new AltosUILineStyle();
+       static final private AltosUILineStyle mag_total_color = new AltosUILineStyle();
 
        static AltosUnits dop_units = null;
        static AltosUnits tick_units = null;
@@ -114,7 +117,7 @@ public class AltosGraph extends AltosUIGraph {
                dbm_axis = newAxis("Signal Strength", null, dbm_color, 0);
 
                gyro_axis = newAxis("Rotation Rate", AltosConvert.rotation_rate, gyro_roll_color, 0);
-               orient_axis = newAxis("Tilt Angle", AltosConvert.orient, orient_color, 0);
+               orient_axis = newAxis("Angle", AltosConvert.orient, orient_color, 0);
                mag_axis = newAxis("Magnetic Field", AltosConvert.magnetic_field, mag_along_color, 0);
                course_axis = newAxis("Course", AltosConvert.orient, gps_course_color, 0);
                dop_axis = newAxis("Dilution of Precision", dop_units, gps_pdop_color, 0);
@@ -317,11 +320,26 @@ public class AltosGraph extends AltosUIGraph {
                                            false,
                                            mag_axis);
 
+               flight_series.register_axis(AltosUIFlightSeries.mag_total_name,
+                                           mag_total_color,
+                                           false,
+                                           mag_axis);
+
                flight_series.register_axis(AltosUIFlightSeries.orient_name,
                                            orient_color,
                                            false,
                                            orient_axis);
 
+               flight_series.register_axis(AltosUIFlightSeries.azimuth_name,
+                                           azimuth_color,
+                                           false,
+                                           orient_axis);
+
+               flight_series.register_axis(AltosUIFlightSeries.compass_name,
+                                           compass_color,
+                                           false,
+                                           orient_axis);
+
                flight_series.register_axis(AltosUIFlightSeries.thrust_name,
                                            accel_color,
                                            true,
index 86917319cf04c3353166eff81fa41660924c552a..e20a516c573e278de42696b0cfdba7fb4e84a2c6 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.table.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosInfoTable extends JTable implements AltosFlightDisplay, HierarchyListener {
        private AltosFlightInfoTableModel model;
 
-       static final int info_columns = 3;
-       static final int info_rows = 17;
+       static final int info_columns = 4;
+       static final int info_rows = 18;
 
        private AltosState              last_state;
        private AltosListenerState      last_listener_state;
@@ -201,9 +201,9 @@ public class AltosInfoTable extends JTable implements AltosFlightDisplay, Hierar
                                if (state.gps.lon != AltosLib.MISSING)
                                        info_add_deg(1, "Longitude", state.gps.lon, 'E', 'W');
                                if (state.gps.alt != AltosLib.MISSING)
-                                       info_add_row(1, "GPS altitude", "%8.1f", state.gps.alt);
+                                       info_add_row(1, "GPS altitude", "%8.1f m", state.gps.alt);
                                if (state.gps_height != AltosLib.MISSING)
-                                       info_add_row(1, "GPS height", "%8.1f", state.gps_height);
+                                       info_add_row(1, "GPS height", "%8.1f m", state.gps_height);
 
                                if (state.gps.ground_speed != AltosLib.MISSING && state.gps.course != AltosLib.MISSING)
                                        info_add_row(1, "GPS ground speed", "%6.1f m/s %3d°",
@@ -270,6 +270,28 @@ public class AltosInfoTable extends JTable implements AltosFlightDisplay, Hierar
                                }
                        }
                }
+
+               if (state != null && state.accel_along() != AltosLib.MISSING) {
+                       info_add_row(3, "Accel along", "%8.1f m/s²", state.accel_along());
+                       info_add_row(3, "Accel across", "%8.1f m/s²", state.accel_across());
+                       info_add_row(3, "Accel through", "%8.1f m/s²", state.accel_through());
+                       info_add_row(3, "Gyro roll", "%8.1f °/s", state.gyro_roll());
+                       info_add_row(3, "Gyro pitch", "%8.1f °/s", state.gyro_pitch());
+                       info_add_row(3, "Gyro yaw", "%8.1f °/s", state.gyro_yaw());
+                       if (state.mag_along() != AltosLib.MISSING) {
+                               /* Report mag in nanoteslas (1 G = 100000 nT (or γ)) */
+                               info_add_row(3, "Mag along", "%8.1f µT", state.mag_along() * 100.0);
+                               info_add_row(3, "Mag across", "%8.1f µT", state.mag_across() * 100.0);
+                               info_add_row(3, "Mag Through", "%8.1f µT", state.mag_through() * 100.0);
+                               info_add_row(3, "Mag Bearing", "%8.1f°", Math.atan2(state.mag_across(), state.mag_through()) * 180/Math.PI);
+                       }
+               }
+
+               if (state != null && state.igniter_voltage != null) {
+                       for (int i = 0; i < state.igniter_voltage.length; i++)
+                               info_add_row(3, AltosLib.igniter_name(i), "%9.2f V", state.igniter_voltage[i]);
+               }
+
                info_finish();
        }
 }
index e3caf38ba7d1df5614407b703a526fe441cd2d62..fb3eecfe3dcd80ca566643800df8b4da803ae10a 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import javax.swing.*;
 
index 02cc77d17332f73e86f9a3daa5be1f565d657fff..998d6ea4c3525e7be9ef9d762d1bc9bf0efd275a 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import javax.swing.*;
index ca98ca64a6fce4408a6844574d5cbee789a0c192..9f85bc8b9a878dbf1851770a50ef8367b7e5a980 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 public interface AltosPositionListener {
        public void position_changed(int position);
index eb2e8333d5df9597c2eb767cc0a6be31a7e04441..a25c39c468796637a479356de689100ad2bbde9d 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosRomconfigUI
        extends AltosUIDialog
index fad1b2cde8ce72f9b7c4f2dec9cd5b734707804f..a09142e53406dc0fc7bd0d5a241a71d0c8aa306d 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -26,7 +26,7 @@ import java.io.*;
 import java.util.*;
 import java.text.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 class AltosScanResult {
        String          callsign;
index 1c2e3cd53402ba17dd61acd219433cc8ec85c262..cb2aa87a0117e905adb059b7de27bb838050cdd3 100644 (file)
  * Deal with TeleDongle on a serial port
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.*;
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 import libaltosJNI.*;
 
 /*
index 51474e8a597af8a34c7e463bad98cdca7a4d2daf..e35c81f35a0238646f1b132e9a7a526f197c177e 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 public class AltosSerialInUseException extends Exception {
        public AltosDevice      device;
index 1e2e0618e5baaa7a418bccadfd5dd7bc59081f76..13ce5d4676feb20264c127e0afb02a02eb8cc155 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 public interface AltosShapeListener {
        void set_shapes_visible(boolean visible);
index e2c917b1bed94596e059cda80abec2660eed2e13..7ca8ea8292fb589f36a0c9a810024cc23ba5243d 100644 (file)
  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
 import java.beans.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosUIAccelCal
        extends AltosUIDialog
index 59c5357ad7a10f6067f8c44378d2d54d3d9677ae..75722d12bea000c34de25414e356ac91e7feb3e7 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index e61b5d5205d96d15dc5816c0c6663188fa437d35..8ee89dd4400a72a47b9cb459a57af70888e7f76e 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
 import java.beans.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 class DelegatingRenderer implements ListCellRenderer<Object> {
 
@@ -240,12 +240,12 @@ public class AltosUIConfigure
 
                                                AltosUIPreferences.set_map_cache(size);
                                        } catch (ClassCastException ce) {
-                                               map_cache.setSelectedItem(new Integer(AltosUIPreferences.map_cache()));
+                                               map_cache.setSelectedItem(AltosUIPreferences.map_cache());
                                        }
                                }
                        });
 
-               map_cache.setSelectedItem (new Integer(AltosUIPreferences.map_cache()));
+               map_cache.setSelectedItem (AltosUIPreferences.map_cache());
                pane.add(map_cache, constraints(1, 2, GridBagConstraints.BOTH));
                row++;
        }
index 043fd69bddc4fcfe864ef62f344c07f445ae25b9..e475912b4506f4ec2ba1bd389183966df84e9918 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 public class AltosUIDataMissing extends Exception {
        public int      id;
index b82a78258e5cefc4ad9d7278566df6a080430c9b..0d3d6958131b89e8c18d767d7433306110695dec 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 public interface AltosUIDataPoint {
        public abstract double x() throws AltosUIDataMissing;
index 8602473dcf3d6fe44a08d94312bb29be23d80239..e2cddc941c51417ce41db036530690bd9d2d7ed7 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 public interface AltosUIDataSet {
        public abstract String name();
index 292c5cc17202334a6829b5a4aabfa84eb5c5be13..34bd50d80ecf82ffaec1156aab534362abaa345e 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
index ef9a692a62a47ce07339378d6dc92e6d64e53b19..3806930171b7513a2221059576043448cc97717f 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -25,7 +25,7 @@ import javax.swing.event.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
@@ -175,15 +175,14 @@ public class AltosUIEnable extends Container implements ChangeListener {
                add(line_width_label, c);
 
                line_width = new JSpinner();
-               line_width.setValue(new Integer(1));
+               line_width.setValue(1);
                line_width.addChangeListener(new ChangeListener() {
                                public void stateChanged(ChangeEvent e) {
                                        int w = (Integer) line_width.getValue();
                                        if (w < 1) {
                                                w = 1;
-                                               line_width.setValue(new Integer(w));
+                                               line_width.setValue(w);
                                        }
-                                       System.out.printf("line width set to %d\n", w);
                                        set_line_width(w);
                                }
                        });
@@ -205,7 +204,7 @@ public class AltosUIEnable extends Container implements ChangeListener {
                speed_filter = new JSlider(JSlider.HORIZONTAL, 0, 10000, (int) (filter_listener.speed_filter() * 1000.0));
                Hashtable<Integer,JLabel> label_table = new Hashtable<Integer,JLabel>();
                for (int i = 0; i <= 10000; i += 5000) {
-                       label_table.put(new Integer(i), new JLabel(String.format("%d", i)));
+                       label_table.put(i, new JLabel(String.format("%d", i)));
                }
                speed_filter.setPaintTicks(true);
                speed_filter.setMajorTickSpacing(1000);
index 49c7226c74139108e0d35c03fd17ef91764de478..7e64cc2e2a26230428fbb2838a942eab9f556ba7 100644 (file)
  * General Public License for more details.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.util.*;
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 1633d9b9170560283448d9cf7538f96d26345579..ecd17c1fb3376ea5145fbde49d29d02c178f3c28 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.util.*;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public abstract class AltosUIFlightTab extends JComponent implements AltosFlightDisplay, HierarchyListener {
        public GridBagLayout    layout;
index 301bdc68de43c65b75afac2334240f00cbfbf9ea..71e16e1d372ec00820938b73197aa77380a58a5f 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
index f3f7035d56d885b69ff2f34ee280e809256f25e5..ddfa25ab8a3329888d302c5acc63cf328c81f472 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosUIFreqList extends JComboBox<AltosFrequency> {
 
index da02451310416c47627a8a1b4251a5110d080f91..12176070f50ac441dd967d0126bd76fb355a09de 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.*;
@@ -24,7 +24,7 @@ import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 642072fa98be0e6912b82d38ca4f1ba72f48b095..9f5cd3f16bbc0771ed0eb34d76e59fcedfbd3c02 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 4ced80fd2d94158082d3b96da284d4ac4592633b..fdc2a8a3b4628fc1539ce18b01857747f01d5a2f 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import javax.swing.*;
 import javax.imageio.ImageIO;
index 6baa185c0cf44170095ebe126b6b74212bc8c09f..6027b437ea3189ebf309cf994124eee89c0db71c 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public abstract class AltosUIIndicator implements AltosFontListener, AltosUnitsListener {
        JLabel          label;
index 704782f45feb0f4a9ce04f62fb16aef57ee3a2c4..7553a8ac06bf9a84c2a832be60cb4433bf27fdf9 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import libaltosJNI.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosUILib extends AltosLib {
 
index 872ef9c7242ea46a5e611a3c408df070bc7b97c7..5b0238becf26b6f5d5abecfa4cf9c6a41ef1fca0 100644 (file)
  * General Public License for more details.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 3c54fb54c5ec504127581ecf96df4109c30af165..32afcd24d33599b0cddc569ec7e17cf2c65219c3 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 public interface AltosUIListener {
        public void ui_changed(String look_and_feel);
index bd0a855c01ee6468c549bbdafeb3af6ebb0bfe44..5f1b7ae6f03429a4db89c39ad38763e59c6e05b6 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -28,7 +28,7 @@ import java.awt.geom.*;
 import java.util.*;
 import java.util.concurrent.*;
 import javax.imageio.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosMapInterface {
 
index ffd974acd16855aaa6f8386b70a25a81aae596a7..31c8ed1b8abc9911df9ef2d77a3807b616039916 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -27,7 +27,7 @@ import java.text.*;
 import java.lang.Math;
 import java.net.URL;
 import java.net.URLConnection;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 class AltosUIMapPos extends Box implements ActionListener {
        AltosUIMapPreload       preload;
index 63e8102410686e8446c7eaec1731aa7873707dd0..37ae2e85c93bb31d8062f1025613f286c2b59fe0 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 062cb49dd2d090156667606275f6bd9e2334550b..7e3178d8dd887a926ebc28d127e084801b91d056 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.*;
 import java.awt.Component;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosUIPreferences extends AltosPreferences {
 
index 7c05e0e584f3094e181f775027e3a8ad0c67429e..66b46c5121b0b894ab91d9b5154ea9c65fc2fed9 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.File;
 import java.util.prefs.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 import javax.swing.filechooser.FileSystemView;
 
 public class AltosUIPreferencesBackend extends AltosPreferencesBackend {
index 1717fb69b98934a5e4ed4588747926f497e9689f..0e36e833f2c7f65ecdf690026aab4584bf2c9cf6 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosUIRateList extends JComboBox<String> {
 
index 84f190e6da3eaaa5978a1bb3b2739f1d7ee7e656..31d40399ee0b6bd89e3cd59aa50ed98c897cb6cf 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.util.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 
 public class AltosUITelemetryList extends JComboBox<String> {
index 4c2f9ba9a85e608b029c5f92d5c24d5f00acc9e7..63d5c0574c5a9e1aa940f8ae43ab9ce5580906b5 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.io.*;
 import java.util.ArrayList;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import org.jfree.ui.*;
 import org.jfree.chart.*;
index 19687c3273f967cec56bc5308c11307ff2102018..110d40972bdc734e8ff438b0c6e57b2baf7bfa81 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public abstract class AltosUIUnitsIndicator extends AltosUIIndicator {
 
index c8797b7235812122e690ec2949b448850c03396e..a9356b349ea18eeb82afaabaa33a8b3ccffd1a35 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public abstract class AltosUIVoltageIndicator extends AltosUIUnitsIndicator {
 
index e4b94eeaed77efd12645dc208f57452f31fee2af..349cd3ce2f1a51b16833144817e162153061f8e9 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.util.*;
 import libaltosJNI.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosUSBDevice  extends altos_device implements AltosDevice {
 
index 264eede3e27f23a4416fd4f30c84c05992027483..7232e4887edf12bea6052585ee19aba257f20cba 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import com.sun.speech.freetts.Voice;
 import com.sun.speech.freetts.VoiceManager;
index c05412cee7fce6df3576245da77c19b739ff9ecd..255d0b5e6172bcd25fbc0f98afe4397a7a40294b 100755 (executable)
@@ -55,7 +55,7 @@ Copyright © 2003-2007 Apple, Inc., All Rights Reserved
 
 */
 
-package org.altusmetrum.altosuilib_13;
+package org.altusmetrum.altosuilib_14;
 
 import java.lang.reflect.*;
 import java.util.HashMap;
index ec024e32d4b3576b51b7bc2af583dac60a7ee1ee..8505a682d03c7b7dc0ccd88c5c338752efccbd83 100755 (executable)
@@ -1,11 +1,11 @@
 #!/bin/sh
 
-VERSION=3.0
+VERSION=4.0
 PRODUCT=TeleMega
 BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
 
 echo "$PRODUCT-v$VERSION Test Program"
-echo "Copyright 2014 by Keith Packard.  Released under GPL v2"
+echo "Copyright 2020 by Bdale Garbee.  Released under GPL v3"
 echo
 echo "Expectations:"
 echo "\t$PRODUCT v$VERSION powered from USB"
diff --git a/ao-bringup/test-telemega-v3.0 b/ao-bringup/test-telemega-v3.0
new file mode 100755 (executable)
index 0000000..ec024e3
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+VERSION=3.0
+PRODUCT=TeleMega
+BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
+
+echo "$PRODUCT-v$VERSION Test Program"
+echo "Copyright 2014 by Keith Packard.  Released under GPL v2"
+echo
+echo "Expectations:"
+echo "\t$PRODUCT v$VERSION powered from USB"
+echo
+
+ret=1
+ao-list | while read product serial dev; do
+    case "$product" in
+       "$PRODUCT-v$VERSION")
+
+           echo "Testing $product $serial $dev"
+
+           ./test-igniters $dev main drogue 3 0 1 2
+           echo""
+
+           echo "Testing baro sensor"
+           ../ao-tools/ao-test-baro/ao-test-baro --tty="$dev"
+
+           case $? in
+               0)
+                   ;;
+               *)
+                   echo "failed"
+                   exit 1
+           esac
+           echo""
+
+           FLASHSIZE=8388608
+
+           echo "Testing flash"
+           ../ao-tools/ao-test-flash/ao-test-flash --tty="$dev" "$FLASHSIZE"
+
+           case $? in
+               0)
+                   ;;
+               *)
+                   echo "failed"
+                   exit 1
+           esac
+           echo""
+
+           echo "Testing GPS"
+           ../ao-tools/ao-test-gps/ao-test-gps --tty="$dev"
+
+           case $? in
+               0)
+                   ;;
+               *)
+                   echo "failed"
+                   exit 1
+           esac
+           echo""
+
+           echo "$PRODUCT-v$VERSION" serial "$serial" is ready to ship
+           echo "\007"
+           ret=0
+           ;;
+    esac
+done
index 1fce345ac8d305e274eefd7839017bf0c450385b..67f4fb0cfc511b21113d9b516b98510508522791 100755 (executable)
@@ -14,12 +14,12 @@ else
        exit 1
 fi
 
-VERSION=3.0
+VERSION=4.0
 REPO=~/altusmetrumllc/Binaries
 PRODUCT=TeleMega
 
 echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
-echo "Copyright 2017 by Bdale Garbee.  Released under GPL v3"
+echo "Copyright 2020 by Bdale Garbee.  Released under GPL v3"
 echo
 echo "Expectations:"
 echo "\t$PRODUCT v$VERSION powered from USB"
diff --git a/ao-bringup/turnon_telemega_v3.0 b/ao-bringup/turnon_telemega_v3.0
new file mode 100755 (executable)
index 0000000..1fce345
--- /dev/null
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+if [ -x /usr/bin/ao-flash-stm ]; then
+       FLASH_STM=/usr/bin/ao-flash-stm
+else
+       echo "Can't find ao-flash-stm!  Aborting."
+       exit 1
+fi
+
+if [ -x /usr/bin/ao-usbload ]; then
+       USBLOAD=/usr/bin/ao-usbload
+else
+       echo "Can't find ao-usbload!  Aborting."
+       exit 1
+fi
+
+VERSION=3.0
+REPO=~/altusmetrumllc/Binaries
+PRODUCT=TeleMega
+
+echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
+echo "Copyright 2017 by Bdale Garbee.  Released under GPL v3"
+echo
+echo "Expectations:"
+echo "\t$PRODUCT v$VERSION powered from USB"
+echo "\t\twith ST-Link-V2 cabled to debug header"
+echo "\t\twith coax from UHF to frequency counter"
+echo
+
+case $# in
+    1)
+       SERIAL="$1"
+       echo "$PRODUCT-$VERSION serial number: $SERIAL" 
+       ;;
+    0)
+       echo -n "$PRODUCT-$VERSION serial number: "
+       read SERIAL
+       ;;
+    *)
+       echo "Usage: $0 <serial-number>" 1>&2
+       exit 1;
+       ;;
+esac
+
+echo $FLASH_STM
+
+$FLASH_STM $REPO/loaders/telemega-v$VERSION*.elf 
+
+sleep 3
+
+$USBLOAD --serial=$SERIAL --force $REPO/telemega-v$VERSION*.elf || exit 1
+
+sleep 5
+
+dev=`ao-list | awk '/TeleMega-v'"$VERSION"'/ { print $3; exit(0); }'`
+
+case "$dev" in
+/dev/tty*)
+       echo "TeleMega found on $dev"
+       ;;
+*)
+       echo 'No TeleMega-v'"$VERSION"' found'
+       exit 1
+       ;;
+esac
+
+echo 'E 0' > $dev
+
+SERIAL=$SERIAL ./cal-freq $dev
+
+failed=1
+while [ $failed = 1 ]; do
+    ../ao-tools/ao-cal-accel/ao-cal-accel $dev
+    failed=$?
+done
+
+echo 'E 1' > $dev
+
+./test-telemega
+
+exit $?
index 91a6ccb352ac1740da8f89280dcdbc3c2769cfeb..2f0762420432fece69f082c618a6a0a20b296bbf 100644 (file)
@@ -351,6 +351,16 @@ main (int argc, char **argv)
                case AO_LOG_FORMAT_MICROPEAK2:
                        len = 2;
                        break;
+               case AO_LOG_FORMAT_TELEMEGA_4:
+                       len = 32;
+                       break;
+                       max_adc= 4095;
+                       adc_ref = 3.3;
+                       batt_r1 = 5600;
+                       batt_r2 = 10000;
+                       sense_r1 = 100e3;
+                       sense_r2 = 27e3;
+                       break;
                }
                if (arg_len)
                        len = arg_len;
@@ -398,6 +408,7 @@ main (int argc, char **argv)
                                case AO_LOG_FORMAT_TELEMEGA:
                                case AO_LOG_FORMAT_TELEMEGA_3:
                                case AO_LOG_FORMAT_EASYMEGA_2:
+                               case AO_LOG_FORMAT_TELEMEGA_4:
                                        log_mega = (struct ao_log_mega *) &eeprom->data[pos];
                                        switch (log_mega->type) {
                                        case AO_LOG_FLIGHT:
index 02d53ff32cacf571bb0e25474cb27ed3227cc895..984184d65b88e5189e6a1f7e353d628bb1780376 100644 (file)
@@ -150,7 +150,8 @@ main (int argc, char **argv)
                                        }
                                        printf ("\n");
                                        break;
-                               case AO_TELEMETRY_MEGA_SENSOR:
+                               case AO_TELEMETRY_MEGA_SENSOR_MPU:
+                               case AO_TELEMETRY_MEGA_SENSOR_BMX160:
                                        printf ("orient %3d accel %5d pres %9d temp %5d accel_x %5d accel_y %5d accel_z %5d gyro_x %5d gyro_y %5d gyro_z %5d mag_x %5d mag_y %5d mag_z %5d\n",
                                                telem.mega_sensor.orient,
                                                telem.mega_sensor.accel,
index 82893f246638481005a5989d148b2457068c1d86..e4a9b0ccba23b171bea671a4d2407bf0ed45a618 100644 (file)
@@ -44,6 +44,7 @@
 #define AO_LOG_FORMAT_EASYMEGA_2       16      /* 32 byte typed telemega records with 32 bit gyro cal, mpu9250 rotated 90° and adxl375 */
 #define AO_LOG_FORMAT_TELESTATIC       17      /* 32 byte typed telestatic records */
 #define AO_LOG_FORMAT_MICROPEAK2       18      /* 2-byte baro values with header */
+#define AO_LOG_FORMAT_TELEMEGA_4       19      /* 32 byte typed telemega records with 32 bit gyro cal and Bmx160 */
 #define AO_LOG_FORMAT_NONE             127     /* No log at all */
 
 enum ao_pyro_flag {
index 256af3a116532b12af68e5537c44c78cf655d44e..25576fca59252488384a12ecc8c70caacd669829 100644 (file)
@@ -160,8 +160,9 @@ struct ao_telemetry_companion {
        uint16_t                                companion_data[AO_COMPANION_MAX_CHANNELS];      /*  8 */
        /* 32 */
 };
-       
-#define AO_TELEMETRY_MEGA_SENSOR       0x08
+
+#define AO_TELEMETRY_MEGA_SENSOR_MPU           0x08    /* Invensense IMU */
+#define AO_TELEMETRY_MEGA_SENSOR_BMX160                0x12    /* BMX160 IMU */
 
 struct ao_telemetry_mega_sensor {
        uint16_t        serial;         /*  0 */
index 76b5e57ac913e1d0555dfcf96b67a8995ef79e28..74a96a40aae1266dee98d5f3f3965bdf8fffe05c 100644 (file)
@@ -18,15 +18,19 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([altos], 1.9.1)
-ANDROID_VERSION=18
+AC_INIT([altos], 1.9.2)
+ANDROID_VERSION=27
 AC_CONFIG_SRCDIR([src/kernel/ao.h])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
-RELEASE_DATE=2019-12-05
+RELEASE_DATE=2020-02-26
 AC_SUBST(RELEASE_DATE)
 
+DOC_DATE=`LC_ALL=C date -d $RELEASE_DATE +'%d %b %Y'`
+
+AC_SUBST(DOC_DATE)
+
 VERSION_DASH=`echo $VERSION | sed 's/\./-/g'`
 AC_SUBST(VERSION_DASH)
 AC_SUBST(ANDROID_VERSION)
@@ -34,8 +38,8 @@ AC_SUBST(ANDROID_VERSION)
 dnl ==========================================================================
 dnl Java library versions
 
-ALTOSUILIB_VERSION=13
-ALTOSLIB_VERSION=13
+ALTOSUILIB_VERSION=14
+ALTOSLIB_VERSION=14
 
 AC_SUBST(ALTOSLIB_VERSION)
 AC_DEFINE(ALTOSLIB_VERSION,$ALTOSLIB_VERSION,[Version of the AltosLib package])
@@ -166,9 +170,7 @@ fi
 ANDROID_RELEASE=no
 if test "x$ANDROID_SDK" != "xno"; then
        HAVE_ANDROID_SDK="yes"
-       if test -f "$HOME/altusmetrumllc/google-play-release.keystore" -a -f "$HOME/altusmetrumllc/google-play-passphrase"; then
-               ANDROID_RELEASE=yes
-       fi
+       ANDROID_RELEASE=yes
 else
        HAVE_ANDROID_SDK="no"
 fi
@@ -556,6 +558,7 @@ telegps/telegps-windows.nsi
 altosdroid/Makefile
 altosdroid/local.properties
 altosdroid/app/src/main/AndroidManifest.xml
+altosdroid/app/build.gradle
 ao-tools/Makefile
 ao-tools/lib/Makefile
 ao-tools/ao-rawload/Makefile
index 5bf3c0ef5d9fbdd7fee9926e1b5ee480f34a754d..464cd988bef3ca242e3f0034cbb68c96721a0cb2 100644 (file)
@@ -17,6 +17,7 @@ FAKETIME=TZ=UTC faketime -f '$(RELEASE_DATE) 00:00:00 i0'
 endif
 
 RELNOTES_INC=\
+       release-notes-1.9.2.inc \
        release-notes-1.9.1.inc \
        release-notes-1.9.inc \
        release-notes-1.8.7.inc \
@@ -278,6 +279,8 @@ DOC=$(HTML) $(PDF) $(IMAGES) $(MAP_SVG_FILES) $(STYLESHEET)
 
 SUFFIXES = .dot .svg .inc .txt .adoc .pdf .html
 
+ATTRIBUTES=--attribute="revdate=$(DOC_DATE)" --attribute="version=$(VERSION)"
+
 .dot.svg:
        dot -Tsvg -o$@ $*.dot
 
@@ -288,10 +291,10 @@ SUFFIXES = .dot .svg .inc .txt .adoc .pdf .html
        sed -e 's/^[    ]*//' -e 's/^\\//' $*.inc > $@
 
 .adoc.html:
-       asciidoctor -b html5 $*.adoc
+       asciidoctor $(ATTRIBUTES) -b html5 $*.adoc
 
 .adoc.pdf:
-       asciidoctor-pdf $*.adoc
+       asciidoctor-pdf $(ATTRIBUTES) $*.adoc
 
 all:   $(HTML) $(PDF)
 
index bd47f0b2a452e02fc0d63eec3c80206cfa6fd4f3..066283c32a8380cef9beac537e641a2bb9473a17 100644 (file)
@@ -1,26 +1,17 @@
 Creating documentation for a new release of AltOS
 
-* Write release notes in release-notes-${version}.inc. Add to
-  Makefile
+* Write release notes in release-notes-${version}.inc. Add to Makefile
 
-* Make sure that doc/altusmetrum.txt has the right copyright 
-  year
+* Make sure that doc/altusmetrum.txt has the right copyright year
 
-* Add references to that as appropriate from each of the
-  documents:
+* Make sure doc/altusmetrum-theme.yml has the right copyright year
+
+* Add references to that as appropriate from each of the documents:
 
        release-notes.inc
        easymini-release-notes.inc
        telegps-release-notes.inc
 
-* Update version in main docs
-
-       altusmetrum.txt
-       easymini.txt
-       micropeak.txt
-       telegps.txt
-       telemetry.txt
-
-* Add release-notes-${version}.inc to git
+* Add release-notes-${version}.inc to Makefile.am and git
 
 * Make sure new hardware specs are documented in specs.inc
index 433f33d4cb2e6e09a583ac64cf9c1a8ab86625a7..f3026222c01088959c2fa10638b0b6fba5463fb0 100644 (file)
@@ -51,7 +51,7 @@ footer:
     left:
       content: '{page-number}'
     right:
-      content: '© 2018 Bdale Garbee and Keith Packard. Creative Commons ShareAlike 3.0 License'
+      content: '© 2020 Bdale Garbee and Keith Packard. Creative Commons ShareAlike 3.0 License'
   verso:
     left:
       content: $footer_recto_right_content
index 408f8a7479c6cd9a2a2e0bf05137e0956f8b9e0f..6016388871fa15edad57373825addaa82bb599ad 100644 (file)
@@ -1,11 +1,11 @@
 = The Altus Metrum System: An Owner's Manual for Altus Metrum Rocketry Electronics
 Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>; Bob Finch; Anthony Towns
 :title-logo-image: image:../themes/background.png[]
-:revnumber: v1.9.1
-:revdate: 5 Dec 2019
+:revnumber: v{version}
+:revdate: 1 Jan 1970
 :icons:
 :icontype: svg
-:copyright: Bdale Garbee and Keith Packard 2019
+:copyright: Bdale Garbee and Keith Packard 2020
 :doctype: book
 :numbered:
 :stylesheet: am.css
index a948aaae36cf8dee123ead07e44321319d78ef62..506f4c5f2fea3dc0c9d9fa2d3c1b23c02ab18cc8 100644 (file)
                EasyMega provides explicit support for an external pyro
                battery. All that is required is to remove the jumper
                between the lipo terminal (Bottom 3) and the pyro terminal
-               (Bottom 2). Then hook the negative pyro battery terminal to ground
-               (Bottom 1) and the positive pyro battery to the pyro battery
-               input (Bottom 2). You can then use the existing pyro screw
+               (Bottom 2). Then hook the negative pyro battery terminal to 
+               ground (Bottom 1) and the switched positive pyro battery to 
+               the pyro battery input (Bottom 2). Note that you must include
+               a switch between the pyro battery and the board for safety,
+               as the on-board power switch circuit only supports the primary
+               battery!  You can then use the existing pyro screw
                terminals to hook up all of the pyro charges.
 
        === Using Only One Battery With EasyMega
index 82ea959c3be825282aa17cdc1f01ef8850853155..d82a26075b17ac0d7320f9cd18bf6847124b2969 100644 (file)
                ground, connect it to the negative external battery
                connection, top terminal 4.
 
-               Connecting the positive battery terminal to the pyro
+               Connecting the switched positive battery terminal to the pyro
                charges must be done separate from EasyMini, by soldering
-               them together or using some other connector.
+               them together or using some other connector.  Note that for
+               safety, you must put a switch between the pyro battery and
+               the rest of the circuit!
 
                The other lead from each pyro charge is then inserted into
                the appropriate per-pyro channel screw terminal (top
index 7810b4fac60b1417c8b58870c6f189f802eb32f8..448f8060c9019c4e92fb0b8b7937499ed068749d 100644 (file)
@@ -1,9 +1,9 @@
 = EasyMini Owner's Manual
 Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
 :title-logo-image: image:../themes/background.png[]
-:revnumber: v1.9.1
-:revdate: 5 Dec 2019
-:copyright: Bdale Garbee and Keith Packard 2019
+:revnumber: v{version}
+:revdate: 01 Jan 1970
+:copyright: Bdale Garbee and Keith Packard 2020
 :doctype: book
 :numbered:
 :toc:
index e4d8aa989acd5828508dee47d36779e2183d5345..18a5afdf7b54673d756c0a51aee2ca447f472c32 100644 (file)
@@ -1,8 +1,8 @@
 = MicroPeak Owner's Manual
 Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
-:revnumber: v1.9.1
-:revdate: 5 Dec 2019
-:copyright: Bdale Garbee and Keith Packard 2019
+:revnumber: v{version}
+:revdate: 01 Jan 1970
+:copyright: Bdale Garbee and Keith Packard 2020
 :stylesheet: am.css
 :linkcss:
 :toc:
diff --git a/doc/release-notes-1.9.2.inc b/doc/release-notes-1.9.2.inc
new file mode 100644 (file)
index 0000000..c550b70
--- /dev/null
@@ -0,0 +1,23 @@
+= Release Notes for Version 1.9.2
+include::release-head.adoc[]
+:doctype: article
+
+       Version 1.9.2
+
+       == AltOS
+
+       * Add support for TeleMega v4.0
+
+       * Fix time wrapping issue with TeleLCO and TeleFire
+
+       == AltosUI, TeleGPS, MicroPeak
+
+       * Add column in AltosUI for IMU data from TeleMega and EasyMega
+
+       == AltosDroid
+
+       * Allow sorting of trackers by call, serial, frequency or age
+
+       * Offer selection of font sizes
+
+       * Various bug fixes for older Android versions
index a51c6b04e529fa59e7a7e0e2541ef6385e1b9ec2..dc3df120ed9c361995771ca841721e5ea573ca9c 100644 (file)
@@ -1,5 +1,9 @@
 [appendix]
 == Release Notes
+       :leveloffset: 2
+       include::release-notes-1.9.2.adoc[]
+
+       <<<<
        :leveloffset: 2
        include::release-notes-1.9.1.adoc[]
 
index e6310e52e23f6a9aab9f10386b2f42c10ecc0675..b69d52ee63a78ce2a8efa44632bdfae9d7eb94a0 100644 (file)
        |40mW
        |3.7V
 
+       |TeleMega v4.0
+       |MS5607 30km (100k')
+       |ADXL375 200g
+       |uBlox Max-8Q
+       |BMX160
+       |8MB
+       |40mW
+       |3.7V
+
        endif::telemega[]
        ifdef::easymega[]
        |EasyMega v1.0
index dd21f5ecd43b1d275cebc6b9e9e6c8f471edb592..b8911a8a51197d4370734f5844f4ae1aba5694f3 100644 (file)
@@ -1,9 +1,9 @@
 = TeleGPS Owner's Manual
 Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
 :title-logo-image: image:../themes/background.png[]
-:revnumber: v1.9.1
-:revdate: 5 Dec 2019
-:copyright: Bdale Garbee and Keith Packard 2019
+:revnumber: v{version}
+:revdate: 01 Jan 1970
+:copyright: Bdale Garbee and Keith Packard 2020
 :stylesheet: am.css
 :linkcss:
 :toc:
index bca8cb60fad7b3ce97d2bd2a682b844675eca915..7522b9837da8f58b3241cf84818b402e322e5f0a 100644 (file)
@@ -1,12 +1,12 @@
 = TeleLaunch: The Altus Metrum Wireless Launch Control System
 Bdale Garbee <bdale@gag.com>
 :title-logo-image: image:../themes/background.png[]
-:revnumber: v0.1
-:revdate: 16 Feb 2019
+:revnumber: v{version}
+:revdate: 01 Jan 1970
 :icons:
 :icontype: svg
 :revremark: initial draft
-:copyright: Bdale Garbee 2019
+:copyright: Bdale Garbee 2020
 :doctype: book
 :numbered:
 :stylesheet: am.css
index 0975172f6c6f189dd5ba55f72b3079938eb382a7..092077e00da73e04923c77167f9e783d965e8283 100644 (file)
                TeleMega provides explicit support for an external pyro
                battery. All that is required is to remove the jumper
                between the lipo terminal (Bottom 3) and the pyro terminal
-               (Bottom 2). Then hook the negative pyro battery terminal to ground
-               (Bottom 1) and the positive pyro battery to the pyro battery
-               input (Bottom 2). You can then use the existing pyro screw
+               (Bottom 2). Then hook the negative pyro battery terminal to 
+               ground (Bottom 1) and the switched positive pyro battery to 
+               the pyro battery input (Bottom 2). Note that you must include
+                a switch between the pyro battery and the board for safety,
+                as the on-board power switch circuit only supports the primary
+                battery!  You can then use the existing pyro screw
                terminals to hook up all of the pyro charges.
 
        === Using Only One Battery With TeleMega
index 3247db9553e214dd3d00c15966433380ba29788f..7ef9876f6439eeff0dc91b5d011df7a2d1a9fa31 100644 (file)
                stranded, into the GND hole just above the screw terminal
                strip and solder it in place.
 
-               Connecting the positive battery terminal to the pyro
+               Connecting the switched positive battery terminal to the pyro
                charges must be done separate from TeleMetrum, by soldering
-               them together or using some other connector.
-
+               them together or using some other connector. Note that you 
+               must include a switch in the positive lead from the pyro 
+               battery for safety!
 
                The other lead from each pyro charge is then inserted into
-               the appropriate per-pyro channel screw terminal (terminal 4 for the
-               Main charge, terminal 6 for the Apogee charge).
+               the appropriate per-pyro channel screw terminal (terminal 4 
+               for the Main charge, terminal 6 for the Apogee charge).
 
        === Using an Active Switch with TeleMetrum
 
index b7a0ce4890f71e061cf24f749128fe1bfcc024d9..4152de33a78f97ddcbd1fe6c38b0c59ae1426422 100644 (file)
@@ -1,8 +1,8 @@
 = AltOS Telemetry
 Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
-:revnumber: v1.9.1
-:revdate: 5 Dec 2019
-:copyright: Bdale Garbee and Keith Packard 2019
+:revnumber: v{version}
+:revdate: 01 Jan 1970
+:copyright: Bdale Garbee and Keith Packard 2020
 :stylesheet: am.css
 :linkcss:
 :doctype: article
index b7b26a8a261999726fa8c976bd9f4a1b05fc2a87..03732b2af2ac4ee03d7dfed70845d42aeabc6b47 100644 (file)
 
                As described above, using an external pyro battery involves
                connecting the negative battery terminal to the flight
-               computer ground, connecting the positive battery terminal to
-               one of the igniter leads and connecting the other igniter
-               lead to the per-channel pyro circuit connection. Because
-               there is no solid ground connection to use on TeleMini, this
-               is not recommended.
+               computer ground, connecting the switched positive battery 
+               terminal to one of the igniter leads and connecting the other 
+               igniter lead to the per-channel pyro circuit connection. 
+               Because there is no solid ground connection to use on 
+               TeleMini, this is not recommended.
 
                The only available ground connection on TeleMini v3 are
                the two mounting holes next to the telemetry
@@ -75,7 +75,9 @@
 
                Connecting the positive battery terminal to the pyro
                charges must be done separate from TeleMini v3, by soldering
-               them together or using some other connector.
+               them together or using some other connector.  Note that you 
+               must include a switch in the pyro battery positive lead for
+               safety!
 
                The other lead from each pyro charge is then inserted into
                the appropriate per-pyro channel screw terminal (terminal 3 for the
index dd795bdd4125f7a0ad55987a1a0ba35d000ce12c..68d08bad8690a821f8b5649f70d788e187383156 100644 (file)
 
                To use a separate pyro battery, connect the negative pyro
                battery terminal to the flight computer ground terminal,
-               the positive battery terminal to the igniter and the other
+               the the switched positive battery terminal to the igniter 
+               and the other
                igniter lead to the negative pyro terminal on the flight
                computer. When the pyro channel fires, it will complete the
                circuit between the negative pyro terminal and the ground
                to hook this up for each flight computer will be found
                in the section below for that flight computer.
 
+               Note that you must include a switch in the positive lead of 
+               the pyro battery for safety, as the on-board power switch 
+               circuit on our product only controls current flow from the 
+               the primary or system battery!
+
+
        === Using a Different Kind of Battery
 
                EasyMini
index 713a775c6f70c9acee6011705b5aa6256cd06bc2..fb8c314e3ae1b5f233d605090bbed39147f8a8e2 100644 (file)
@@ -49,12 +49,17 @@ PUBLIC int
 altos_getchar(struct altos_file *file, int timeout)
 {
        int     ret;
+
+       file->busy = 1;
        while (file->in_read == file->in_used) {
                ret = altos_fill(file, timeout);
                if (ret)
-                       return ret;
+                       goto done;
        }
-       return file->in_data[file->in_read++];
+       ret = file->in_data[file->in_read++];
+done:
+       file->busy = 0;
+       return ret;
 }
 
 PUBLIC int
@@ -115,6 +120,9 @@ int altos_bt_port(struct altos_bt_device *device) {
 PUBLIC void
 altos_free(struct altos_file *file)
 {
+       int i;
        altos_close(file);
+       for (i = 0; i < 10 && file->busy; i++)
+               altos_pause_one_second();
        free(file);
 }
index bf5d46998b19f10dbf321fae72458f13e38df07a..97eedd3be084dcae1a9c9962644bdbd58bdcf7cd 100644 (file)
@@ -200,3 +200,11 @@ altos_fill(struct altos_file *file_common, int timeout)
        return 0;
 }
 
+#include <time.h>
+
+void
+altos_pause_one_second(void)
+{
+       struct timespec delay = { .tv_sec = 1, .tv_nsec = 0 };
+       nanosleep(&delay, NULL);
+}
index ee3dd708873d39a1e05fbb51c488e0748a0a8b94..f356eb6b4907996f4cfda52d0fa3588e80b06cac 100644 (file)
@@ -35,6 +35,7 @@ struct altos_file {
        unsigned char                   in_data[USB_BUF_SIZE];
        int                             in_used;
        int                             in_read;
+       int                             busy;
 };
 
 #ifdef LINUX
@@ -64,4 +65,7 @@ altos_fill(struct altos_file *file, int timeout);
 int
 altos_bt_port(struct altos_bt_device *device);
 
+void
+altos_pause_one_second(void);
+
 #endif /* _LIBALTOS_PRIVATE_H_ */
index 846e2217b4c7799ec155cd9870264eb798165b77..03c2958f52bc1a63b1a0dc71c01eb43a82472e8a 100644 (file)
@@ -760,3 +760,9 @@ altos_bt_open(struct altos_bt_device *device)
        }
        return &file->file;
 }
+
+void
+altos_pause_one_second(void)
+{
+       Sleep(1000);
+}
index 29528541beaf08a3fcfe3bfc3eddeedaf5ee2e22..3d1d5d7317f3e938732efda8ed7f29caed76a681 100644 (file)
@@ -20,7 +20,7 @@ import java.text.*;
 import java.util.*;
 import java.util.concurrent.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosMapd implements AltosLaunchSiteListener {
 
index 6c95da8f7b705b6d02df2ab7f683e434b6dd1f5d..9dda062b16bbfefd33f6147db20ed8a8db58b72e 100644 (file)
@@ -19,7 +19,7 @@ import java.util.*;
 import java.util.concurrent.*;
 import java.io.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosMapdClient extends Thread implements AltosMapStoreListener {
        private Socket          socket;
index fcfe326183e05aa06c04b342d919cd1ead41a55e..87c7535991bc66d52fb5ce91d2c7c337922267ad 100644 (file)
@@ -16,7 +16,7 @@ package altosmapd;
 
 import java.io.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosMapdPreferences extends AltosPreferencesBackend {
 
index ad0a4f5f3aa439f4a9f530b0f7c96a88def9fe4e..411ed55598253395eecf5b79dc379ce1a1cb9c5d 100644 (file)
@@ -19,7 +19,7 @@ import java.io.*;
 import java.util.*;
 import java.text.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class AltosMap {
 
index 96053ac55ca712c8e8c45f12441eff8ed5779c7d..4a795dffa2337edd97c2dc8a8c3f9bd0b0671a55 100644 (file)
@@ -21,8 +21,8 @@ package org.altusmetrum.micropeak;
 import java.lang.*;
 import java.io.*;
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroData {
        public int              ground_pressure;
index c39dab96c9535aa29cd07b94f6d5d097164ea139..d5fe326bddf70f739a3e1bdc43f6cf9966aa19b6 100644 (file)
@@ -22,7 +22,7 @@ import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
 import java.util.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroDeviceDialog extends AltosDeviceDialog {
 
index e656dc6fb214292000aaca59b43d1c6f3fffc98f..1ede2d9a78989dd14f8599d098191807bdbe7026 100644 (file)
@@ -24,8 +24,8 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroDownload extends AltosUIDialog implements Runnable, ActionListener, MicroSerialLog, WindowListener {
        MicroPeak       owner;
index a98140ba5970ed1dd86a20d2aa087564cd501d81..a6dd200d09138b39dc013d8ef7b5b78f84119d29 100644 (file)
@@ -24,8 +24,8 @@ import java.util.ArrayList;
 import java.awt.*;
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroExport extends JFileChooser {
 
index 9e50aa8de65f285253ff64d70f1dee1c55e2ad56..cea41c41374d8690af1649b8fcbc3678850f6cd3 100644 (file)
@@ -20,8 +20,8 @@ package org.altusmetrum.micropeak;
 
 import java.io.*;
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroFile {
 
index c7a6d782c7abc06ffe8a74973abc86d706951d10..61573c818e0efd49e612473ea4f59f9c076b98e9 100644 (file)
@@ -21,8 +21,8 @@ package org.altusmetrum.micropeak;
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroFileChooser extends JFileChooser {
        JFrame  frame;
index 8129aedbd621f71fa5c38570ccf22a85056c1a9c..ec99c64274ec6dd38e6c7eba5b44348741138736 100644 (file)
@@ -22,7 +22,7 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import java.util.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroFrame extends AltosUIFrame {
        static String[] micro_icon_names = {
index eee5bc07a04b0bd4c6711fa0efd4f386c993a01b..eb08c5527a3516edcbc12e6efd403f983ebe405e 100644 (file)
@@ -24,8 +24,8 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroPeak extends MicroFrame implements ActionListener, ItemListener, AltosFilterListener {
 
index 9d022d0ac270819de1a4617b000c2f635b619fbd..a81a8c89b80deea47b421bde1dc51066cd5da9fa 100644 (file)
@@ -21,8 +21,8 @@ package org.altusmetrum.micropeak;
 import java.awt.*;
 import java.io.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroRaw extends JTextArea implements AltosFontListener {
 
index d6e354f261a881e5903a4b227392ce96af98ad69..b45cd834d3a2c1c1ae557323b8aced57bc9b9020 100644 (file)
@@ -25,8 +25,8 @@ import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroSave extends JFileChooser {
 
index 04b58a87dab060e40ae4eaa02f691e5204d1499e..57fb30db90766fbb06d85e08b382ebaee4846dc3 100644 (file)
@@ -21,7 +21,7 @@ package org.altusmetrum.micropeak;
 import java.util.*;
 import java.io.*;
 import libaltosJNI.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroSerial extends InputStream {
        SWIGTYPE_p_altos_file   file;
index 0a1481c45911feb5cb5927af1ddc9b6321fd1e40..eb770d8872164914b36c07a5708f985e53df3afe 100644 (file)
@@ -21,7 +21,7 @@ package org.altusmetrum.micropeak;
 import java.util.*;
 import java.io.*;
 import libaltosJNI.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public interface MicroSerialLog {
 
index 092c3d44ef34d8c6bad9bc7f31726053f7072da0..1231b4b6c3063c06c27b12f6ddce37928feba044 100644 (file)
@@ -20,8 +20,8 @@ package org.altusmetrum.micropeak;
 
 import java.util.*;
 import libaltosJNI.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class MicroUSB extends altos_device implements AltosDevice {
 
index f0c9cbb5631ffe0f1a32d46276b5a4548e4afed4..3f5c19735ed1ad88fb17fcc2d2be2aff39a55fd5 100644 (file)
@@ -23,6 +23,7 @@ ARMM3DIRS=\
        telemega-v1.0 telemega-v1.0/flash-loader \
        telemega-v2.0 telemega-v2.0/flash-loader \
        telemega-v3.0 telemega-v3.0/flash-loader \
+       telemega-v4.0 telemega-v4.0/flash-loader \
        telemetrum-v2.0 telemetrum-v2.0/flash-loader \
        telemetrum-v3.0 telemetrum-v3.0/flash-loader \
        telegps-v0.3 telegps-v0.3/flash-loader \
index e1af23a1a7c471e4c41238af1832188059b3b392..c3922b60651130a6dcccaef19bf302b0a755c787 100644 (file)
@@ -22,6 +22,8 @@
 
 static uint8_t ao_bmx160_configured;
 
+static struct ao_bmm150_trim ao_bmm150_trim;
+
 #define ao_bmx160_spi_get()    ao_spi_get(AO_BMX160_SPI_BUS, AO_SPI_SPEED_8MHz)
 #define ao_bmx160_spi_put()    ao_spi_put(AO_BMX160_SPI_BUS)
 
@@ -65,14 +67,14 @@ _ao_bmx160_reg_read(uint8_t addr)
 static void
 _ao_bmx160_cmd(uint8_t cmd)
 {
+       int i;
        _ao_bmx160_reg_write(BMX160_CMD, cmd);
-       ao_delay(AO_MS_TO_TICKS(100));
-}
-
-static void
-_ao_bmx160_mag_setup(void)
-{
-       _ao_bmx160_reg_write(BMX160_MAG_IF_0, 0x80);
+       for (i = 0; i < 50; i++) {
+               uint8_t cmd_read;
+               cmd_read = _ao_bmx160_reg_read(BMX160_CMD);
+               if (cmd_read != cmd)
+                       break;
+       }
 }
 
 static void
@@ -90,15 +92,262 @@ _ao_bmm150_reg_write(uint8_t addr, uint8_t data)
        _ao_bmm150_wait_manual();
 }
 
-#if BMX160_TEST
 static uint8_t
 _ao_bmm150_reg_read(uint8_t addr)
 {
        _ao_bmx160_reg_write(BMX160_MAG_IF_1, addr);
        _ao_bmm150_wait_manual();
-       return _ao_bmx160_reg_read(BMX160_DATA_0);
+       uint8_t ret = _ao_bmx160_reg_read(BMX160_DATA_0);
+       return ret;
+}
+
+static uint16_t
+_ao_bmm150_reg_read2(uint8_t lo_addr, uint8_t hi_addr)
+{
+       uint8_t lo = _ao_bmm150_reg_read(lo_addr);
+       uint8_t hi = _ao_bmm150_reg_read(hi_addr);
+
+       return ((uint16_t) hi << 8) | lo;
+}
+
+/*
+ * The compensate functions are taken from the BMM150 sample
+ * driver which has the following copyright:
+ *
+ * Copyright (c) 2020 Bosch Sensortec GmbH. All rights reserved.
+ *
+ * BSD-3-Clause
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @file bmm150.c
+ * @date 10/01/2020
+ * @version  1.0.3
+ *
+ */
+
+/*!
+ * @brief This internal API is used to obtain the compensated
+ * magnetometer X axis data(micro-tesla) in int16_t.
+ */
+static int16_t compensate_x(int16_t mag_data_x, uint16_t data_rhall)
+{
+    int16_t retval;
+    uint16_t process_comp_x0 = 0;
+    int32_t process_comp_x1;
+    uint16_t process_comp_x2;
+    int32_t process_comp_x3;
+    int32_t process_comp_x4;
+    int32_t process_comp_x5;
+    int32_t process_comp_x6;
+    int32_t process_comp_x7;
+    int32_t process_comp_x8;
+    int32_t process_comp_x9;
+    int32_t process_comp_x10;
+
+    /* Overflow condition check */
+    if (mag_data_x != BMM150_XYAXES_FLIP_OVERFLOW_ADCVAL)
+    {
+        if (data_rhall != 0)
+        {
+            /* Availability of valid data*/
+            process_comp_x0 = data_rhall;
+           //printf("using data_rhall %d\n", data_rhall);
+        }
+        else if (ao_bmm150_trim.dig_xyz1 != 0)
+        {
+            process_comp_x0 = ao_bmm150_trim.dig_xyz1;
+           //printf("using trim value %d\n", process_comp_x0);
+        }
+        else
+        {
+            process_comp_x0 = 0;
+           //printf("no valid rhall\n");
+        }
+        if (process_comp_x0 != 0)
+        {
+            /* Processing compensation equations*/
+            process_comp_x1 = ((int32_t)ao_bmm150_trim.dig_xyz1) * 16384;
+           //printf("comp_x1 %d\n", process_comp_x1);
+            process_comp_x2 = ((uint16_t)(process_comp_x1 / process_comp_x0)) - ((uint16_t)0x4000);
+           //printf("comp_x2 %d\n", process_comp_x2);
+            retval = ((int16_t)process_comp_x2);
+            process_comp_x3 = (((int32_t)retval) * ((int32_t)retval));
+           //printf("comp_x3 %d\n", process_comp_x3);
+            process_comp_x4 = (((int32_t)ao_bmm150_trim.dig_xy2) * (process_comp_x3 / 128));
+           //printf("comp_x4 %d\n", process_comp_x4);
+            process_comp_x5 = (int32_t)(((int16_t)ao_bmm150_trim.dig_xy1) * 128);
+           //printf("comp_x5 %d\n", process_comp_x5);
+            process_comp_x6 = ((int32_t)retval) * process_comp_x5;
+           //printf("comp_x6 %d\n", process_comp_x6);
+            process_comp_x7 = (((process_comp_x4 + process_comp_x6) / 512) + ((int32_t)0x100000));
+           //printf("comp_x7 %d\n", process_comp_x7);
+            process_comp_x8 = ((int32_t)(((int16_t)ao_bmm150_trim.dig_x2) + ((int16_t)0xA0)));
+           //printf("comp_x8 %d\n", process_comp_x8);
+            process_comp_x9 = ((process_comp_x7 * process_comp_x8) / 4096);
+           //printf("comp_x9 %d\n", process_comp_x9);
+            process_comp_x10 = ((int32_t)mag_data_x) * process_comp_x9;
+           //printf("comp_x10 %d\n", process_comp_x10);
+            retval = ((int16_t)(process_comp_x10 / 8192));
+           //printf("ret 1 %d\n", retval);
+            retval = (retval + (((int16_t)ao_bmm150_trim.dig_x1) * 8)) / 16;
+           //printf("final %d\n", retval);
+        }
+        else
+        {
+            retval = BMM150_OVERFLOW_OUTPUT;
+        }
+    }
+    else
+    {
+        /* Overflow condition */
+        retval = BMM150_OVERFLOW_OUTPUT;
+    }
+
+    return retval;
+}
+
+/*!
+ * @brief This internal API is used to obtain the compensated
+ * magnetometer Y axis data(micro-tesla) in int16_t.
+ */
+static int16_t compensate_y(int16_t mag_data_y, uint16_t data_rhall)
+{
+    int16_t retval;
+    uint16_t process_comp_y0 = 0;
+    int32_t process_comp_y1;
+    uint16_t process_comp_y2;
+    int32_t process_comp_y3;
+    int32_t process_comp_y4;
+    int32_t process_comp_y5;
+    int32_t process_comp_y6;
+    int32_t process_comp_y7;
+    int32_t process_comp_y8;
+    int32_t process_comp_y9;
+
+    /* Overflow condition check */
+    if (mag_data_y != BMM150_XYAXES_FLIP_OVERFLOW_ADCVAL)
+    {
+        if (data_rhall != 0)
+        {
+            /* Availability of valid data*/
+            process_comp_y0 = data_rhall;
+        }
+        else if (ao_bmm150_trim.dig_xyz1 != 0)
+        {
+            process_comp_y0 = ao_bmm150_trim.dig_xyz1;
+        }
+        else
+        {
+            process_comp_y0 = 0;
+        }
+        if (process_comp_y0 != 0)
+        {
+            /*Processing compensation equations*/
+            process_comp_y1 = (((int32_t)ao_bmm150_trim.dig_xyz1) * 16384) / process_comp_y0;
+            process_comp_y2 = ((uint16_t)process_comp_y1) - ((uint16_t)0x4000);
+            retval = ((int16_t)process_comp_y2);
+            process_comp_y3 = ((int32_t) retval) * ((int32_t)retval);
+            process_comp_y4 = ((int32_t)ao_bmm150_trim.dig_xy2) * (process_comp_y3 / 128);
+            process_comp_y5 = ((int32_t)(((int16_t)ao_bmm150_trim.dig_xy1) * 128));
+            process_comp_y6 = ((process_comp_y4 + (((int32_t)retval) * process_comp_y5)) / 512);
+            process_comp_y7 = ((int32_t)(((int16_t)ao_bmm150_trim.dig_y2) + ((int16_t)0xA0)));
+            process_comp_y8 = (((process_comp_y6 + ((int32_t)0x100000)) * process_comp_y7) / 4096);
+            process_comp_y9 = (((int32_t)mag_data_y) * process_comp_y8);
+            retval = (int16_t)(process_comp_y9 / 8192);
+            retval = (retval + (((int16_t)ao_bmm150_trim.dig_y1) * 8)) / 16;
+        }
+        else
+        {
+            retval = BMM150_OVERFLOW_OUTPUT;
+        }
+    }
+    else
+    {
+        /* Overflow condition*/
+        retval = BMM150_OVERFLOW_OUTPUT;
+    }
+
+    return retval;
+}
+
+/*!
+ * @brief This internal API is used to obtain the compensated
+ * magnetometer Z axis data(micro-tesla) in int16_t.
+ */
+static int16_t compensate_z(int16_t mag_data_z, uint16_t data_rhall)
+{
+    int32_t retval;
+    int16_t process_comp_z0;
+    int32_t process_comp_z1;
+    int32_t process_comp_z2;
+    int32_t process_comp_z3;
+    int16_t process_comp_z4;
+
+    if (mag_data_z != BMM150_ZAXIS_HALL_OVERFLOW_ADCVAL)
+    {
+        if ((ao_bmm150_trim.dig_z2 != 0) && (ao_bmm150_trim.dig_z1 != 0) && (data_rhall != 0) &&
+            (ao_bmm150_trim.dig_xyz1 != 0))
+        {
+            /*Processing compensation equations*/
+            process_comp_z0 = ((int16_t)data_rhall) - ((int16_t) ao_bmm150_trim.dig_xyz1);
+            process_comp_z1 = (((int32_t)ao_bmm150_trim.dig_z3) * ((int32_t)(process_comp_z0))) / 4;
+            process_comp_z2 = (((int32_t)(mag_data_z - ao_bmm150_trim.dig_z4)) * 32768);
+            process_comp_z3 = ((int32_t)ao_bmm150_trim.dig_z1) * (((int16_t)data_rhall) * 2);
+            process_comp_z4 = (int16_t)((process_comp_z3 + (32768)) / 65536);
+            retval = ((process_comp_z2 - process_comp_z1) / (ao_bmm150_trim.dig_z2 + process_comp_z4));
+
+            /* saturate result to +/- 2 micro-tesla */
+            if (retval > BMM150_POSITIVE_SATURATION_Z)
+            {
+                retval = BMM150_POSITIVE_SATURATION_Z;
+            }
+            else if (retval < BMM150_NEGATIVE_SATURATION_Z)
+            {
+                retval = BMM150_NEGATIVE_SATURATION_Z;
+            }
+
+            /* Conversion of LSB to micro-tesla*/
+            retval = retval / 16;
+        }
+        else
+        {
+            retval = BMM150_OVERFLOW_OUTPUT;
+        }
+    }
+    else
+    {
+        /* Overflow condition*/
+        retval = BMM150_OVERFLOW_OUTPUT;
+    }
+
+    return (int16_t)retval;
 }
-#endif
 
 static void
 _ao_bmx160_sample(struct ao_bmx160_sample *sample)
@@ -114,6 +363,10 @@ _ao_bmx160_sample(struct ao_bmx160_sample *sample)
                *d++ = (t >> 8) | (t << 8);
        }
 #endif
+       uint16_t rhall = sample->rhall >> 2;
+       sample->mag_x = compensate_x(sample->mag_x >> 3, rhall);
+       sample->mag_y = compensate_y(sample->mag_y >> 3, rhall);
+       sample->mag_z = compensate_z(sample->mag_z >> 1, rhall);
 }
 
 #define G      981     /* in cm/s² */
@@ -183,18 +436,55 @@ _ao_bmx160_wait_alive(void)
 static void
 _ao_bmx160_setup(void)
 {
+       int r;
+
        if (ao_bmx160_configured)
                return;
 
+       /* Dummy read of 0x7f register to enable SPI interface */
+       (void) _ao_bmx160_reg_read(0x7f);
+
        /* Make sure the chip is responding */
        _ao_bmx160_wait_alive();
 
-       /* Reboot */
-       _ao_bmx160_cmd(BMX160_CMD_SOFTRESET);
-
        /* Force SPI mode */
        _ao_bmx160_reg_write(BMX160_NV_CONF, 1 << BMX160_NV_CONF_SPI_EN);
 
+       /* Enable acc and gyr
+        */
+
+       _ao_bmx160_cmd(BMX160_CMD_ACC_SET_PMU_MODE(BMX160_PMU_STATUS_ACC_PMU_STATUS_NORMAL));
+
+       for (r = 0; r < 20; r++) {
+               ao_delay(AO_MS_TO_TICKS(100));
+               if (((_ao_bmx160_reg_read(BMX160_PMU_STATUS)
+                     >> BMX160_PMU_STATUS_ACC_PMU_STATUS)
+                    & BMX160_PMU_STATUS_ACC_PMU_STATUS_MASK)
+                   == BMX160_PMU_STATUS_ACC_PMU_STATUS_NORMAL)
+               {
+                       r = 0;
+                       break;
+               }
+       }
+       if (r != 0)
+               AO_SENSOR_ERROR(AO_DATA_BMX160);
+
+       _ao_bmx160_cmd(BMX160_CMD_GYR_SET_PMU_MODE(BMX160_PMU_STATUS_GYR_PMU_STATUS_NORMAL));
+
+       for (r = 0; r < 20; r++) {
+               ao_delay(AO_MS_TO_TICKS(100));
+               if (((_ao_bmx160_reg_read(BMX160_PMU_STATUS)
+                     >> BMX160_PMU_STATUS_GYR_PMU_STATUS)
+                    & BMX160_PMU_STATUS_GYR_PMU_STATUS_MASK)
+                   == BMX160_PMU_STATUS_GYR_PMU_STATUS_NORMAL)
+               {
+                       r = 0;
+                       break;
+               }
+       }
+       if (r != 0)
+               AO_SENSOR_ERROR(AO_DATA_BMX160);
+
        /* Configure accelerometer:
         *
         *      undersampling disabled
@@ -211,6 +501,9 @@ _ao_bmx160_setup(void)
        _ao_bmx160_reg_write(BMX160_ACC_RANGE,
                             BMX160_ACC_RANGE_16G);
 
+       for (r = 0x3; r <= 0x1b; r++)
+               (void) _ao_bmx160_reg_read(r);
+
        /* Configure gyro:
         *
         *      200Hz sampling rate
@@ -232,8 +525,14 @@ _ao_bmx160_setup(void)
         */
        _ao_bmx160_cmd(BMX160_CMD_MAG_IF_SET_PMU_MODE(BMX160_PMU_STATUS_MAG_IF_PMU_STATUS_NORMAL));
 
+       _ao_bmx160_reg_write(BMX160_IF_CONF,
+                            (BMX160_IF_CONF_IF_MODE_AUTO_MAG << BMX160_IF_CONF_IF_MODE));
+
        /* Enter setup mode */
-       _ao_bmx160_mag_setup();
+       _ao_bmx160_reg_write(BMX160_MAG_IF_0,
+                            (1 << BMX160_MAG_IF_0_MAG_MANUAL_EN) |
+                            (0 << BMX160_MAG_IF_0_MAG_OFFSET) |
+                            (0 << BMX160_MAG_IF_0_MAG_RD_BURST));
 
        /* Place in suspend mode to reboot the chip */
        _ao_bmm150_reg_write(BMM150_POWER_MODE,
@@ -258,29 +557,39 @@ _ao_bmx160_setup(void)
        _ao_bmm150_reg_write(BMM150_REPXY, BMM150_REPXY_VALUE(9));
        _ao_bmm150_reg_write(BMM150_REPZ, BMM150_REPZ_VALUE(15));
 
+       /* Read Trim values */
+       ao_bmm150_trim.dig_x1   = _ao_bmm150_reg_read(BMM150_DIG_X1);
+       ao_bmm150_trim.dig_y1   = _ao_bmm150_reg_read(BMM150_DIG_Y1);
+       ao_bmm150_trim.dig_z4   = _ao_bmm150_reg_read2(BMM150_DIG_Z4_LSB, BMM150_DIG_Z4_MSB);
+       ao_bmm150_trim.dig_x2   = _ao_bmm150_reg_read(BMM150_DIG_X2);
+       ao_bmm150_trim.dig_y2   = _ao_bmm150_reg_read(BMM150_DIG_Y2);
+       ao_bmm150_trim.dig_z2   = _ao_bmm150_reg_read2(BMM150_DIG_Z2_LSB, BMM150_DIG_Z2_MSB);
+       ao_bmm150_trim.dig_z1   = _ao_bmm150_reg_read2(BMM150_DIG_Z1_LSB, BMM150_DIG_Z1_MSB);
+       ao_bmm150_trim.dig_xyz1 = _ao_bmm150_reg_read2(BMM150_DIG_XYZ1_LSB, BMM150_DIG_XYZ1_MSB);
+       ao_bmm150_trim.dig_z3   = _ao_bmm150_reg_read2(BMM150_DIG_Z3_LSB, BMM150_DIG_Z3_MSB);
+       ao_bmm150_trim.dig_xy2  = _ao_bmm150_reg_read(BMM150_DIG_XY2);
+       ao_bmm150_trim.dig_xy1  = _ao_bmm150_reg_read(BMM150_DIG_XY1);
+
        /* To get data out of the magnetometer, set the control op mode to 'forced', then read
         * from the data registers
         */
-       _ao_bmx160_reg_write(BMX160_MAG_IF_3, (BMM150_CONTROL_OP_MODE_FORCED << BMM150_CONTROL_OP_MODE));
+       _ao_bmx160_reg_write(BMX160_MAG_IF_3,
+                            (BMM150_CONTROL_DATA_RATE_30 << BMM150_CONTROL_DATA_RATE) |
+                            (BMM150_CONTROL_OP_MODE_FORCED << BMM150_CONTROL_OP_MODE));
        _ao_bmx160_reg_write(BMX160_MAG_IF_2, BMM150_CONTROL);
        _ao_bmx160_reg_write(BMX160_MAG_IF_1, BMM150_DATA_X_0_4);
 
-       /* Set data rate to 200Hz */
-       _ao_bmx160_reg_write(BMX160_MAG_CONF,
-                            (BMX160_MAG_CONF_MAG_ODR_200 << BMX160_MAG_CONF_MAG_ODR));
-
        /* Put magnetometer interface back into 'normal mode'
         */
        _ao_bmx160_reg_write(BMX160_MAG_IF_0,
                             (0 << BMX160_MAG_IF_0_MAG_MANUAL_EN) |
                             (0 << BMX160_MAG_IF_0_MAG_OFFSET) |
-                            (0 << BMX160_MAG_IF_0_MAG_RD_BURST));
+                            (3 << BMX160_MAG_IF_0_MAG_RD_BURST));
 
-       /* Enable acc and gyr
-        */
+       /* Set data rate to 200Hz */
+       _ao_bmx160_reg_write(BMX160_MAG_CONF,
+                            (BMX160_MAG_CONF_MAG_ODR_200 << BMX160_MAG_CONF_MAG_ODR));
 
-       _ao_bmx160_cmd(BMX160_CMD_ACC_SET_PMU_MODE(BMX160_PMU_STATUS_ACC_PMU_STATUS_NORMAL));
-       _ao_bmx160_cmd(BMX160_CMD_GYR_SET_PMU_MODE(BMX160_PMU_STATUS_GYR_PMU_STATUS_NORMAL));
        ao_bmx160_configured = 1;
 }
 
@@ -408,10 +717,10 @@ static const struct ao_cmds ao_bmx160_cmds[] = {
 void
 ao_bmx160_init(void)
 {
-       ao_add_task(&ao_bmx160_task, ao_bmx160, "bmx160");
-
        ao_spi_init_cs(AO_BMX160_SPI_CS_PORT, (1 << AO_BMX160_SPI_CS_PIN));
 
+       ao_add_task(&ao_bmx160_task, ao_bmx160, "bmx160");
+
        /* Pretend to be the bmx160 task. Grab the SPI bus right away and
         * hold it for the task so that nothing else uses the SPI bus before
         * we get the I2C mode disabled in the chip
@@ -420,5 +729,6 @@ ao_bmx160_init(void)
        ao_cur_task = &ao_bmx160_task;
        ao_bmx160_spi_get();
        ao_cur_task = NULL;
+
        ao_cmd_register(&ao_bmx160_cmds[0]);
 }
index 2b7e7bd768c27caaf51e88af3372a3688024d4ea..9fc3334177b1208ad82f9e256f801fdf87177b32 100644 (file)
@@ -25,7 +25,7 @@ struct ao_bmx160_sample {
        int16_t         mag_x;
        int16_t         mag_y;
        int16_t         mag_z;
-       int16_t         rhall;
+       uint16_t        rhall;
        int16_t         gyr_x;
        int16_t         gyr_y;
        int16_t         gyr_z;
@@ -46,6 +46,20 @@ struct ao_bmx160_offset {
        uint8_t         offset_6;
 };
 
+struct ao_bmm150_trim {
+       int8_t          dig_x1;
+       int8_t          dig_y1;
+       int8_t          dig_x2;
+       int8_t          dig_y2;
+       uint16_t        dig_z1;
+       int16_t         dig_z2;
+       int16_t         dig_z3;
+       int16_t         dig_z4;
+       uint8_t         dig_xy1;
+       int8_t          dig_xy2;
+       uint16_t        dig_xyz1;
+};
+
 void
 ao_bmx160_init(void);
 
@@ -61,10 +75,12 @@ ao_bmx160_init(void);
 #define   BMX160_PMU_STATUS_GYR_PMU_STATUS_SUSPEND             0
 #define   BMX160_PMU_STATUS_GYR_PMU_STATUS_NORMAL              1
 #define   BMX160_PMU_STATUS_GYR_PMU_STATUS_FAST_START_UP       3
+#define   BMX160_PMU_STATUS_GYR_PMU_STATUS_MASK                        3
 #define  BMX160_PMU_STATUS_ACC_PMU_STATUS      4
 #define   BMX160_PMU_STATUS_ACC_PMU_STATUS_SUSPEND             0
 #define   BMX160_PMU_STATUS_ACC_PMU_STATUS_NORMAL              1
 #define   BMX160_PMU_STATUS_ACC_PMU_STATUS_LOW_POWER           2
+#define   BMX160_PMU_STATUS_ACC_PMU_STATUS_MASK                        3
 #define BMX160_DATA_0                  0x04
 #define BMX160_MAG_X_0_7               0x04
 #define BMX160_MAG_X_8_15              0x05
@@ -130,8 +146,6 @@ ao_bmx160_init(void);
 #define  BMX160_ACC_RANGE_4G                   0x5
 #define  BMX160_ACC_RANGE_8G                   0x8
 #define  BMX160_ACC_RANGE_16G                  0xc
-#define  BMX160_ACC_RANGE_
-#define  BMX160_ACC_RANGE_
 #define BMX160_GYR_CONF                        0x42
 #define  BMX160_GYR_CONF_GYR_ODR               0
 #define   BMX160_GYR_CONF_GYR_ODR_25                   0x6
@@ -188,6 +202,8 @@ ao_bmx160_init(void);
 #define BMX160_FOC_CONF                        0x69
 #define BMX160_CONF                    0x6A
 #define BMX160_IF_CONF                 0x6B
+#define  BMX160_IF_CONF_IF_MODE                        4
+#define  BMX160_IF_CONF_IF_MODE_AUTO_MAG               0x02
 #define BMX160_PMU_TRIGGER             0x6C
 #define BMX160_SELF_TEST               0x6D
 #define BMX160_NV_CONF                 0x70
@@ -252,6 +268,30 @@ ao_bmx160_init(void);
 #define BMM150_REPZ                            0x52
 #define  BMM150_REPZ_VALUE(n)                          ((n) -1)
 
+/* Trim Extended Registers */
+#define BMM150_DIG_X1                        0x5D
+#define BMM150_DIG_Y1                        0x5E
+#define BMM150_DIG_Z4_LSB                    0x62
+#define BMM150_DIG_Z4_MSB                    0x63
+#define BMM150_DIG_X2                        0x64
+#define BMM150_DIG_Y2                        0x65
+#define BMM150_DIG_Z2_LSB                    0x68
+#define BMM150_DIG_Z2_MSB                    0x69
+#define BMM150_DIG_Z1_LSB                    0x6A
+#define BMM150_DIG_Z1_MSB                    0x6B
+#define BMM150_DIG_XYZ1_LSB                  0x6C
+#define BMM150_DIG_XYZ1_MSB                  0x6D
+#define BMM150_DIG_Z3_LSB                    0x6E
+#define BMM150_DIG_Z3_MSB                    0x6F
+#define BMM150_DIG_XY2                       0x70
+#define BMM150_DIG_XY1                       0x71
+
+#define BMM150_XYAXES_FLIP_OVERFLOW_ADCVAL   -4096
+#define BMM150_ZAXIS_HALL_OVERFLOW_ADCVAL    -16384
+#define BMM150_OVERFLOW_OUTPUT               -32768
+#define BMM150_NEGATIVE_SATURATION_Z         -32767
+#define BMM150_POSITIVE_SATURATION_Z         32767
+
 #define BMX160_GYRO_FULLSCALE  ((float) 2000 * M_PI/180.0)
 
 static inline float
index 71599fbd6665b11d7e1ec184b2f2477622a68a32..b7ff0b9edb4d383da76e414ae1b67baccc0bd1dc 100644 (file)
@@ -32,7 +32,7 @@
 int8_t                 ao_btm_stdio;
 uint8_t                ao_btm_connected;
 
-#define BT_DEBUG 1
+#define BT_DEBUG 0
 
 #if BT_DEBUG
 char           ao_btm_buffer[256];
index b314ef7c0273acf55f8ab277ed927bc05917c363..0d7e4cba2debfca344168ccad24065cb4a94cbb1 100644 (file)
@@ -37,7 +37,7 @@
 #define AO_LCO_BOX_DRAG                0x1000
 
 /* UI values */
-static uint16_t        ao_lco_fire_tick;
+static AO_TICK_TYPE    ao_lco_fire_tick;
 static uint8_t ao_lco_fire_down;
 
 static uint8_t ao_lco_display_mutex;
@@ -124,10 +124,10 @@ ao_lco_box_present(uint16_t box)
 static struct ao_task  ao_lco_drag_task;
 static uint8_t         ao_lco_drag_active;
 
-static uint16_t
-ao_lco_drag_button_check(uint16_t now, uint16_t delay)
+static AO_TICK_TYPE
+ao_lco_drag_button_check(AO_TICK_TYPE now, AO_TICK_TYPE delay)
 {
-       uint16_t        button_delay = ~0;
+       AO_TICK_TYPE    button_delay = ~0;
 
        /*
         * Check to see if the button has been held down long enough
@@ -135,14 +135,14 @@ ao_lco_drag_button_check(uint16_t now, uint16_t delay)
         */
        if (ao_lco_fire_down) {
                if (ao_lco_drag_race) {
-                       if ((int16_t) (now - ao_lco_fire_tick) >= AO_LCO_DRAG_RACE_STOP_TIME) {
+                       if ((AO_TICK_SIGNED) (now - ao_lco_fire_tick) >= AO_LCO_DRAG_RACE_STOP_TIME) {
                                ao_lco_drag_disable();
                                ao_lco_fire_down = 0;
                        }
                        else
                                button_delay = ao_lco_fire_tick + AO_LCO_DRAG_RACE_STOP_TIME - now;
                } else {
-                       if ((int16_t) (now - ao_lco_fire_tick) >= AO_LCO_DRAG_RACE_START_TIME) {
+                       if ((AO_TICK_SIGNED) (now - ao_lco_fire_tick) >= AO_LCO_DRAG_RACE_START_TIME) {
                                ao_lco_drag_enable();
                                ao_lco_fire_down = 0;
                        }
@@ -158,14 +158,14 @@ ao_lco_drag_button_check(uint16_t now, uint16_t delay)
 static void
 ao_lco_drag_monitor(void)
 {
-       uint16_t        delay = ~0;
-       uint16_t        now;
+       AO_TICK_TYPE    delay = ~0;
+       AO_TICK_TYPE    now;
 
        ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
        for (;;) {
                PRINTD("Drag monitor count %d active %d delay %d\n",
                       ao_lco_drag_beep_count, ao_lco_drag_active, delay);
-               if (delay == (uint16_t) ~0)
+               if (delay == (AO_TICK_TYPE) ~0)
                        ao_sleep(&ao_lco_drag_beep_count);
                else
                        ao_sleep_for(&ao_lco_drag_beep_count, delay);
index cdc19d3d76837a7d7627d5dd250eb431005733cf..3b123793d7ff4d8327e4d837e2ee8dddc7df1867 100644 (file)
@@ -107,12 +107,12 @@ void
 ao_lco_drag_disable(void);
 
 /* Handle drag beeps, return new delay */
-uint16_t
-ao_lco_drag_beep_check(uint16_t now, uint16_t delay);
+AO_TICK_TYPE
+ao_lco_drag_beep_check(AO_TICK_TYPE now, AO_TICK_TYPE delay);
 
 /* Check if it's time to beep during drag race. Return new delay */
-uint16_t
-ao_lco_drag_warn_check(uint16_t now, uint16_t delay);
+AO_TICK_TYPE
+ao_lco_drag_warn_check(AO_TICK_TYPE now, AO_TICK_TYPE delay);
 
 /* Request 'beeps' additional drag race beeps */
 void
index 6e50e44db4f8bec93edf71a42ab72a8f940f64c2..bc54dc22b8ab9992d4b8b2a0419fc9774a62e228 100644 (file)
@@ -33,7 +33,7 @@ uint8_t               ao_lco_drag_race;
 struct ao_pad_query    ao_pad_query;                           /* latest query response */
 
 static uint8_t         ao_lco_channels[AO_PAD_MAX_BOXES];      /* pad channels available on each box */
-static uint16_t                ao_lco_tick_offset[AO_PAD_MAX_BOXES];   /* offset from local to remote tick count */
+static uint16_t                ao_lco_tick_offset[AO_PAD_MAX_BOXES];   /* 16 bit offset from local to remote tick count */
 static uint8_t         ao_lco_selected[AO_PAD_MAX_BOXES];      /* pads selected to fire */
 
 #define AO_LCO_VALID_LAST      1
@@ -322,7 +322,7 @@ ao_lco_search(void)
 void
 ao_lco_monitor(void)
 {
-       uint16_t                delay;
+       AO_TICK_TYPE            delay;
        uint8_t                 box;
 
        for (;;) {
@@ -358,8 +358,8 @@ ao_lco_monitor(void)
 
 uint8_t                        ao_lco_drag_beep_count;
 static uint8_t         ao_lco_drag_beep_on;
-static uint16_t                ao_lco_drag_beep_time;
-static uint16_t                ao_lco_drag_warn_time;
+static AO_TICK_TYPE    ao_lco_drag_beep_time;
+static AO_TICK_TYPE    ao_lco_drag_warn_time;
 
 #define AO_LCO_DRAG_BEEP_TIME  AO_MS_TO_TICKS(50)
 #define AO_LCO_DRAG_WARN_TIME  AO_SEC_TO_TICKS(5)
@@ -391,14 +391,14 @@ ao_lco_toggle_drag(void)
  * turn it on or off as necessary and bump the remaining beep counts
  */
 
-uint16_t
-ao_lco_drag_beep_check(uint16_t now, uint16_t delay)
+AO_TICK_TYPE
+ao_lco_drag_beep_check(AO_TICK_TYPE now, AO_TICK_TYPE delay)
 {
        PRINTD("beep check count %d delta %d\n",
               ao_lco_drag_beep_count,
-              (int16_t) (now - ao_lco_drag_beep_time));
+              (AO_TICK_SIGNED) (now - ao_lco_drag_beep_time));
        if (ao_lco_drag_beep_count) {
-               if ((int16_t) (now - ao_lco_drag_beep_time) >= 0) {
+               if ((AO_TICK_SIGNED) (now - ao_lco_drag_beep_time) >= 0) {
                        if (ao_lco_drag_beep_on) {
                                ao_beep(0);
                                PRINTD("beep stop\n");
@@ -418,7 +418,7 @@ ao_lco_drag_beep_check(uint16_t now, uint16_t delay)
        }
 
        if (ao_lco_drag_beep_count) {
-               uint16_t beep_delay = 0;
+               AO_TICK_TYPE beep_delay = 0;
 
                if (ao_lco_drag_beep_time > now)
                        beep_delay = ao_lco_drag_beep_time - now;
@@ -463,13 +463,13 @@ ao_lco_drag_disable(void)
  * active
  */
 
-uint16_t
-ao_lco_drag_warn_check(uint16_t now, uint16_t delay)
+AO_TICK_TYPE
+ao_lco_drag_warn_check(AO_TICK_TYPE now, AO_TICK_TYPE delay)
 {
        if (ao_lco_drag_race) {
-               uint16_t        warn_delay;
+               AO_TICK_TYPE    warn_delay;
 
-               if ((int16_t) (now - ao_lco_drag_warn_time) >= 0) {
+               if ((AO_TICK_SIGNED) (now - ao_lco_drag_warn_time) >= 0) {
                        ao_lco_drag_add_beeps(1);
                        ao_lco_drag_warn_time = now + AO_LCO_DRAG_WARN_TIME;
                }
index 6f195e550cfc909063984a0115a9163807038da5..0184363533390736f2e831f829285e8a83e6e676 100644 (file)
@@ -28,7 +28,6 @@
 
 static uint16_t        lco_box;
 static uint8_t lco_channels;
-static uint16_t        tick_offset;
 
 static void
 lco_args(void) 
index 06350694145d4bda978ac894eb2a011160543ada..1960683fa6b214a56cd7fd87800cd1a7c6e7562d 100644 (file)
@@ -28,8 +28,8 @@ int8_t
 ao_lco_query(uint16_t box, struct ao_pad_query *query, uint16_t *tick_offset)
 {
        int8_t          r;
-       uint16_t        sent_time;
-       uint16_t        timeout = AO_MS_TO_TICKS(10);
+       AO_TICK_TYPE    sent_time;
+       AO_TICK_TYPE    timeout = AO_MS_TO_TICKS(10);
 
 #if HAS_RADIO_RATE
        switch (ao_config.radio_rate) {
@@ -62,7 +62,7 @@ void
 ao_lco_arm(uint16_t box, uint8_t channels, uint16_t tick_offset)
 {
        ao_mutex_get(&ao_lco_mutex);
-       command.tick = ao_time() - tick_offset;
+       command.tick = (uint16_t) ao_time() - tick_offset;
        command.box = box;
        command.cmd = AO_PAD_ARM;
        command.channels = channels;
index 2592a084261bec25640f0820dfc018c579f44486..07c49afc6b890a4094a842360223eddc52eef715 100644 (file)
@@ -26,10 +26,10 @@ static uint8_t ao_pad_ignite;
 static struct ao_pad_command   command;
 static struct ao_pad_query     query;
 static uint8_t ao_pad_armed;
-static uint16_t        ao_pad_arm_time;
+static AO_TICK_TYPE    ao_pad_arm_time;
 static uint8_t ao_pad_box;
 static uint8_t ao_pad_disabled;
-static uint16_t        ao_pad_packet_time;
+static AO_TICK_TYPE    ao_pad_packet_time;
 
 #ifndef AO_PAD_RSSI_MINIMUM
 #define AO_PAD_RSSI_MINIMUM    -90
@@ -288,7 +288,7 @@ ao_pad_monitor(void)
                        prev = cur;
                }
 
-               if (ao_pad_armed && (int16_t) (ao_time() - ao_pad_arm_time) > AO_PAD_ARM_TIME)
+               if (ao_pad_armed && (AO_TICK_SIGNED) (ao_time() - ao_pad_arm_time) > AO_PAD_ARM_TIME)
                        ao_pad_armed = 0;
 
                if (ao_pad_armed) {
@@ -369,7 +369,7 @@ static int ao_pad_read_box(void) {
 static void
 ao_pad(void)
 {
-       int16_t time_difference;
+       int16_t tick_difference;
        int8_t  ret;
 
        ao_pad_box = 0;
@@ -398,12 +398,12 @@ ao_pad(void)
                        if (command.channels & ~(AO_PAD_ALL_CHANNELS))
                                break;
 
-                       time_difference = command.tick - ao_time();
-                       PRINTD ("arm tick %d local tick %d\n", command.tick, ao_time());
-                       if (time_difference < 0)
-                               time_difference = -time_difference;
-                       if (time_difference > 10) {
-                               PRINTD ("time difference too large %d\n", time_difference);
+                       tick_difference = command.tick - (uint16_t) ao_time();
+                       PRINTD ("arm tick %d local tick %d\n", command.tick, (uint16_t) ao_time());
+                       if (tick_difference < 0)
+                               tick_difference = -tick_difference;
+                       if (tick_difference > 10) {
+                               PRINTD ("tick difference too large %d\n", tick_difference);
                                break;
                        }
                        if (query.arm_status != AO_PAD_ARM_STATUS_ARMED) {
@@ -439,7 +439,7 @@ ao_pad(void)
                                PRINTD ("not armed\n");
                                break;
                        }
-                       if ((uint16_t) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
+                       if ((AO_TICK_SIGNED) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
                                PRINTD ("late pad arm_time %d time %d\n",
                                        ao_pad_arm_time, ao_time());
                                break;
@@ -457,7 +457,7 @@ ao_pad(void)
 #if HAS_LOG
                        if (!ao_log_running) ao_log_start();
 #endif
-                       if ((uint16_t) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
+                       if ((AO_TICK_SIGNED) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
                                PRINTD ("late pad arm_time %d time %d\n",
                                        ao_pad_arm_time, ao_time());
                                break;
index 0977cf657fffc8bbd9b72f2f78e72d72dcba6130..c11aac1ed2462b2e933751ec1afd79931b1a96e8 100644 (file)
@@ -22,7 +22,8 @@
 void
 ao_boot_chain(uint32_t *base);
 
-void
+/* Return true to switch to application */
+int
 ao_boot_check_pin(void);
 
 /* Return true to switch to application (if present) */
index a7e58762c0a58dafd11409cb6ed687816e236404..988ac4897ecafbb8798ce1e1b5ceb2bf09368144 100644 (file)
@@ -448,8 +448,8 @@ static inline float ao_convert_accel(int16_t sensor)
 typedef int16_t        gyro_t;         /* in raw sample units */
 typedef int16_t angle_t;       /* in degrees */
 
-/* Y axis is aligned with the direction of motion (along) */
-/* X axis is aligned in the other board axis (across) */
+/* X axis is aligned with the direction of motion (along) */
+/* Y axis is aligned in the other board axis (across) */
 /* Z axis is aligned perpendicular to the board (through) */
 
 static inline float ao_convert_gyro(float sensor)
@@ -523,6 +523,9 @@ ao_data_fill(int head) {
 #endif
 #if HAS_ADS131A0X
                ao_data_ring[head].ads131a0x = ao_ads131a0x_current;
+#endif
+#if HAS_BMX160
+               ao_data_ring[head].bmx160 = ao_bmx160_current;
 #endif
                ao_data_ring[head].tick = ao_tick_count;
                ao_data_head = ao_data_ring_next(head);
index 97bfdc3273076cf0ab80272fb6e4fee88e31c156..1c0ba4e3cf8c766049e42b44aa2478b8160c6e35 100644 (file)
@@ -58,6 +58,7 @@ extern enum ao_flight_state ao_log_state;
 #define AO_LOG_FORMAT_EASYMEGA_2       16      /* 32 byte typed telemega records with 32 bit gyro cal, mpu9250 rotated 90° and adxl375 */
 #define AO_LOG_FORMAT_TELESTATIC       17      /* 32 byte typed telestatic records */
 #define AO_LOG_FORMAT_MICROPEAK2       18      /* 2-byte baro values with header */
+#define AO_LOG_FORMAT_TELEMEGA_4       19      /* 32 byte typed telemega records with 32 bit gyro cal and Bmx160 */
 #define AO_LOG_FORMAT_NONE             127     /* No log at all */
 
 /* Return the flight number from the given log slot, 0 if none, -slot on failure */
@@ -504,7 +505,7 @@ struct ao_log_gps {
        } u;
 };
 
-#if AO_LOG_FORMAT == AO_LOG_FOMAT_TELEMEGA_OLD || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_3 || AO_LOG_FORMAT == AO_LOG_FORMAT_EASYMEGA_2
+#if AO_LOG_FORMAT == AO_LOG_FOMAT_TELEMEGA_OLD || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_3 || AO_LOG_FORMAT == AO_LOG_FORMAT_EASYMEGA_2 || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_4
 typedef struct ao_log_mega ao_log_type;
 #endif
 
index 341ff715b790426146362c147113141665f09da6..85d2aa5c0ec80e2453d6b391f72f37527b21039e 100644 (file)
@@ -104,6 +104,17 @@ ao_log(void)
                                ao_log_data.u.sensor.mag_x = ao_data_ring[ao_log_data_pos].mpu9250.mag_x;
                                ao_log_data.u.sensor.mag_z = ao_data_ring[ao_log_data_pos].mpu9250.mag_z;
                                ao_log_data.u.sensor.mag_y = ao_data_ring[ao_log_data_pos].mpu9250.mag_y;
+#endif
+#if HAS_BMX160
+                               ao_log_data.u.sensor.accel_x = ao_data_ring[ao_log_data_pos].bmx160.acc_x;
+                               ao_log_data.u.sensor.accel_y = ao_data_ring[ao_log_data_pos].bmx160.acc_y;
+                               ao_log_data.u.sensor.accel_z = ao_data_ring[ao_log_data_pos].bmx160.acc_z;
+                               ao_log_data.u.sensor.gyro_x = ao_data_ring[ao_log_data_pos].bmx160.gyr_x;
+                               ao_log_data.u.sensor.gyro_y = ao_data_ring[ao_log_data_pos].bmx160.gyr_y;
+                               ao_log_data.u.sensor.gyro_z = ao_data_ring[ao_log_data_pos].bmx160.gyr_z;
+                               ao_log_data.u.sensor.mag_x = ao_data_ring[ao_log_data_pos].bmx160.mag_x;
+                               ao_log_data.u.sensor.mag_z = ao_data_ring[ao_log_data_pos].bmx160.mag_z;
+                               ao_log_data.u.sensor.mag_y = ao_data_ring[ao_log_data_pos].bmx160.mag_y;
 #endif
                                ao_log_data.u.sensor.accel = ao_data_accel(&ao_data_ring[ao_log_data_pos]);
                                ao_log_write(&ao_log_data);
index 2aceaf283c893fa49b10a4c2228ada1eb229c626..2092c84f403cd65606eeb78078a3d64d7f689ab6 100644 (file)
@@ -139,9 +139,17 @@ ao_send_mega_sensor(void)
                struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
 
        telemetry.generic.tick = packet->tick;
-       telemetry.generic.type = AO_TELEMETRY_MEGA_SENSOR;
-
+#if HAS_BMX160
+       telemetry.generic.type = AO_TELEMETRY_MEGA_SENSOR_BMX160;
+#else
 #if HAS_MPU6000 || HAS_MPU9250
+       telemetry.generic.type = AO_TELEMETRY_MEGA_SENSOR_MPU;
+#else
+#error unknown IMU
+#endif
+#endif
+
+#if HAS_GYRO
        telemetry.mega_sensor.orient = ao_sample_orient;
 #endif
        telemetry.mega_sensor.accel = ao_data_accel(packet);
@@ -178,6 +186,20 @@ ao_send_mega_sensor(void)
        telemetry.mega_sensor.mag_y = packet->mpu9250.mag_y;
 #endif
 
+#if HAS_BMX160
+       telemetry.mega_sensor.accel_x = packet->bmx160.acc_x;
+       telemetry.mega_sensor.accel_y = packet->bmx160.acc_y;
+       telemetry.mega_sensor.accel_z = packet->bmx160.acc_z;
+
+       telemetry.mega_sensor.gyro_x = packet->bmx160.gyr_x;
+       telemetry.mega_sensor.gyro_y = packet->bmx160.gyr_y;
+       telemetry.mega_sensor.gyro_z = packet->bmx160.gyr_z;
+
+       telemetry.mega_sensor.mag_x = packet->bmx160.mag_x;
+       telemetry.mega_sensor.mag_z = packet->bmx160.mag_z;
+       telemetry.mega_sensor.mag_y = packet->bmx160.mag_y;
+#endif
+
        ao_telemetry_send();
 }
 
index 23e3ed7db7c4a5309f4b76bc7d5db6da424a0a86..c7aebe599a317d86de65b5d8675f4694ea43cca8 100644 (file)
@@ -176,7 +176,8 @@ struct ao_telemetry_companion {
        /* 32 */
 };
 
-#define AO_TELEMETRY_MEGA_SENSOR       0x08
+#define AO_TELEMETRY_MEGA_SENSOR_MPU           0x08    /* Invensense IMU */
+#define AO_TELEMETRY_MEGA_SENSOR_BMX160                0x12    /* BMX160 IMU */
 
 struct ao_telemetry_mega_sensor {
        uint16_t        serial;         /*  0 */
index a51c7f8d45414d59eb9a47b47adeb54714ebefdd..91acbfd492bc29cddc2cbca1cccc0c27c81784db 100644 (file)
 #include <ao_boot.h>
 #include <ao_exti.h>
 
-void
+int
 ao_boot_check_pin(void)
 {
        uint16_t v;
 
-       /* Enable power interface clock */
-//     stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_PWREN);
-       
        /* Enable the input pin */
        ao_enable_input(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN,
                        AO_BOOT_APPLICATION_MODE);
@@ -41,7 +38,5 @@ ao_boot_check_pin(void)
        /* Reset the chip to turn off the port and the power interface clock */
        ao_gpio_set_mode(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, 0);
        ao_disable_port(AO_BOOT_APPLICATION_GPIO);
-//     stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_PWREN);
-       if (v == AO_BOOT_APPLICATION_VALUE)
-               ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+       return v == AO_BOOT_APPLICATION_VALUE;
 }
index 8d71f43f2de38c1f0216d17d18d14b02e82e9559..a479ec6d59585835c508e6e2cff7ce8db47e0c13 100644 (file)
@@ -53,8 +53,11 @@ void start(void) {
 #ifdef AO_BOOT_CHAIN
        if (ao_boot_check_chain()) {
 #ifdef AO_BOOT_PIN
-               ao_boot_check_pin();
+               if (ao_boot_check_pin())
 #endif
+               {
+                       ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+               }
        }
 #endif
 #if RELOCATE_INTERRUPT
index 4b5dc2ac480341086e4264284b9345d2e5da299c..f21ce1b251ff5931d5609ebb1926b6d2d68966ed 100644 (file)
@@ -20,7 +20,7 @@
 #include <ao_boot.h>
 #include <ao_exti.h>
 
-void
+int
 ao_boot_check_pin(void)
 {
        uint16_t v;
@@ -42,6 +42,5 @@ ao_boot_check_pin(void)
        ao_gpio_set_mode(&AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, 0);
        ao_disable_port(&AO_BOOT_APPLICATION_GPIO);
        stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_PWREN);
-       if (v == AO_BOOT_APPLICATION_VALUE)
-               ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+       return v == AO_BOOT_APPLICATION_VALUE;
 }
index d8be36670baf608726adfa910b9aa70e4b31d5ed..1d563532b755cf7f1144400803ef0a034536febb 100644 (file)
@@ -77,8 +77,11 @@ void start(void)
 #ifdef AO_BOOT_CHAIN
        if (ao_boot_check_chain()) {
 #ifdef AO_BOOT_PIN
-               ao_boot_check_pin();
+               if (ao_boot_check_pin())
 #endif
+               {
+                       ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+               }
        }
 #endif
        /* Set interrupt vector table offset */
index 4b5dc2ac480341086e4264284b9345d2e5da299c..f21ce1b251ff5931d5609ebb1926b6d2d68966ed 100644 (file)
@@ -20,7 +20,7 @@
 #include <ao_boot.h>
 #include <ao_exti.h>
 
-void
+int
 ao_boot_check_pin(void)
 {
        uint16_t v;
@@ -42,6 +42,5 @@ ao_boot_check_pin(void)
        ao_gpio_set_mode(&AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, 0);
        ao_disable_port(&AO_BOOT_APPLICATION_GPIO);
        stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_PWREN);
-       if (v == AO_BOOT_APPLICATION_VALUE)
-               ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+       return v == AO_BOOT_APPLICATION_VALUE;
 }
index 0025de47153445bbf6d5df961c54726dab0d4c23..1ee6e720091be2e277fca3b26536fd559caea35d 100644 (file)
@@ -72,8 +72,11 @@ void start(void)
 #if AO_BOOT_CHAIN
        if (ao_boot_check_chain()) {
 #if AO_BOOT_PIN
-               ao_boot_check_pin();
+               if (ao_boot_check_pin())
 #endif
+               {
+                       ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+               }
        }
 #endif
        /* Turn on syscfg */
index 904dea0fe501f039e685366ae4b1d4664b916576..1238d72f01dae3316ab352d00d47ad558fe12fce 100644 (file)
@@ -151,13 +151,13 @@ static struct ao_task     ao_lco_drag_task;
 static void
 ao_lco_drag_monitor(void)
 {
-       uint16_t        delay = ~0;
-       uint16_t        now;
+       AO_TICK_TYPE    delay = ~0;
+       AO_TICK_TYPE    now;
 
        ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
        for (;;) {
                PRINTD("Drag monitor count %d delay %d\n", ao_lco_drag_beep_count, delay);
-               if (delay == (uint16_t) ~0)
+               if (delay == (AO_TICK_TYPE) ~0)
                        ao_sleep(&ao_lco_drag_beep_count);
                else
                        ao_sleep_for(&ao_lco_drag_beep_count, delay);
diff --git a/src/telemega-v4.0/.gitignore b/src/telemega-v4.0/.gitignore
new file mode 100644 (file)
index 0000000..e67759a
--- /dev/null
@@ -0,0 +1,2 @@
+ao_product.h
+telemega-*.elf
diff --git a/src/telemega-v4.0/Makefile b/src/telemega-v4.0/Makefile
new file mode 100644 (file)
index 0000000..373a497
--- /dev/null
@@ -0,0 +1,128 @@
+#
+# AltOS build
+#
+#
+
+include ../stm/Makefile.defs
+
+INC = \
+       ao.h \
+       ao_arch.h \
+       ao_arch_funcs.h \
+       ao_boot.h \
+       ao_companion.h \
+       ao_data.h \
+       ao_sample.h \
+       ao_pins.h \
+       altitude-pa.h \
+       ao_kalman.h \
+       ao_product.h \
+       ao_ms5607.h \
+       ao_mpu9250.h \
+       ao_mma655x.h \
+       ao_cc1200_CC1200.h \
+       ao_profile.h \
+       ao_task.h \
+       ao_whiten.h \
+       ao_sample_profile.h \
+       ao_quaternion.h \
+       ao_mpu.h \
+       stm32l.h \
+       ao_ms5607_convert.c \
+       Makefile
+
+#
+# Common AltOS sources
+#
+
+#PROFILE=ao_profile.c
+#PROFILE_DEF=-DAO_PROFILE=1
+
+#SAMPLE_PROFILE=ao_sample_profile.c \
+#      ao_sample_profile_timer.c
+#SAMPLE_PROFILE_DEF=-DHAS_SAMPLE_PROFILE=1
+
+#STACK_GUARD=ao_mpu_stm.c
+#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1
+
+ALTOS_SRC = \
+       ao_boot_chain.c \
+       ao_interrupt.c \
+       ao_product.c \
+       ao_romconfig.c \
+       ao_cmd.c \
+       ao_config.c \
+       ao_task.c \
+       ao_led_stm.c \
+       ao_stdio.c \
+       ao_panic.c \
+       ao_timer.c \
+       ao_mutex.c \
+       ao_serial_stm.c \
+       ao_gps_ublox.c \
+       ao_gps_show.c \
+       ao_gps_report_mega.c \
+       ao_ignite.c \
+       ao_freq.c \
+       ao_dma_stm.c \
+       ao_spi_stm.c \
+       ao_cc1200.c \
+       ao_data.c \
+       ao_ms5607.c \
+       ao_adxl375.c \
+       ao_adc_stm.c \
+       ao_beep_stm.c \
+       ao_eeprom_stm.c \
+       ao_storage.c \
+       ao_m25.c \
+       ao_usb_stm.c \
+       ao_exti_stm.c \
+       ao_report.c \
+       ao_bmx160.c \
+       ao_convert_pa.c \
+       ao_convert_volt.c \
+       ao_log.c \
+       ao_log_mega.c \
+       ao_sample.c \
+       ao_kalman.c \
+       ao_flight.c \
+       ao_telemetry.c \
+       ao_packet_slave.c \
+       ao_packet.c \
+       ao_companion.c \
+       ao_pyro.c \
+       ao_aprs.c \
+       ao_pwm_stm.c \
+       $(PROFILE) \
+       $(SAMPLE_PROFILE) \
+       $(STACK_GUARD)
+
+PRODUCT=TeleMega-v4.0
+PRODUCT_DEF=-DTELEMEGA
+IDPRODUCT=0x0023
+
+CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF)
+
+PROGNAME=telemega-v4.0
+PROG=$(PROGNAME)-$(VERSION).elf
+HEX=$(PROGNAME)-$(VERSION).ihx
+
+SRC=$(ALTOS_SRC) ao_telemega.c
+OBJ=$(SRC:.c=.o)
+
+all: $(PROG) $(HEX)
+
+$(PROG): Makefile $(OBJ) altos.ld
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
+
+$(OBJ): $(INC)
+
+distclean:     clean
+
+clean:
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f ao_product.h
+
+install:
+
+uninstall:
diff --git a/src/telemega-v4.0/ao_pins.h b/src/telemega-v4.0/ao_pins.h
new file mode 100644 (file)
index 0000000..84af615
--- /dev/null
@@ -0,0 +1,411 @@
+/*
+ * Copyright © 2017 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+#define HAS_TASK_QUEUE         1
+
+/* 8MHz High speed external crystal */
+#define AO_HSE                 8000000
+
+/* PLLVCO = 96MHz (so that USB will work) */
+#define AO_PLLMUL              12
+#define AO_RCC_CFGR_PLLMUL     (STM_RCC_CFGR_PLLMUL_12)
+
+/* SYSCLK = 32MHz (no need to go faster than CPU) */
+#define AO_PLLDIV              3
+#define AO_RCC_CFGR_PLLDIV     (STM_RCC_CFGR_PLLDIV_3)
+
+/* HCLK = 32MHz (CPU clock) */
+#define AO_AHB_PRESCALER       1
+#define AO_RCC_CFGR_HPRE_DIV   STM_RCC_CFGR_HPRE_DIV_1
+
+/* Run APB1 at 16MHz (HCLK/2) */
+#define AO_APB1_PRESCALER      2
+#define AO_RCC_CFGR_PPRE1_DIV  STM_RCC_CFGR_PPRE2_DIV_2
+
+/* Run APB2 at 16MHz (HCLK/2) */
+#define AO_APB2_PRESCALER      2
+#define AO_RCC_CFGR_PPRE2_DIV  STM_RCC_CFGR_PPRE2_DIV_2
+
+#define HAS_SERIAL_1           0
+#define USE_SERIAL_1_STDIN     0
+#define SERIAL_1_PB6_PB7       0
+#define SERIAL_1_PA9_PA10      0
+
+#define HAS_SERIAL_2           0
+#define USE_SERIAL_2_STDIN     0
+#define SERIAL_2_PA2_PA3       0
+#define SERIAL_2_PD5_PD6       0
+
+#define HAS_SERIAL_3           1
+#define USE_SERIAL_3_STDIN     0
+#define SERIAL_3_PB10_PB11     0
+#define SERIAL_3_PC10_PC11     1
+#define SERIAL_3_PD8_PD9       0
+
+#define ao_gps_getchar         ao_serial3_getchar
+#define ao_gps_putchar         ao_serial3_putchar
+#define ao_gps_set_speed       ao_serial3_set_speed
+#define ao_gps_fifo            (ao_stm_usart3.rx_fifo)
+
+#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX       (1024 * 1024)
+#define AO_CONFIG_MAX_SIZE                     1024
+#define LOG_ERASE_MARK                         0x55
+#define LOG_MAX_ERASE                          128
+#define AO_LOG_FORMAT                          AO_LOG_FORMAT_TELEMEGA_4
+
+#define HAS_EEPROM             1
+#define USE_INTERNAL_FLASH     0
+#define USE_EEPROM_CONFIG      1
+#define USE_STORAGE_CONFIG     0
+#define HAS_USB                        1
+#define HAS_BEEP               1
+#define BEEPER_TIMER           3
+#define BEEPER_CHANNEL         1
+#define BEEPER_PORT            (&stm_gpioc)
+#define BEEPER_PIN             6
+#define HAS_BATTERY_REPORT     1
+#define HAS_RADIO              1
+#define HAS_TELEMETRY          1
+#define HAS_APRS               1
+#define HAS_COMPANION          1
+
+#define HAS_SPI_1              1
+#define SPI_1_PA5_PA6_PA7      1       /* Barometer */
+#define SPI_1_PB3_PB4_PB5      1       /* Accelerometer */
+#define SPI_1_PE13_PE14_PE15   1       /* IMU */
+#define SPI_1_OSPEEDR          STM_OSPEEDR_10MHz
+
+#define HAS_SPI_2              1
+#define SPI_2_PB13_PB14_PB15   1       /* Flash, Companion */
+#define SPI_2_PD1_PD3_PD4      0
+#define SPI_2_OSPEEDR          STM_OSPEEDR_10MHz
+
+#define HAS_I2C_1              0
+#define I2C_1_PB8_PB9          0
+
+#define HAS_I2C_2              0
+#define I2C_2_PB10_PB11                0
+
+#define PACKET_HAS_SLAVE       1
+#define PACKET_HAS_MASTER      0
+
+#define LOW_LEVEL_DEBUG                0
+
+#define LED_PORT_ENABLE                STM_RCC_AHBENR_GPIOCEN
+#define LED_PORT               (&stm_gpioc)
+#define LED_PIN_RED            8
+#define LED_PIN_GREEN          9
+#define AO_LED_RED             (1 << LED_PIN_RED)
+#define AO_LED_GREEN           (1 << LED_PIN_GREEN)
+
+#define LEDS_AVAILABLE         (AO_LED_RED | AO_LED_GREEN)
+
+#define HAS_GPS                        1
+#define HAS_FLIGHT             1
+#define HAS_ADC                        1
+#define HAS_ADC_TEMP           1
+#define HAS_LOG                        1
+
+/*
+ * Igniter
+ */
+
+#define HAS_IGNITE             1
+#define HAS_IGNITE_REPORT      1
+
+#define AO_SENSE_PYRO(p,n)     ((p)->adc.sense[n])
+#define AO_SENSE_DROGUE(p)     ((p)->adc.sense[4])
+#define AO_SENSE_MAIN(p)       ((p)->adc.sense[5])
+#define AO_IGNITER_CLOSED      400
+#define AO_IGNITER_OPEN                60
+
+/* Pyro A */
+#define AO_PYRO_PORT_0 (&stm_gpiod)
+#define AO_PYRO_PIN_0  6
+
+/* Pyro B */
+#define AO_PYRO_PORT_1 (&stm_gpiod)
+#define AO_PYRO_PIN_1  7
+
+/* Pyro C */
+#define AO_PYRO_PORT_2 (&stm_gpiod)
+#define AO_PYRO_PIN_2  5
+
+/* Pyro D */
+#define AO_PYRO_PORT_3 (&stm_gpioe)
+#define AO_PYRO_PIN_3  4
+
+/* Drogue */
+#define AO_IGNITER_DROGUE_PORT (&stm_gpioe)
+#define AO_IGNITER_DROGUE_PIN  6
+
+/* Main */
+#define AO_IGNITER_MAIN_PORT   (&stm_gpioe)
+#define AO_IGNITER_MAIN_PIN    5
+
+/* Number of general purpose pyro channels available */
+#define AO_PYRO_NUM    4
+
+/*
+ * ADC
+ */
+#define AO_DATA_RING           32
+#define AO_ADC_NUM_SENSE       6
+
+struct ao_adc {
+       int16_t                 sense[AO_ADC_NUM_SENSE];
+       int16_t                 v_batt;
+       int16_t                 v_pbatt;
+       int16_t                 temp;
+};
+
+#define AO_ADC_DUMP(p) \
+       printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \
+              (p)->tick, \
+              (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \
+              (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \
+              (p)->adc.v_batt, (p)->adc.v_pbatt, (p)->adc.temp)
+
+#define AO_ADC_SENSE_A         0
+#define AO_ADC_SENSE_A_PORT    (&stm_gpioa)
+#define AO_ADC_SENSE_A_PIN     0
+
+#define AO_ADC_SENSE_B         1
+#define AO_ADC_SENSE_B_PORT    (&stm_gpioa)
+#define AO_ADC_SENSE_B_PIN     1
+
+#define AO_ADC_SENSE_C         2
+#define AO_ADC_SENSE_C_PORT    (&stm_gpioa)
+#define AO_ADC_SENSE_C_PIN     2
+
+#define AO_ADC_SENSE_D         3
+#define AO_ADC_SENSE_D_PORT    (&stm_gpioa)
+#define AO_ADC_SENSE_D_PIN     3
+
+#define AO_ADC_SENSE_DROGUE    4
+#define AO_ADC_SENSE_DROGUE_PORT       (&stm_gpioa)
+#define AO_ADC_SENSE_DROGUE_PIN        4
+
+#define AO_ADC_SENSE_MAIN      22
+#define AO_ADC_SENSE_MAIN_PORT (&stm_gpioe)
+#define AO_ADC_SENSE_MAIN_PIN  7
+
+#define AO_ADC_V_BATT          8
+#define AO_ADC_V_BATT_PORT     (&stm_gpiob)
+#define AO_ADC_V_BATT_PIN      0
+
+#define AO_ADC_V_PBATT         9
+#define AO_ADC_V_PBATT_PORT    (&stm_gpiob)
+#define AO_ADC_V_PBATT_PIN     1
+
+#define AO_ADC_TEMP            16
+
+#define AO_ADC_RCC_AHBENR      ((1 << STM_RCC_AHBENR_GPIOAEN) | \
+                                (1 << STM_RCC_AHBENR_GPIOEEN) | \
+                                (1 << STM_RCC_AHBENR_GPIOBEN))
+
+#define AO_NUM_ADC_PIN         (AO_ADC_NUM_SENSE + 2)
+
+#define AO_ADC_PIN0_PORT       AO_ADC_SENSE_A_PORT
+#define AO_ADC_PIN0_PIN                AO_ADC_SENSE_A_PIN
+#define AO_ADC_PIN1_PORT       AO_ADC_SENSE_B_PORT
+#define AO_ADC_PIN1_PIN                AO_ADC_SENSE_B_PIN
+#define AO_ADC_PIN2_PORT       AO_ADC_SENSE_C_PORT
+#define AO_ADC_PIN2_PIN                AO_ADC_SENSE_C_PIN
+#define AO_ADC_PIN3_PORT       AO_ADC_SENSE_D_PORT
+#define AO_ADC_PIN3_PIN                AO_ADC_SENSE_D_PIN
+#define AO_ADC_PIN4_PORT       AO_ADC_SENSE_DROGUE_PORT
+#define AO_ADC_PIN4_PIN                AO_ADC_SENSE_DROGUE_PIN
+#define AO_ADC_PIN5_PORT       AO_ADC_SENSE_MAIN_PORT
+#define AO_ADC_PIN5_PIN                AO_ADC_SENSE_MAIN_PIN
+#define AO_ADC_PIN6_PORT       AO_ADC_V_BATT_PORT
+#define AO_ADC_PIN6_PIN                AO_ADC_V_BATT_PIN
+#define AO_ADC_PIN7_PORT       AO_ADC_V_PBATT_PORT
+#define AO_ADC_PIN7_PIN                AO_ADC_V_PBATT_PIN
+
+#define AO_NUM_ADC             (AO_ADC_NUM_SENSE + 3)
+
+#define AO_ADC_SQ1             AO_ADC_SENSE_A
+#define AO_ADC_SQ2             AO_ADC_SENSE_B
+#define AO_ADC_SQ3             AO_ADC_SENSE_C
+#define AO_ADC_SQ4             AO_ADC_SENSE_D
+#define AO_ADC_SQ5             AO_ADC_SENSE_DROGUE
+#define AO_ADC_SQ6             AO_ADC_SENSE_MAIN
+#define AO_ADC_SQ7             AO_ADC_V_BATT
+#define AO_ADC_SQ8             AO_ADC_V_PBATT
+#define AO_ADC_SQ9             AO_ADC_TEMP
+
+/*
+ * Voltage divider on ADC battery sampler
+ */
+#define AO_BATTERY_DIV_PLUS    56      /* 5.6k */
+#define AO_BATTERY_DIV_MINUS   100     /* 10k */
+
+/*
+ * Voltage divider on ADC igniter samplers
+ */
+#define AO_IGNITE_DIV_PLUS     100     /* 100k */
+#define AO_IGNITE_DIV_MINUS    27      /* 27k */
+
+/*
+ * ADC reference in decivolts
+ */
+#define AO_ADC_REFERENCE_DV    33
+
+/*
+ * Pressure sensor settings
+ */
+#define HAS_MS5607             1
+#define HAS_MS5611             0
+#define AO_MS5607_PRIVATE_PINS 1
+#define AO_MS5607_CS_PORT      (&stm_gpioc)
+#define AO_MS5607_CS_PIN       4
+#define AO_MS5607_CS_MASK      (1 << AO_MS5607_CS)
+#define AO_MS5607_MISO_PORT    (&stm_gpioa)
+#define AO_MS5607_MISO_PIN     6
+#define AO_MS5607_MISO_MASK    (1 << AO_MS5607_MISO)
+#define AO_MS5607_SPI_INDEX    AO_SPI_1_PA5_PA6_PA7
+
+/*
+ * SPI Flash memory
+ */
+
+#define M25_MAX_CHIPS          1
+#define AO_M25_SPI_CS_PORT     (&stm_gpiod)
+#define AO_M25_SPI_CS_MASK     (1 << 3)
+#define AO_M25_SPI_BUS         AO_SPI_2_PB13_PB14_PB15
+
+/*
+ * Radio (cc1120)
+ */
+
+/* gets pretty close to 434.550 */
+
+#define AO_RADIO_CAL_DEFAULT   5695733
+
+#define AO_FEC_DEBUG           0
+#define AO_CC1200_SPI_CS_PORT  (&stm_gpioc)
+#define AO_CC1200_SPI_CS_PIN   5
+#define AO_CC1200_SPI_BUS      AO_SPI_2_PB13_PB14_PB15
+#define AO_CC1200_SPI          stm_spi2
+#define AO_CC1200_SPI_SPEED    AO_SPI_SPEED_FAST
+
+#define AO_CC1200_INT_PORT             (&stm_gpioe)
+#define AO_CC1200_INT_PIN              1
+#define AO_CC1200_MCU_WAKEUP_PORT      (&stm_gpioc)
+#define AO_CC1200_MCU_WAKEUP_PIN       (0)
+
+#define AO_CC1200_INT_GPIO     2
+#define AO_CC1200_INT_GPIO_IOCFG       CC1200_IOCFG2
+
+#define AO_CC1200_MARC_GPIO    3
+#define AO_CC1200_MARC_GPIO_IOCFG      CC1200_IOCFG3
+
+#define HAS_BOOT_RADIO         0
+
+/*
+ * bmx160
+ */
+
+#define HAS_BMX160             1
+#define AO_BMX160_INT_PORT     (&stm_gpioe)
+#define AO_BMX160_INT_PIN      0
+#define AO_BMX160_SPI_BUS      AO_SPI_1_PE13_PE14_PE15
+#define AO_BMX160_SPI_CS_PORT  (&stm_gpiod)
+#define AO_BMX160_SPI_CS_PIN   2
+#define HAS_IMU                        1
+
+#define ao_data_along(packet)  ((packet)->bmx160.acc_x)
+#define ao_data_across(packet) (-(packet)->bmx160.acc_y)
+#define ao_data_through(packet)        ((packet)->bmx160.acc_z)
+
+#define ao_data_roll(packet)   ((packet)->bmx160.gyr_x)
+#define ao_data_pitch(packet)  (-(packet)->bmx160.gyr_y)
+#define ao_data_yaw(packet)    ((packet)->bmx160.gyr_z)
+
+#define ao_data_mag_along(packet)      ((packet)->bmx160.mag_x)
+#define ao_data_mag_across(packet)     ((packet)->bmx160.mag_y)
+#define ao_data_mag_through(packet)    ((packet)->bmx160.mag_z)
+
+/* ADXL375 */
+
+#define HAS_ADXL375            1
+#define AO_ADXL375_SPI_INDEX   (AO_SPI_1_PB3_PB4_PB5 | AO_SPI_MODE_3)
+#define AO_ADXL375_CS_PORT     (&stm_gpiod)
+#define AO_ADXL375_CS_PIN      4
+#define AO_ADXL375_SPI_SPEED   AO_SPI_SPEED_4MHz
+
+#define AO_ADXL375_AXIS                x
+#define AO_ADXL375_INVERT      1
+
+#define NUM_CMDS               16
+
+/*
+ * Companion
+ */
+
+#define AO_COMPANION_CS_PORT   (&stm_gpiob)
+#define AO_COMPANION_CS_PIN_0  (6)
+#define AO_COMPANION_CS_PIN    AO_COMPANION_CS_PIN_0
+#define AO_COMPANION_CS_PIN_1  (7)
+#define AO_COMPANION_SPI_BUS   AO_SPI_2_PB13_PB14_PB15
+
+/*
+ * Monitor
+ */
+
+#define HAS_MONITOR            0
+#define LEGACY_MONITOR         0
+#define HAS_MONITOR_PUT                1
+#define AO_MONITOR_LED         0
+#define HAS_RSSI               0
+
+/*
+ * Profiling Viterbi decoding
+ */
+
+#ifndef AO_PROFILE
+#define AO_PROFILE             0
+#endif
+
+/*
+ * PWM output
+ */
+
+#define NUM_PWM                        4
+#define PWM_MAX                        20000
+#define AO_PWM_TIMER           stm_tim4
+#define AO_PWM_TIMER_ENABLE    STM_RCC_APB1ENR_TIM4EN
+#define AO_PWM_TIMER_SCALE     32
+
+#define AO_PWM_0_GPIO          (&stm_gpiod)
+#define AO_PWM_0_PIN           12
+
+#define AO_PWM_1_GPIO          (&stm_gpiod)
+#define AO_PWM_1_PIN           13
+
+#define AO_PWM_2_GPIO          (&stm_gpiod)
+#define AO_PWM_2_PIN           14
+
+#define AO_PWM_3_GPIO          (&stm_gpiod)
+#define AO_PWM_3_PIN           15
+
+#endif /* _AO_PINS_H_ */
diff --git a/src/telemega-v4.0/ao_telemega.c b/src/telemega-v4.0/ao_telemega.c
new file mode 100644 (file)
index 0000000..2c5ee61
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright © 2017 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+#include <ao.h>
+#include <ao_bmx160.h>
+#include <ao_adxl375.h>
+#include <ao_log.h>
+#include <ao_exti.h>
+#include <ao_packet.h>
+#include <ao_companion.h>
+#include <ao_profile.h>
+#include <ao_eeprom.h>
+#if HAS_SAMPLE_PROFILE
+#include <ao_sample_profile.h>
+#endif
+#include <ao_pyro.h>
+#if HAS_STACK_GUARD
+#include <ao_mpu.h>
+#endif
+#include <ao_pwm.h>
+
+int
+main(void)
+{
+       ao_clock_init();
+
+#if HAS_STACK_GUARD
+       ao_mpu_init();
+#endif
+
+       ao_task_init();
+       ao_serial_init();
+       ao_led_init();
+       ao_led_on(LEDS_AVAILABLE);
+       ao_timer_init();
+
+       ao_spi_init();
+       ao_dma_init();
+       ao_exti_init();
+
+       ao_adc_init();
+#if HAS_BEEP
+       ao_beep_init();
+#endif
+       ao_cmd_init();
+
+       ao_ms5607_init();
+       ao_bmx160_init();
+       ao_adxl375_init();
+
+       ao_eeprom_init();
+       ao_storage_init();
+
+       ao_flight_init();
+       ao_log_init();
+       ao_report_init();
+
+       ao_usb_init();
+       ao_gps_init();
+       ao_gps_report_mega_init();
+       ao_telemetry_init();
+       ao_radio_init();
+       ao_packet_slave_init(false);
+       ao_igniter_init();
+       ao_companion_init();
+       ao_pyro_init();
+
+       ao_config_init();
+#if AO_PROFILE
+       ao_profile_init();
+#endif
+#if HAS_SAMPLE_PROFILE
+       ao_sample_profile_init();
+#endif
+
+       ao_pwm_init();
+
+       ao_led_off(LEDS_AVAILABLE);
+
+       ao_start_scheduler();
+       return 0;
+}
diff --git a/src/telemega-v4.0/flash-loader/Makefile b/src/telemega-v4.0/flash-loader/Makefile
new file mode 100644 (file)
index 0000000..334d10f
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# AltOS flash loader build
+#
+#
+
+TOPDIR=../..
+HARDWARE=telemega-v4.0
+include $(TOPDIR)/stm/Makefile-flash.defs
diff --git a/src/telemega-v4.0/flash-loader/ao_pins.h b/src/telemega-v4.0/flash-loader/ao_pins.h
new file mode 100644 (file)
index 0000000..6e9bba5
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2017 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+/* External crystal at 8MHz */
+#define AO_HSE         8000000
+
+#include <ao_flash_stm_pins.h>
+
+/* Companion port cs_companion0 PB6 */
+
+#define AO_BOOT_PIN                    1
+#define AO_BOOT_APPLICATION_GPIO       stm_gpiob
+#define AO_BOOT_APPLICATION_PIN                6
+#define AO_BOOT_APPLICATION_VALUE      1
+#define AO_BOOT_APPLICATION_MODE       AO_EXTI_MODE_PULL_UP
+
+#endif /* _AO_PINS_H_ */
index d91b1d21fcf8d04374fc4efe3029b3a72f134c20..ae8534b9c3fbaf56ef3545f42dcaf6296273da3d 100644 (file)
@@ -74,9 +74,9 @@
 #define AO_RECOVERY_VALUE      0
 #define AO_RECOVERY_MODE       AO_EXTI_MODE_PULL_UP
 
-/* Beeper is on Tim3 CH4 */
+/* Beeper is on Tim2 CH4 */
 #define BEEPER_CHANNEL         4
-#define BEEPER_TIMER           3
+#define BEEPER_TIMER           2
 #define BEEPER_PORT            (&stm_gpioa)
 #define BEEPER_PIN             3
 
index bb3bc05424e2083eee81bc61cbde082a8b5a8876..d571d340f38919ee46f9ed6dd2f8ab1dd013b903 100644 (file)
@@ -19,6 +19,7 @@
 #include <ao.h>
 #include <ao_exti.h>
 
+#if HAS_FORCE_FREQ
 static void
 ao_check_recovery(void)
 {
@@ -33,11 +34,14 @@ ao_check_recovery(void)
        ao_gpio_set_mode(AO_RECOVERY_PORT, AO_RECOVERY_PIN, 0);
        ao_disable_port(AO_RECOVERY_PORT);
 }
+#endif
 
 int
 main(void)
 {
+#if HAS_FORCE_FREQ
        ao_check_recovery();
+#endif
 
        ao_clock_init();
        ao_task_init();
index 5df47202067e805c6467af2d40ada4628c725fd8..77ed0da7ae5b7b48dad0a683a9d8813ff26881bb 100644 (file)
@@ -25,8 +25,8 @@ import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
 import java.text.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class TeleGPS
        extends AltosUIFrame
index e9d5b8338e22a18cf871c219d9d557db9393da2d..5e165d70cba18a2c5f9350bf9de8a4a778586f5e 100644 (file)
@@ -23,8 +23,8 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.text.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class TeleGPSConfig implements ActionListener {
 
index 03652302b31c6dc98e780537ebb3c713c9582971..dc982dea911dca866d093c2ae14dfec7c433be0d 100644 (file)
@@ -23,8 +23,8 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class TeleGPSConfigUI
        extends AltosUIDialog
index defd588e722d931a13b0d675529fc377203f006f..873092a5f46a75e2022c1a4cb38ae0a422628784 100644 (file)
@@ -22,8 +22,8 @@ import java.awt.*;
 import javax.swing.*;
 import java.io.*;
 import java.text.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class TeleGPSDisplayThread extends Thread {
 
index b5a135c59d3ad3e90a1cf10b9914753125e63d2c..e9fc683101b637bf4f1d3596ddf2227dfb1de91f 100644 (file)
@@ -27,8 +27,8 @@ import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
 import java.util.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 import org.jfree.chart.ChartPanel;
 import org.jfree.chart.JFreeChart;
index dcfbace5fa823b2094d300fbbe62064f6d0706fd..bad1f6f7d8dd099e8c5e4927c29d5ad3546b839d 100644 (file)
@@ -22,8 +22,8 @@ import java.util.*;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class TeleGPSInfo extends AltosUIFlightTab {
 
index 31d435d0fb28f7fd8be4c3788300ce8a9b18cf80..1ff9d0589a71074327341d79b75a86657f24066f 100644 (file)
@@ -23,7 +23,7 @@ import java.awt.event.*;
 import java.beans.*;
 import javax.swing.*;
 import javax.swing.event.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class TeleGPSPreferences
        extends AltosUIConfigure
index 0c15cbb1d3724ae3c3d6ab87ebf257f21672acc7..1327a8d4ee19d1981d708abdd356f7a969a9e515 100644 (file)
@@ -22,8 +22,8 @@ import java.util.*;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class TeleGPSState extends AltosUIFlightTab {
 
index 493917e568ecac679d87506f3ed375f01f0bda6d..d29774bb0973ba5a09cd0046064e54425d43e164 100644 (file)
@@ -20,8 +20,8 @@ package org.altusmetrum.telegps;
 
 import java.awt.*;
 import javax.swing.*;
-import org.altusmetrum.altoslib_13.*;
-import org.altusmetrum.altosuilib_13.*;
+import org.altusmetrum.altoslib_14.*;
+import org.altusmetrum.altosuilib_14.*;
 
 public class TeleGPSStatus extends JComponent implements AltosFlightDisplay {
        GridBagLayout   layout;
index d583fa5df40bdc524d67264c350bf5997ad848cc..0b20865b5eb1d367b5183ce81e205af35ff021d7 100644 (file)
@@ -19,7 +19,7 @@
 package org.altusmetrum.telegps;
 
 import java.awt.event.*;
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 public class TeleGPSStatusUpdate implements ActionListener {