summaryrefslogtreecommitdiff
path: root/altoslib
diff options
context:
space:
mode:
Diffstat (limited to 'altoslib')
-rw-r--r--altoslib/AltosEepromDownload.java2
-rw-r--r--altoslib/AltosIdleMonitor.java3
-rw-r--r--altoslib/AltosLib.java5
-rw-r--r--altoslib/AltosMs5607.java8
-rw-r--r--altoslib/AltosTelemetryReader.java5
5 files changed, 10 insertions, 13 deletions
diff --git a/altoslib/AltosEepromDownload.java b/altoslib/AltosEepromDownload.java
index 542defee..1b043167 100644
--- a/altoslib/AltosEepromDownload.java
+++ b/altoslib/AltosEepromDownload.java
@@ -239,6 +239,7 @@ public class AltosEepromDownload implements Runnable {
public void start() {
eeprom_thread = new Thread(this);
+ monitor.set_thread(eeprom_thread);
eeprom_thread.start();
}
@@ -255,7 +256,6 @@ public class AltosEepromDownload implements Runnable {
monitor.set_states(AltosLib.ao_flight_boost, AltosLib.ao_flight_landed);
- monitor.set_thread(eeprom_thread);
monitor.start();
}
}
diff --git a/altoslib/AltosIdleMonitor.java b/altoslib/AltosIdleMonitor.java
index c816c202..d9d71143 100644
--- a/altoslib/AltosIdleMonitor.java
+++ b/altoslib/AltosIdleMonitor.java
@@ -91,14 +91,11 @@ public class AltosIdleMonitor extends Thread {
}
public void abort() throws InterruptedException {
- System.out.printf("Attempting to abort monitor thread\n");
while (isAlive()) {
- System.out.printf("Interrupting\n");
interrupt();
link.abort_reply();
Thread.sleep(100);
}
- System.out.printf("Appears to be dead now\n");
join();
}
diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java
index 36a2ab32..efbc3ddb 100644
--- a/altoslib/AltosLib.java
+++ b/altoslib/AltosLib.java
@@ -143,6 +143,11 @@ public class AltosLib {
/* Bluetooth "identifier" (bluetooth sucks) */
public final static String bt_product_telebt = "TeleBT";
+ /* "good" voltages */
+
+ public final static double ao_battery_good = 3.8;
+ public final static double ao_igniter_good = 3.5;
+
/* Telemetry modes */
public static final int ao_telemetry_off = 0;
public static final int ao_telemetry_min = 1;
diff --git a/altoslib/AltosMs5607.java b/altoslib/AltosMs5607.java
index 23d65ea9..2319d5b8 100644
--- a/altoslib/AltosMs5607.java
+++ b/altoslib/AltosMs5607.java
@@ -85,12 +85,10 @@ public class AltosMs5607 {
}
public boolean parse_line(String line) {
- System.out.printf ("parse %s\n", line);
String[] items = line.split("\\s+");
if (line.startsWith("Pressure:")) {
if (items.length >= 2) {
raw_pres = Integer.parseInt(items[1]);
- System.out.printf ("raw_pres %d\n", raw_pres);
}
} else if (line.startsWith("Temperature:")) {
if (items.length >= 2)
@@ -99,10 +97,8 @@ public class AltosMs5607 {
if (items.length >= 3)
reserved = Integer.parseInt(items[2]);
} else if (line.startsWith("ms5607 sens:")) {
- System.out.printf ("found sens length %d\n", items.length);
if (items.length >= 3) {
sens = Integer.parseInt(items[2]);
- System.out.printf ("sens %d\n", sens);
}
} else if (line.startsWith("ms5607 off:")) {
if (items.length >= 3)
@@ -156,13 +152,9 @@ public class AltosMs5607 {
throw new TimeoutException();
}
if (!parse_line(line)) {
- System.out.printf ("stop parsing at %s\n", line);
break;
}
}
- System.out.printf ("sens %d off %d tcs %d tco %d tref %d tempsens %d crc %d pres %d temp %d\n",
- sens, off, tcs, tco, tref, tempsens, crc, raw_pres, raw_temp);
convert();
- System.out.printf ("pa %d cc %d\n", pa, cc);
}
}
diff --git a/altoslib/AltosTelemetryReader.java b/altoslib/AltosTelemetryReader.java
index 405c555b..eeb35cb5 100644
--- a/altoslib/AltosTelemetryReader.java
+++ b/altoslib/AltosTelemetryReader.java
@@ -124,6 +124,7 @@ public class AltosTelemetryReader extends AltosFlightReader {
public AltosTelemetryReader (AltosLink in_link)
throws IOException, InterruptedException, TimeoutException {
link = in_link;
+ boolean success = false;
try {
log = new AltosLog(link);
name = link.name;
@@ -133,8 +134,10 @@ public class AltosTelemetryReader extends AltosFlightReader {
telemetry = AltosPreferences.telemetry(link.serial);
set_telemetry(telemetry);
link.add_monitor(telem);
+ success = true;
} finally {
- close(true);
+ if (!success)
+ close(true);
}
}
}