projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
AltosSiteMap: extend map if rocket goes far away
[fw/altos]
/
ao-tools
/
altosui
/
AltosPreferences.java
diff --git
a/ao-tools/altosui/AltosPreferences.java
b/ao-tools/altosui/AltosPreferences.java
index 690f8f1ed5e60eff6e2f858147d7c66fc5ae4e8f..e2a3df3b7717bb5b92f9cf150706bdc49a7ecbb3 100644
(file)
--- a/
ao-tools/altosui/AltosPreferences.java
+++ b/
ao-tools/altosui/AltosPreferences.java
@@
-32,7
+32,7
@@
class AltosPreferences {
final static String logdirPreference = "LOGDIR";
/* channel preference name */
final static String logdirPreference = "LOGDIR";
/* channel preference name */
- final static String channelPreference
= "CHANNEL
";
+ final static String channelPreference
Format = "CHANNEL-%d
";
/* voice preference name */
final static String voicePreference = "VOICE";
/* voice preference name */
final static String voicePreference = "VOICE";
@@
-40,6
+40,9
@@
class AltosPreferences {
/* callsign preference name */
final static String callsignPreference = "CALLSIGN";
/* 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";
/* Default logdir is ~/TeleMetrum */
final static String logdirName = "TeleMetrum";
@@
-49,14
+52,18
@@
class AltosPreferences {
/* Log directory */
static File logdir;
/* Log directory */
static File logdir;
- /*
Telemetry channel
*/
- static
int channel
;
+ /*
Channel (map serial to channel)
*/
+ static
Hashtable<Integer, Integer> channels
;
/* Voice preference */
static boolean voice;
/* Voice preference */
static boolean voice;
+ /* Callsign preference */
static String callsign;
static String callsign;
+ /* Firmware directory */
+ static File firmwaredir;
+
public static void init(Component ui) {
preferences = Preferences.userRoot().node("/org/altusmetrum/altosui");
public static void init(Component ui) {
preferences = Preferences.userRoot().node("/org/altusmetrum/altosui");
@@
-73,11
+80,17
@@
class AltosPreferences {
logdir.mkdirs();
}
logdir.mkdirs();
}
- channel
= preferences.getInt(channelPreference, 0
);
+ channel
s = new Hashtable<Integer,Integer>(
);
voice = preferences.getBoolean(voicePreference, true);
callsign = preferences.get(callsignPreference,"N0CALL");
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() {
}
static void flush_preferences() {
@@
-138,15
+151,19
@@
class AltosPreferences {
return logdir;
}
return logdir;
}
- public static void set_channel(int new_channel) {
- channel
= new_channel
;
+ public static void set_channel(int
serial, int
new_channel) {
+ channel
s.put(serial, new_channel)
;
synchronized (preferences) {
synchronized (preferences) {
- preferences.putInt(
channelPreference,
channel);
+ preferences.putInt(
String.format(channelPreferenceFormat, serial), new_
channel);
flush_preferences();
}
}
flush_preferences();
}
}
- public static int channel() {
+ public static int channel(int serial) {
+ if (channels.containsKey(serial))
+ return channels.get(serial);
+ int channel = preferences.getInt(String.format(channelPreferenceFormat, serial), 0);
+ channels.put(serial, channel);
return channel;
}
return channel;
}
@@
-173,4
+190,16
@@
class AltosPreferences {
public static String callsign() {
return callsign;
}
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;
+ }
}
}