projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Make skytraq reflashing code try both 9600 and 4800 baud
[fw/altos]
/
altosui
/
AltosConfig.java
diff --git
a/altosui/AltosConfig.java
b/altosui/AltosConfig.java
index 58da405fc12d24d57bef727a045d6e39820bf73f..4b0edec0fbf5492aa48501c5e9ab2540f121d65c 100644
(file)
--- a/
altosui/AltosConfig.java
+++ b/
altosui/AltosConfig.java
@@
-17,18
+17,12
@@
package altosui;
package altosui;
-import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.*;
-import javax.swing.filechooser.FileNameExtensionFilter;
-import javax.swing.table.*;
import java.io.*;
import java.io.*;
-import java.util.*;
-import java.text.*;
-import java.util.prefs.*;
import java.util.concurrent.*;
import java.util.concurrent.*;
-
-import
libaltosJNI
.*;
+import org.altusmetrum.AltosLib.*;
+import
java.text
.*;
public class AltosConfig implements ActionListener {
public class AltosConfig implements ActionListener {
@@
-85,6
+79,8
@@
public class AltosConfig implements ActionListener {
string_ref version;
string_ref product;
string_ref callsign;
string_ref version;
string_ref product;
string_ref callsign;
+ int_ref npyro;
+ AltosPyro[] pyros;
AltosConfigUI config_ui;
boolean serial_started;
boolean made_visible;
AltosConfigUI config_ui;
boolean serial_started;
boolean made_visible;
@@
-169,6
+165,8
@@
public class AltosConfig implements ActionListener {
config_ui.set_ignite_mode(ignite_mode.get());
config_ui.set_pad_orientation(pad_orientation.get());
config_ui.set_callsign(callsign.get());
config_ui.set_ignite_mode(ignite_mode.get());
config_ui.set_pad_orientation(pad_orientation.get());
config_ui.set_callsign(callsign.get());
+ config_ui.set_pyros(pyros);
+ config_ui.set_has_pyro(npyro.get() > 0);
config_ui.set_clean();
if (!made_visible) {
made_visible = true;
config_ui.set_clean();
if (!made_visible) {
made_visible = true;
@@
-176,6
+174,8
@@
public class AltosConfig implements ActionListener {
}
}
}
}
+ int pyro;
+
void process_line(String line) {
if (line == null) {
abort();
void process_line(String line) {
if (line == null) {
abort();
@@
-186,6
+186,18
@@
public class AltosConfig implements ActionListener {
update_ui();
return;
}
update_ui();
return;
}
+ if (pyro < npyro.get()) {
+ if (pyros == null)
+ pyros = new AltosPyro[npyro.get()];
+
+ try {
+ pyros[pyro] = new AltosPyro(pyro, line);
+ } catch (ParseException e) {
+ System.out.printf ("pyro parse failed %s\n", line);
+ }
+ ++pyro;
+ return;
+ }
get_int(line, "serial-number", serial);
get_int(line, "log-format", log_format);
get_int(line, "Main deploy:", main_deploy);
get_int(line, "serial-number", serial);
get_int(line, "log-format", log_format);
get_int(line, "Main deploy:", main_deploy);
@@
-207,6
+219,7
@@
public class AltosConfig implements ActionListener {
get_string(line, "Callsign:", callsign);
get_string(line,"software-version", version);
get_string(line,"product", product);
get_string(line, "Callsign:", callsign);
get_string(line,"software-version", version);
get_string(line,"product", product);
+ get_int(line, "Pyro-count:", npyro);
}
final static int serial_mode_read = 0;
}
final static int serial_mode_read = 0;
@@
-250,6
+263,8
@@
public class AltosConfig implements ActionListener {
callsign.set("N0CALL");
version.set("unknown");
product.set("unknown");
callsign.set("N0CALL");
version.set("unknown");
product.set("unknown");
+ pyro = 0;
+ npyro.set(0);
}
void get_data() {
}
void get_data() {
@@
-299,7
+314,7
@@
public class AltosConfig implements ActionListener {
if (remote) {
serial_line.stop_remote();
serial_line.set_radio_frequency(frequency);
if (remote) {
serial_line.stop_remote();
serial_line.set_radio_frequency(frequency);
- AltosPreferences.set_frequency(device.getSerial(), frequency);
+ Altos
UI
Preferences.set_frequency(device.getSerial(), frequency);
serial_line.start_remote();
}
serial_line.printf("c c %s\n", callsign.get());
serial_line.start_remote();
}
serial_line.printf("c c %s\n", callsign.get());
@@
-311,6
+326,12
@@
public class AltosConfig implements ActionListener {
serial_line.printf("c i %d\n", ignite_mode.get());
if (pad_orientation.get() >= 0)
serial_line.printf("c o %d\n", pad_orientation.get());
serial_line.printf("c i %d\n", ignite_mode.get());
if (pad_orientation.get() >= 0)
serial_line.printf("c o %d\n", pad_orientation.get());
+ if (pyros.length > 0) {
+ for (int p = 0; p < pyros.length; p++) {
+ serial_line.printf("c P %s\n",
+ pyros[p].toString());
+ }
+ }
serial_line.printf("c w\n");
} catch (InterruptedException ie) {
} catch (TimeoutException te) {
serial_line.printf("c w\n");
} catch (InterruptedException ie) {
} catch (TimeoutException te) {
@@
-372,8
+393,10
@@
public class AltosConfig implements ActionListener {
}
void abort() {
}
void abort() {
- serial_line.close();
- serial_line = null;
+ if (serial_line != null) {
+ serial_line.close();
+ serial_line = null;
+ }
JOptionPane.showMessageDialog(owner,
String.format("Connection to \"%s\" failed",
device.toShortString()),
JOptionPane.showMessageDialog(owner,
String.format("Connection to \"%s\" failed",
device.toShortString()),
@@
-438,6
+461,9
@@
public class AltosConfig implements ActionListener {
if (pad_orientation.get() >= 0)
pad_orientation.set(config_ui.pad_orientation());
callsign.set(config_ui.callsign());
if (pad_orientation.get() >= 0)
pad_orientation.set(config_ui.pad_orientation());
callsign.set(config_ui.callsign());
+ if (npyro.get() > 0) {
+ pyros = config_ui.pyros();
+ }
run_serial_thread(serial_mode_save);
}
run_serial_thread(serial_mode_save);
}
@@
-484,13
+510,14
@@
public class AltosConfig implements ActionListener {
callsign = new string_ref("N0CALL");
version = new string_ref("unknown");
product = new string_ref("unknown");
callsign = new string_ref("N0CALL");
version = new string_ref("unknown");
product = new string_ref("unknown");
+ npyro = new int_ref(0);
device = AltosDeviceDialog.show(owner, Altos.product_any);
if (device != null) {
try {
serial_line = new AltosSerial(device);
try {
device = AltosDeviceDialog.show(owner, Altos.product_any);
if (device != null) {
try {
serial_line = new AltosSerial(device);
try {
- if (
!device.matchProduct(Altos.product_telemetrum
))
+ if (
device.matchProduct(Altos.product_basestation
))
remote = true;
init_ui();
} catch (InterruptedException ie) {
remote = true;
init_ui();
} catch (InterruptedException ie) {
@@
-509,11
+536,6
@@
public class AltosConfig implements ActionListener {
device.toShortString()),
"Device in use",
JOptionPane.ERROR_MESSAGE);
device.toShortString()),
"Device in use",
JOptionPane.ERROR_MESSAGE);
- } catch (IOException ee) {
- JOptionPane.showMessageDialog(owner,
- device.toShortString(),
- ee.getLocalizedMessage(),
- JOptionPane.ERROR_MESSAGE);
}
}
}
}
}
}