summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
Diffstat (limited to 'altosui')
-rw-r--r--altosui/AltosInfoTable.java34
-rw-r--r--altosui/AltosSerial.java16
-rw-r--r--altosui/altos-windows.nsi3
-rw-r--r--altosui/libaltos/libaltos.c4
4 files changed, 43 insertions, 14 deletions
diff --git a/altosui/AltosInfoTable.java b/altosui/AltosInfoTable.java
index aa6a6d4e..c1400976 100644
--- a/altosui/AltosInfoTable.java
+++ b/altosui/AltosInfoTable.java
@@ -40,18 +40,38 @@ public class AltosInfoTable extends JTable {
return (infoValueMetrics.getHeight() + infoValueMetrics.getLeading()) * 18 / 10;
}
+ int text_width(String t) {
+ FontMetrics infoValueMetrics = getFontMetrics(Altos.table_value_font);
+
+ return infoValueMetrics.stringWidth(t);
+ }
+
+ void set_layout() {
+ setRowHeight(desired_row_height());
+ for (int i = 0; i < info_columns * 2; i++)
+ {
+ TableColumn column = getColumnModel().getColumn(i);
+
+ if ((i & 1) == 0)
+ column.setPreferredWidth(text_width(" Satellites Visible "));
+ else
+ column.setPreferredWidth(text_width(" 179°59.99999' "));
+ }
+ }
+
public AltosInfoTable() {
super(new AltosFlightInfoTableModel(info_rows, info_columns));
model = (AltosFlightInfoTableModel) getModel();
setFont(Altos.table_value_font);
setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);
setShowGrid(true);
- setRowHeight(desired_row_height());
+ set_layout();
doLayout();
}
public void set_font() {
setFont(Altos.table_value_font);
+ set_layout();
doLayout();
}
@@ -95,13 +115,8 @@ public class AltosInfoTable extends JTable {
if (state == null)
return;
info_reset();
- info_add_row(0, "Rocket state", "%s", state.data.state());
- info_add_row(0, "Callsign", "%s", state.data.callsign);
- info_add_row(0, "Rocket serial", "%6d", state.data.serial);
- info_add_row(0, "Rocket flight", "%6d", state.data.flight);
-
- info_add_row(0, "RSSI", "%6d dBm", state.data.rssi);
- info_add_row(0, "CRC Errors", "%6d", crc_errors);
+ info_add_row(0, "Altitude", "%6.0f m", state.altitude);
+ info_add_row(0, "Pad altitude", "%6.0f m", state.ground_altitude);
info_add_row(0, "Height", "%6.0f m", state.height);
info_add_row(0, "Max height", "%6.0f m", state.max_height);
info_add_row(0, "Acceleration", "%8.1f m/s²", state.acceleration);
@@ -114,7 +129,8 @@ public class AltosInfoTable extends JTable {
info_add_row(0, "Drogue", "%9.2f V", state.drogue_sense);
if (state.main_sense != AltosRecord.MISSING)
info_add_row(0, "Main", "%9.2f V", state.main_sense);
- info_add_row(0, "Pad altitude", "%6.0f m", state.ground_altitude);
+ info_add_row(0, "CRC Errors", "%6d", crc_errors);
+
if (state.gps == null || !state.gps.connected) {
info_add_row(1, "GPS", "not available");
} else {
diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java
index c4e9c697..6cee1609 100644
--- a/altosui/AltosSerial.java
+++ b/altosui/AltosSerial.java
@@ -41,7 +41,7 @@ import libaltosJNI.*;
* threads.
*/
-public class AltosSerial extends AltosLink implements Runnable {
+public class AltosSerial extends AltosLink {
static java.util.List<String> devices_opened = Collections.synchronizedList(new LinkedList<String>());
@@ -54,13 +54,19 @@ public class AltosSerial extends AltosLink implements Runnable {
Frame frame;
public int getchar() {
+ if (altos == null)
+ return ERROR;
return libaltos.altos_getchar(altos, 0);
}
public void flush_output() {
super.flush_output();
if (altos != null) {
- libaltos.altos_flush(altos);
+ if (libaltos.altos_flush(altos) != 0) {
+ libaltos.altos_close(altos);
+ altos = null;
+ abort_reply();
+ }
}
}
@@ -155,7 +161,11 @@ public class AltosSerial extends AltosLink implements Runnable {
private void putc(char c) {
if (altos != null)
- libaltos.altos_putchar(altos, c);
+ if (libaltos.altos_putchar(altos, c) != 0) {
+ libaltos.altos_close(altos);
+ altos = null;
+ abort_reply();
+ }
}
public void print(String data) {
diff --git a/altosui/altos-windows.nsi b/altosui/altos-windows.nsi
index 92c985a9..986919d4 100644
--- a/altosui/altos-windows.nsi
+++ b/altosui/altos-windows.nsi
@@ -1,6 +1,7 @@
!addplugindir Instdrv/NSIS/Plugins
; Definitions for Java 1.6 Detection
!define JRE_VERSION "1.6"
+!define JRE_ALTERNATE "1.7"
!define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=52247&/jre-6u27-windows-i586-p.exe"
!define PRODUCT_NAME "Altus Metrum Windows Software"
@@ -42,6 +43,8 @@ Function DetectJRE
"CurrentVersion"
StrCmp $2 ${JRE_VERSION} done
+ StrCmp $2 ${JRE_ALTERNATE} done
+
Call GetJRE
done:
diff --git a/altosui/libaltos/libaltos.c b/altosui/libaltos/libaltos.c
index 1cc27cbe..515432f9 100644
--- a/altosui/libaltos/libaltos.c
+++ b/altosui/libaltos/libaltos.c
@@ -221,7 +221,7 @@ altos_flush(struct altos_file *file)
#endif
if (ret < 0) {
altos_set_last_posix_error();
- return -errno;
+ return -last_error.code;
}
if (ret) {
memmove(file->out_data, file->out_data + ret,
@@ -247,7 +247,7 @@ altos_putchar(struct altos_file *file, char c)
ret = 0;
if (file->out_used == USB_BUF_SIZE)
ret = altos_flush(file);
- return 0;
+ return ret;
}
#ifdef USE_POLL