+ void enable_rate_menu(int serial, final AltosFlightReader reader) {
+
+ if (rate_listener != null)
+ disable_rate_menu();
+
+ rate_listener = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ int rate = rates.rate();
+ try {
+ System.out.printf("set rate %d\n", rate);
+ reader.set_telemetry_rate(rate);
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ reader.save_telemetry_rate();
+ }
+ };
+
+ rates.addActionListener(rate_listener);
+ rates.set_product("Monitor");
+ rates.set_serial(serial);
+ rates.set_rate(AltosUIPreferences.telemetry_rate(serial));
+ rates.setEnabled(reader.supports_telemetry_rate(AltosLib.ao_telemetry_rate_2400));
+ }
+
+ void disable_rate_menu() {
+ if (rate_listener != null) {
+ rates.removeActionListener(rate_listener);
+ rates.setEnabled(false);
+ rate_listener = null;
+ }
+
+ }
+
+ public void set_reader(AltosFlightReader reader, AltosDevice device) {
+ status_update = new TeleGPSStatusUpdate(telegps_status);
+
+ status_timer = new javax.swing.Timer(100, status_update);
+ status_timer.start();
+