From 7e053ae1f2d09347123ac9fa79e46645378b4c70 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Fri, 10 Sep 2010 10:42:35 -0600 Subject: make the column headers comma separated, too, so they align with the data --- ao-tools/altosui/AltosCSV.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ao-tools/altosui/AltosCSV.java b/ao-tools/altosui/AltosCSV.java index 4ce8e30e..07fa371f 100644 --- a/ao-tools/altosui/AltosCSV.java +++ b/ao-tools/altosui/AltosCSV.java @@ -86,7 +86,7 @@ public class AltosCSV { */ void write_general_header() { - out.printf("version serial flight call time rssi"); + out.printf("version,serial,flight,call,time,rssi"); } void write_general(AltosRecord record) { @@ -97,7 +97,7 @@ public class AltosCSV { } void write_flight_header() { - out.printf("state state_name"); + out.printf("state,state_name"); } void write_flight(AltosRecord record) { @@ -105,7 +105,7 @@ public class AltosCSV { } void write_basic_header() { - out.printf("acceleration pressure altitude height accel_speed baro_speed temperature battery_voltage drogue_voltage main_voltage"); + out.printf("acceleration,pressure,altitude,height,accel_speed,baro_speed,temperature,battery_voltage,drogue_voltage,main_voltage"); } void write_basic(AltosRecord record) { @@ -123,7 +123,7 @@ public class AltosCSV { } void write_gps_header() { - out.printf("connected locked nsat latitude longitude altitude year month day hour minute second pad_dist pad_range pad_az pad_el"); + out.printf("connected,locked,nsat,latitude,longitude,altitude,year,month,day,hour,minute,second,pad_dist,pad_range,pad_az,pad_el"); } void write_gps(AltosRecord record) { @@ -155,10 +155,10 @@ public class AltosCSV { } void write_header() { - out.printf("# "); write_general_header(); - out.printf(" "); write_flight_header(); - out.printf(" "); write_basic_header(); - out.printf(" "); write_gps_header(); + out.printf("#"); write_general_header(); + out.printf(","); write_flight_header(); + out.printf(","); write_basic_header(); + out.printf(","); write_gps_header(); out.printf ("\n"); } -- cgit v1.2.3 From 7f2204e0832b14b1edca4266a2cbc272141ecc2b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 10 Sep 2010 20:55:05 -0700 Subject: altosui: set default .csv file name in file save dialog This uses setSelectedFile to specify which output filename to make the default in the save dialog. Signed-off-by: Keith Packard --- ao-tools/altosui/AltosCSVUI.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ao-tools/altosui/AltosCSVUI.java b/ao-tools/altosui/AltosCSVUI.java index 2d812361..643d4112 100644 --- a/ao-tools/altosui/AltosCSVUI.java +++ b/ao-tools/altosui/AltosCSVUI.java @@ -56,6 +56,7 @@ public class AltosCSVUI path = path.substring(0,dot); path = path.concat(".csv"); csv_chooser = new JFileChooser(path); + csv_chooser.setSelectedFile(new File(path)); int ret = csv_chooser.showSaveDialog(frame); if (ret == JFileChooser.APPROVE_OPTION) { try { -- cgit v1.2.3 From b9623f8ef26491e9fa14e2478295fe6f5cbbd87f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 10 Sep 2010 21:07:14 -0700 Subject: altosui: Remember directory containing firmware files Instead of forcing the user to navigate to the firmware directory each time, this remembers the previous directory and starts there. Signed-off-by: Keith Packard --- ao-tools/altosui/AltosFlashUI.java | 7 +++++++ ao-tools/altosui/AltosPreferences.java | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/ao-tools/altosui/AltosFlashUI.java b/ao-tools/altosui/AltosFlashUI.java index 5ed417da..86f57a5f 100644 --- a/ao-tools/altosui/AltosFlashUI.java +++ b/ao-tools/altosui/AltosFlashUI.java @@ -194,6 +194,10 @@ public class AltosFlashUI JFileChooser hexfile_chooser = new JFileChooser(); + File firmwaredir = AltosPreferences.firmwaredir(); + if (firmwaredir != null) + hexfile_chooser.setCurrentDirectory(firmwaredir); + hexfile_chooser.setDialogTitle("Select Flash Image"); hexfile_chooser.setFileFilter(new FileNameExtensionFilter("Flash Image", "ihx")); int returnVal = hexfile_chooser.showOpenDialog(frame); @@ -203,6 +207,9 @@ public class AltosFlashUI file = hexfile_chooser.getSelectedFile(); + if (file != null) + AltosPreferences.set_firmwaredir(file.getParentFile()); + thread = new Thread(this); thread.start(); } diff --git a/ao-tools/altosui/AltosPreferences.java b/ao-tools/altosui/AltosPreferences.java index 690f8f1e..52627563 100644 --- a/ao-tools/altosui/AltosPreferences.java +++ b/ao-tools/altosui/AltosPreferences.java @@ -40,6 +40,9 @@ class AltosPreferences { /* callsign preference name */ final static String callsignPreference = "CALLSIGN"; + /* firmware directory preference name */ + final static String firmwaredirPreference = "FIRMWARE"; + /* Default logdir is ~/TeleMetrum */ final static String logdirName = "TeleMetrum"; @@ -55,8 +58,12 @@ class AltosPreferences { /* Voice preference */ static boolean voice; + /* Callsign preference */ static String callsign; + /* Firmware directory */ + static File firmwaredir; + public static void init(Component ui) { preferences = Preferences.userRoot().node("/org/altusmetrum/altosui"); @@ -78,6 +85,12 @@ class AltosPreferences { voice = preferences.getBoolean(voicePreference, true); callsign = preferences.get(callsignPreference,"N0CALL"); + + String firmwaredir_string = preferences.get(firmwaredirPreference, null); + if (firmwaredir_string != null) + firmwaredir = new File(firmwaredir_string); + else + firmwaredir = null; } static void flush_preferences() { @@ -173,4 +186,16 @@ class AltosPreferences { public static String callsign() { return callsign; } + + public static void set_firmwaredir(File new_firmwaredir) { + firmwaredir = new_firmwaredir; + synchronized (preferences) { + preferences.put(firmwaredirPreference, firmwaredir.getPath()); + flush_preferences(); + } + } + + public static File firmwaredir() { + return firmwaredir; + } } -- cgit v1.2.3