altosui: Add debug dongle API, split flash UI out
[fw/altos] / ao-tools / altosui / AltosUI.java
index 33ce274a26d7393f31e2fc2f43f150fcb82b3e8d..9fd47ea7ae149a3fc688cb0e824f2d934e2dec1a 100644 (file)
@@ -40,6 +40,8 @@ import altosui.AltosLog;
 import altosui.AltosVoice;
 import altosui.AltosFlightStatusTableModel;
 import altosui.AltosFlightInfoTableModel;
+import altosui.AltosChannelMenu;
+import altosui.AltosFlashUI;
 
 import libaltosJNI.*;
 
@@ -453,6 +455,14 @@ public class AltosUI extends JFrame {
                }
        }
 
+       void ConfigureTeleMetrum() {
+               new AltosConfig(AltosUI.this);
+       }
+
+       void FlashImage() {
+               new AltosFlashUI(AltosUI.this);
+       }
+
        /*
         * Open an existing telemetry file and replay it in realtime
         */
@@ -585,6 +595,14 @@ public class AltosUI extends JFrame {
                                });
                        menu.add(item);
 
+                       item = new JMenuItem("Flash Image",KeyEvent.VK_F);
+                       item.addActionListener(new ActionListener() {
+                                       public void actionPerformed(ActionEvent e) {
+                                               FlashImage();
+                                       }
+                               });
+                       menu.add(item);
+
                        item = new JMenuItem("Quit",KeyEvent.VK_Q);
                        item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,
                                                                   ActionEvent.CTRL_MASK));
@@ -628,6 +646,15 @@ public class AltosUI extends JFrame {
                                });
 
                        menu.add(item);
+
+                       item = new JMenuItem("Configure TeleMetrum device",KeyEvent.VK_T);
+                       item.addActionListener(new ActionListener() {
+                                       public void actionPerformed(ActionEvent e) {
+                                               ConfigureTeleMetrum();
+                                       }
+                               });
+
+                       menu.add(item);
                }
                // Log menu
                {
@@ -680,26 +707,16 @@ public class AltosUI extends JFrame {
 
                // Channel menu
                {
-                       menu = new JMenu("Channel", true);
-                       menu.setMnemonic(KeyEvent.VK_C);
-                       menubar.add(menu);
-                       ButtonGroup group = new ButtonGroup();
-
-                       for (int c = 0; c <= 9; c++) {
-                               radioitem = new JRadioButtonMenuItem(String.format("Channel %1d (%7.3fMHz)", c,
-                                                                                  434.550 + c * 0.1),
-                                                                    c == AltosPreferences.channel());
-                               radioitem.setActionCommand(String.format("%d", c));
-                               radioitem.addActionListener(new ActionListener() {
+                       menu = new AltosChannelMenu(AltosPreferences.channel());
+                       menu.addActionListener(new ActionListener() {
                                                public void actionPerformed(ActionEvent e) {
                                                        int new_channel = Integer.parseInt(e.getActionCommand());
                                                        AltosPreferences.set_channel(new_channel);
                                                        serial_line.set_channel(new_channel);
                                                }
-                                       });
-                               menu.add(radioitem);
-                               group.add(radioitem);
-                       }
+                               });
+                       menu.setMnemonic(KeyEvent.VK_C);
+                       menubar.add(menu);
                }
 
                this.setJMenuBar(menubar);