projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Configure STM LCD driver for giant LCD digits
[fw/altos]
/
altosui
/
AltosIdleMonitorUI.java
diff --git
a/altosui/AltosIdleMonitorUI.java
b/altosui/AltosIdleMonitorUI.java
index 142f02784259d40b65ed349521006152ce66e382..2ee909374a313d50492dd3e2ffb42e167696218a 100644
(file)
--- a/
altosui/AltosIdleMonitorUI.java
+++ b/
altosui/AltosIdleMonitorUI.java
@@
-27,6
+27,7
@@
import java.util.*;
import java.text.*;
import java.util.prefs.*;
import java.util.concurrent.*;
import java.text.*;
import java.util.prefs.*;
import java.util.concurrent.*;
+import org.altusmetrum.AltosLib.*;
class AltosADC {
int tick;
class AltosADC {
int tick;
@@
-90,7
+91,9
@@
class AltosADC {
}
class AltosGPSQuery extends AltosGPS {
}
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);
serial.printf("g\n");
for (;;) {
String line = serial.get_reply_no_dialog(5000);
@@
-140,6
+143,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;
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:")) {
continue;
}
if (line.startsWith("Sats:")) {
@@
-184,7
+189,7
@@
class AltosIdleMonitor extends Thread {
serial.flush_input();
config_data = new AltosConfigData(serial);
adc = new AltosADC(serial);
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();
} finally {
if (remote)
serial.stop_remote();
@@
-237,6
+242,8
@@
class AltosIdleMonitor extends Thread {
update_state();
post_state();
} catch (TimeoutException te) {
update_state();
post_state();
} catch (TimeoutException te) {
+ if (AltosSerial.debug)
+ System.out.printf ("monitor idle data timeout\n");
}
Thread.sleep(1000);
}
}
Thread.sleep(1000);
}
@@
-255,7
+262,7
@@
class AltosIdleMonitor extends Thread {
}
}
}
}
-public class AltosIdleMonitorUI extends
JFrame implements AltosFlightDisplay
{
+public class AltosIdleMonitorUI extends
AltosFrame implements AltosFlightDisplay, AltosFontListener
{
AltosDevice device;
JTabbedPane pane;
AltosPad pad;
AltosDevice device;
JTabbedPane pane;
AltosPad pad;
@@
-284,7
+291,19
@@
public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {
flightInfo.clear();
}
flightInfo.clear();
}
+ public void set_font() {
+ pad.set_font();
+ flightInfo.set_font();
+ }
+
+ public void font_size_changed(int font_size) {
+ set_font();
+ }
+
+ AltosFlightStatusUpdate status_update;
+
public void show(AltosState state, int crc_errors) {
public void show(AltosState state, int crc_errors) {
+ status_update.saved_state = state;
try {
pad.show(state, crc_errors);
flightStatus.show(state, crc_errors);
try {
pad.show(state, crc_errors);
flightStatus.show(state, crc_errors);
@@
-306,7
+325,7
@@
public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {
device = AltosDeviceDialog.show(in_owner, Altos.product_any);
remote = false;
device = AltosDeviceDialog.show(in_owner, Altos.product_any);
remote = false;
- if (!device.matchProduct(Altos.product_
telemetrum
))
+ if (!device.matchProduct(Altos.product_
altimeter
))
remote = true;
serial = device.getSerial();
remote = true;
serial = device.getSerial();
@@
-324,12
+343,12
@@
public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {
/* Stick frequency selector at top of table for telemetry monitoring */
if (remote && serial >= 0) {
// Frequency menu
/* Stick frequency selector at top of table for telemetry monitoring */
if (remote && serial >= 0) {
// Frequency menu
- frequencies = new AltosFreqList(AltosPreferences.frequency(serial));
+ frequencies = new AltosFreqList(Altos
UI
Preferences.frequency(serial));
frequencies.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
double frequency = frequencies.frequency();
thread.set_frequency(frequency);
frequencies.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
double frequency = frequencies.frequency();
thread.set_frequency(frequency);
- AltosPreferences.set_frequency(device.getSerial(),
+ Altos
UI
Preferences.set_frequency(device.getSerial(),
frequency);
}
});
frequency);
}
});
@@
-372,12
+391,16
@@
public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {
bag.add(pane, c);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
bag.add(pane, c);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+
+ AltosUIPreferences.register_font_listener(this);
+
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
disconnect();
setVisible(false);
dispose();
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
disconnect();
setVisible(false);
dispose();
+ AltosUIPreferences.unregister_font_listener(AltosIdleMonitorUI.this);
}
});
}
});
@@
-386,6
+409,10
@@
public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {
thread = new AltosIdleMonitor(this, device, remote);
thread = new AltosIdleMonitor(this, device, remote);
+ status_update = new AltosFlightStatusUpdate(flightStatus);
+
+ new javax.swing.Timer(100, status_update).start();
+
thread.start();
}
}
thread.start();
}
}