Thread thread;
AltosFrequency[] frequencies;
int frequency_index;
+ int packet_count;
+ int tick_count;
void scan_exception(Exception e) {
if (e instanceof FileNotFoundException) {
AltosState state = reader.read();
if (state == null)
continue;
+ packet_count++;
if (state.flight != AltosLib.MISSING) {
final AltosScanResult result = new AltosScanResult(state.callsign,
state.serial,
return;
}
}
+ packet_count = 0;
+ tick_count = 0;
++frequency_index;
if (frequency_index >= frequencies.length)
frequency_index = 0;
}
void tick_timer() throws InterruptedException, TimeoutException {
- next();
+ ++tick_count;
+ if (packet_count == 0 || tick_count > 5)
+ next();
}
public void actionPerformed(ActionEvent e) {
if (r != null) {
if (device != null) {
if (reader != null) {
- System.out.printf("frequency %g rate %d\n", r.frequency.frequency, r.rate);
reader.set_telemetry(r.telemetry);
reader.set_telemetry_rate(r.rate);
reader.set_frequency(r.frequency.frequency);