projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add voice test command for help in adjusting volume.
[fw/altos]
/
ao-tools
/
altosui
/
AltosUI.java
diff --git
a/ao-tools/altosui/AltosUI.java
b/ao-tools/altosui/AltosUI.java
index 3dfc89527601d52d6bf685b2174b66ca9e75e883..e1697ee1e280637524b15a8f96d0e051bd3f41e4 100644
(file)
--- a/
ao-tools/altosui/AltosUI.java
+++ b/
ao-tools/altosui/AltosUI.java
@@
-210,6
+210,7
@@
public class AltosUI extends JFrame {
System.exit(0);
}
});
System.exit(0);
}
});
+ voice.speak("Rocket flight monitor ready.");
}
public void info_reset() {
}
public void info_reset() {
@@
-490,11
+491,13
@@
public class AltosUI extends JFrame {
try {
serial_line.open(device);
DeviceThread thread = new DeviceThread(serial_line);
try {
serial_line.open(device);
DeviceThread thread = new DeviceThread(serial_line);
+ serial_line.set_channel(AltosPreferences.channel());
run_display(thread);
} catch (FileNotFoundException ee) {
JOptionPane.showMessageDialog(AltosUI.this,
run_display(thread);
} catch (FileNotFoundException ee) {
JOptionPane.showMessageDialog(AltosUI.this,
- device.getPath(),
- "Cannot open serial port",
+ String.format("Cannot open device \"%s\"",
+ device.getPath()),
+ "Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} catch (IOException ee) {
JOptionPane.showMessageDialog(AltosUI.this,
JOptionPane.ERROR_MESSAGE);
} catch (IOException ee) {
JOptionPane.showMessageDialog(AltosUI.this,
@@
-705,12
+708,26
@@
public class AltosUI extends JFrame {
menu.setMnemonic(KeyEvent.VK_V);
menubar.add(menu);
menu.setMnemonic(KeyEvent.VK_V);
menubar.add(menu);
- radioitem = new JRadioButtonMenuItem("Enable Voice");
+ radioitem = new JRadioButtonMenuItem("Enable Voice"
, AltosPreferences.voice()
);
radioitem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
radioitem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
+ JRadioButtonMenuItem item = (JRadioButtonMenuItem) e.getSource();
+ boolean enabled = item.isSelected();
+ AltosPreferences.set_voice(enabled);
+ if (enabled)
+ voice.speak_always("Enable voice.");
+ else
+ voice.speak_always("Disable voice.");
}
});
menu.add(radioitem);
}
});
menu.add(radioitem);
+ item = new JMenuItem("Test Voice",KeyEvent.VK_T);
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ voice.speak("That's one small step for man; one giant leap for mankind.");
+ }
+ });
+ menu.add(item);
}
// Channel menu
}
// Channel menu
@@
-723,12
+740,13
@@
public class AltosUI extends JFrame {
for (int c = 0; c <= 9; c++) {
radioitem = new JRadioButtonMenuItem(String.format("Channel %1d (%7.3fMHz)", c,
434.550 + c * 0.1),
for (int c = 0; c <= 9; c++) {
radioitem = new JRadioButtonMenuItem(String.format("Channel %1d (%7.3fMHz)", c,
434.550 + c * 0.1),
- c ==
0
);
+ c ==
AltosPreferences.channel()
);
radioitem.setActionCommand(String.format("%d", c));
radioitem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
radioitem.setActionCommand(String.format("%d", c));
radioitem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- System.out.println("Command: " + e.getActionCommand() + " param: " +
- e.paramString());
+ int new_channel = Integer.parseInt(e.getActionCommand());
+ AltosPreferences.set_channel(new_channel);
+ serial_line.set_channel(new_channel);
}
});
menu.add(radioitem);
}
});
menu.add(radioitem);