summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-27 22:02:13 -0700
committerKeith Packard <keithp@keithp.com>2012-03-27 22:03:05 -0700
commit3f0379db7067eaf104892a82b9c49142087adece (patch)
tree3e0e7c82ae099f3441da6134fba749e20966fbe7
parent7a9baabaf33db5e30eb4ef8f923a4fd96fd28fb4 (diff)
altosui: Make 'monitor idle' work with older TeleMetrum firmware (trac #28)
Older TM firmware did not have the 'done' line at the end of the GPS report, rather it would just stop after showing the Flags value. Check the TM version and stop looking for GPS data when the Flags line appears. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altosui/AltosIdleMonitorUI.java10
-rw-r--r--altosui/AltosSerial.java2
2 files changed, 9 insertions, 3 deletions
diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java
index dbac2d33..d877be4d 100644
--- a/altosui/AltosIdleMonitorUI.java
+++ b/altosui/AltosIdleMonitorUI.java
@@ -90,7 +90,9 @@ class AltosADC {
}
class AltosGPSQuery extends AltosGPS {
- public AltosGPSQuery (AltosSerial serial) throws TimeoutException, InterruptedException {
+ public AltosGPSQuery (AltosSerial serial, AltosConfigData config_data)
+ throws TimeoutException, InterruptedException {
+ boolean says_done = config_data.compare_version("1.0") >= 0;
serial.printf("g\n");
for (;;) {
String line = serial.get_reply_no_dialog(5000);
@@ -140,6 +142,8 @@ class AltosGPSQuery extends AltosGPS {
int status = Integer.decode(bits[1]);
connected = (status & Altos.AO_GPS_RUNNING) != 0;
locked = (status & Altos.AO_GPS_VALID) != 0;
+ if (!says_done)
+ break;
continue;
}
if (line.startsWith("Sats:")) {
@@ -184,7 +188,7 @@ class AltosIdleMonitor extends Thread {
serial.flush_input();
config_data = new AltosConfigData(serial);
adc = new AltosADC(serial);
- gps = new AltosGPSQuery(serial);
+ gps = new AltosGPSQuery(serial, config_data);
} finally {
if (remote)
serial.stop_remote();
@@ -237,6 +241,8 @@ class AltosIdleMonitor extends Thread {
update_state();
post_state();
} catch (TimeoutException te) {
+ if (AltosSerial.debug)
+ System.out.printf ("monitor idle data timeout\n");
}
Thread.sleep(1000);
}
diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java
index dffc74ea..77c926b1 100644
--- a/altosui/AltosSerial.java
+++ b/altosui/AltosSerial.java
@@ -55,7 +55,7 @@ public class AltosSerial implements Runnable {
boolean monitor_mode;
int telemetry;
double frequency;
- static boolean debug;
+ public static boolean debug;
boolean remote;
LinkedList<String> pending_output = new LinkedList<String>();
Frame frame;