AltosIdleMonitorUI ui;
AltosState state;
boolean remote;
- int channel;
+ double frequency;
AltosState previous_state;
AltosConfigData config_data;
AltosADC adc;
try {
if (remote) {
- set_channel(channel);
+ serial.set_radio_frequency(frequency);
serial.start_remote();
} else
serial.flush_input();
record.version = 0;
record.callsign = config_data.callsign;
record.serial = config_data.serial;
- record.flight = 0;
+ record.flight = config_data.log_available() > 0 ? 255 : 0;
record.rssi = 0;
record.status = 0;
record.state = Altos.ao_flight_idle;
state = new AltosState (record, state);
}
- void set_channel(int in_channel) {
- channel = in_channel;
+ void set_frequency(double in_frequency) {
+ frequency = in_frequency;
}
public void post_state() {
}
public AltosIdleMonitor(AltosIdleMonitorUI in_ui, AltosDevice in_device, boolean in_remote)
- throws FileNotFoundException, AltosSerialInUseException {
+ throws FileNotFoundException, AltosSerialInUseException, InterruptedException, TimeoutException {
device = in_device;
ui = in_ui;
serial = new AltosSerial(device);
flightInfo.clear();
}
+ public void set_font() {
+ pad.set_font();
+ flightInfo.set_font();
+ }
+
public void show(AltosState state, int crc_errors) {
try {
pad.show(state, crc_errors);
}
Container bag;
- JComboBox channels;
+ AltosFreqList frequencies;
- public AltosIdleMonitorUI(JFrame in_owner) throws FileNotFoundException, AltosSerialInUseException {
+ public AltosIdleMonitorUI(JFrame in_owner)
+ throws FileNotFoundException, AltosSerialInUseException, TimeoutException, InterruptedException {
device = AltosDeviceDialog.show(in_owner, Altos.product_any);
remote = false;
setTitle(String.format("AltOS %s", device.toShortString()));
- /* Stick channel selector at top of table for telemetry monitoring */
+ /* Stick frequency selector at top of table for telemetry monitoring */
if (remote && serial >= 0) {
- // Channel menu
- channels = new AltosChannelMenu(AltosPreferences.channel(serial));
- channels.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- int channel = channels.getSelectedIndex();
- thread.set_channel(channel);
- }
+ // Frequency menu
+ frequencies = new AltosFreqList(AltosPreferences.frequency(serial));
+ frequencies.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ double frequency = frequencies.frequency();
+ thread.set_frequency(frequency);
+ AltosPreferences.set_frequency(device.getSerial(),
+ frequency);
+ }
});
c.gridx = 0;
c.gridy = 0;
c.insets = new Insets(3, 3, 3, 3);
c.anchor = GridBagConstraints.WEST;
- bag.add (channels, c);
+ bag.add (frequencies, c);
}