String[] statusNames = { "Height (m)", "State", "RSSI (dBm)", "Speed (m/s)" };
Object[][] statusData = { { "0", "pad", "-50", "0" } };
- java.net.URL imgURL = AltosUI.class.getResource("/images/altus-metrum-16x16.jpg");
+ java.net.URL imgURL = AltosUI.class.getResource("/altus-metrum-16x16.jpg");
if (imgURL != null)
setIconImage(new ImageIcon(imgURL).getImage());
if (state.npad > 0) {
if (state.from_pad != null) {
- info_add_row(1, "Distance from pad", "%6.0f m", state.from_pad.distance);
- info_add_row(1, "Direction from pad", "%6.0f°", state.from_pad.bearing);
+ info_add_row(1, "Distance from pad", "%6d m",
+ (int) (state.from_pad.distance + 0.5));
+ info_add_row(1, "Direction from pad", "%6d°",
+ (int) (state.from_pad.bearing + 0.5));
+ info_add_row(1, "Elevation from pad", "%6d°",
+ (int) (state.elevation + 0.5));
+ info_add_row(1, "Range from pad", "%6d m",
+ (int) (state.range + 0.5));
} else {
info_add_row(1, "Distance from pad", "unknown");
info_add_row(1, "Direction from pad", "unknown");
+ info_add_row(1, "Elevation from pad", "unknown");
+ info_add_row(1, "Range from pad", "unknown");
}
info_add_deg(1, "Pad latitude", state.pad_lat, 'N', 'S');
info_add_deg(1, "Pad longitude", state.pad_lon, 'E', 'W');
AltosRecord read() throws InterruptedException, ParseException, AltosCRCException, IOException { return null; }
- void close() { }
+ void close(boolean interrupted) { }
void update(AltosState state) throws InterruptedException { }
public void run() {
+ boolean interrupted = false;
String line;
AltosState state = null;
AltosState old_state = null;
}
}
} catch (InterruptedException ee) {
+ interrupted = true;
} catch (IOException ie) {
JOptionPane.showMessageDialog(AltosUI.this,
String.format("Error reading from \"%s\"", name),
"Telemetry Read Error",
JOptionPane.ERROR_MESSAGE);
} finally {
- close();
+ close(interrupted);
idle_thread.interrupt();
+ try {
+ idle_thread.join();
+ } catch (InterruptedException ie) {}
}
}
return new AltosTelemetry(l.line);
}
- void close() {
+ void close(boolean interrupted) {
serial.close();
serial.remove_monitor(telem);
}
return null;
}
- public void close () {
- report();
+ public void close (boolean interrupted) {
+ if (!interrupted)
+ report();
}
public ReplayThread(AltosReader in_reader, String in_name) {