summaryrefslogtreecommitdiff
path: root/altoslib/AltosSensorTM.java
diff options
context:
space:
mode:
authorBdale Garbee <bdale@gag.com>2013-12-19 01:38:40 -0700
committerBdale Garbee <bdale@gag.com>2013-12-19 01:38:40 -0700
commit575bbaf976c5840fd0e308549c45a466fdec1352 (patch)
tree11bfb498348bf7687bffc24699c4b1a998988ee4 /altoslib/AltosSensorTM.java
parentb825116df173b77e2cab217a7b76112c742f9279 (diff)
parentbc3610d8cecbfed40c62d4dcb93fc9a4d2a7c9e3 (diff)
Merge branch 'branch-1.3' into debian
Conflicts: ChangeLog altoslib/AltosRecordMM.java altosui/Makefile.am altosui/altos-windows.nsi.in configure.ac debian/changelog debian/control doc/Makefile doc/altusmetrum.xsl doc/release-notes-1.2.1.xsl doc/release-notes-1.2.xsl
Diffstat (limited to 'altoslib/AltosSensorTM.java')
-rw-r--r--altoslib/AltosSensorTM.java35
1 files changed, 27 insertions, 8 deletions
diff --git a/altoslib/AltosSensorTM.java b/altoslib/AltosSensorTM.java
index 754dc5bb..f867de4b 100644
--- a/altoslib/AltosSensorTM.java
+++ b/altoslib/AltosSensorTM.java
@@ -15,14 +15,37 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
import java.util.concurrent.TimeoutException;
-class AltosSensorTM extends AltosRecordTM {
+public class AltosSensorTM {
+ public int tick;
+ public int accel;
+ public int pres;
+ public int temp;
+ public int batt;
+ public int drogue;
+ public int main;
- public AltosSensorTM(AltosLink link, AltosConfigData config_data) throws InterruptedException, TimeoutException {
- super();
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) throws InterruptedException {
+ try {
+ AltosSensorTM sensor_tm = new AltosSensorTM(link);
+
+ if (sensor_tm == null)
+ return;
+ state.set_accel(sensor_tm.accel);
+ state.set_pressure(AltosConvert.barometer_to_pressure(sensor_tm.pres));
+ state.set_temperature(AltosConvert.thermometer_to_temperature(sensor_tm.temp));
+ state.set_battery_voltage(AltosConvert.cc_battery_to_voltage(sensor_tm.batt));
+ state.set_apogee_voltage(AltosConvert.cc_ignitor_to_voltage(sensor_tm.drogue));
+ state.set_main_voltage(AltosConvert.cc_ignitor_to_voltage(sensor_tm.main));
+
+ } catch (TimeoutException te) {
+ }
+ }
+
+ public AltosSensorTM(AltosLink link) throws InterruptedException, TimeoutException {
String[] items = link.adc();
for (int i = 0; i < items.length;) {
if (items[i].equals("tick:")) {
@@ -62,10 +85,6 @@ class AltosSensorTM extends AltosRecordTM {
}
i++;
}
- ground_accel = config_data.accel_cal_plus;
- ground_pres = pres;
- accel_plus_g = config_data.accel_cal_plus;
- accel_minus_g = config_data.accel_cal_minus;
}
}