2 * Copyright © 2011 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 package org.altusmetrum.altoslib_14;
23 import java.util.concurrent.*;
25 /* Don't change the field names in this structure; they're part of all .eeprom files */
26 public class AltosConfigData {
28 /* Version information */
29 public String manufacturer;
30 public String product;
33 public int log_format;
35 public String version;
36 public int altitude_32;
37 public int config_major, config_minor;
39 /* Config information */
41 public int main_deploy;
42 public int apogee_delay;
43 public int apogee_lockout;
46 public int radio_frequency;
47 public String callsign;
48 public int radio_enable;
49 public int radio_calibration;
50 public int telemetry_rate;
51 /* Old HAS_RADIO values */
52 public int radio_channel;
53 public int radio_setting;
56 public int accel_cal_plus, accel_cal_minus;
57 private int accel_cal_plus_cooked, accel_cal_minus_cooked;
58 private boolean accel_cal_adjusted;
59 public int pad_orientation;
62 public int flight_log_max;
66 public int ignite_mode;
69 public String aes_key;
72 public AltosPyro[] pyros;
75 public double pyro_firing_time;
78 public int aprs_interval;
80 public int aprs_format;
81 public int aprs_offset;
86 /* Storage info replies */
87 public int storage_size;
88 public int storage_erase_unit;
90 /* Log listing replies */
91 public int stored_flight;
92 public AltosEepromFlight[] flights;
95 public int tracker_motion;
96 public int tracker_interval;
99 public int accel_zero_along, accel_zero_across, accel_zero_through;
104 public AltosMs5607 ms5607() {
106 ms5607 = new AltosMs5607();
110 public static String get_string(String line, String label) throws ParseException {
111 if (line.startsWith(label)) {
112 String quoted = line.substring(label.length()).trim();
114 if (quoted.startsWith("\""))
115 quoted = quoted.substring(1);
116 if (quoted.endsWith("\""))
117 quoted = quoted.substring(0,quoted.length()-1);
120 throw new ParseException("mismatch", 0);
123 public static int get_int(String line, String label) throws NumberFormatException, ParseException {
124 if (line.startsWith(label)) {
125 String tail = line.substring(label.length()).trim();
126 String[] tokens = tail.split("\\s+");
127 if (tokens.length > 0)
128 return Integer.parseInt(tokens[0]);
130 throw new ParseException("mismatch", 0);
133 public static int[] get_values(String line, String label) throws NumberFormatException, ParseException {
134 if (line.startsWith(label)) {
135 String tail = line.substring(label.length()).trim();
136 String[] tokens = tail.split("\\s+");
137 if (tokens.length > 1) {
138 int[] values = new int[2];
139 values[0] = Integer.parseInt(tokens[0]);
140 values[1] = Integer.parseInt(tokens[1]);
144 throw new ParseException("mismatch", 0);
147 public int log_space() {
148 if (log_space != AltosLib.MISSING)
151 if (storage_size != AltosLib.MISSING) {
152 int space = storage_size;
154 if (storage_erase_unit != AltosLib.MISSING && use_flash_for_config())
155 space -= storage_erase_unit;
157 if (space != AltosLib.MISSING)
163 public int log_available() {
164 switch (log_format) {
165 case AltosLib.AO_LOG_FORMAT_TINY:
169 case AltosLib.AO_LOG_FORMAT_TELEMETRY:
170 case AltosLib.AO_LOG_FORMAT_TELESCIENCE:
173 if (flight_log_max <= 0)
175 int log_max = flight_log_max * 1024;
176 int log_space = log_space();
182 log_used = flights.length * log_max;
185 if (log_used >= log_space)
188 log_avail = (log_space - log_used) / log_max;
194 public int invert_accel_value(int value) {
195 if (value == AltosLib.MISSING)
196 return AltosLib.MISSING;
198 switch (log_format) {
199 case AltosLib.AO_LOG_FORMAT_FULL:
200 return 0x7fff - value;
201 case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
202 case AltosLib.AO_LOG_FORMAT_TELEMETRUM:
203 case AltosLib.AO_LOG_FORMAT_TELEMEGA:
204 case AltosLib.AO_LOG_FORMAT_TELEMEGA_3:
205 case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
207 case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
210 return AltosLib.MISSING;
214 public boolean has_monitor_battery() {
215 if (product.startsWith("TeleBT"))
220 int[] parse_version(String v) {
221 String[] parts = v.split("\\.");
222 int r[] = new int[parts.length];
224 for (int i = 0; i < parts.length; i++) {
226 r[i] = (int) AltosLib.fromdec(parts[i]);
227 } catch (NumberFormatException n) {
235 public boolean altitude_32() {
236 return altitude_32 == 1;
239 public int compare_version(String other) {
240 int[] me = parse_version(version);
241 int[] them = parse_version(other);
243 int l = Math.min(me.length, them.length);
245 for (int i = 0; i < l; i++) {
246 int d = me[i] - them[i];
257 public void reset() {
260 serial = AltosLib.MISSING;
261 flight = AltosLib.MISSING;
262 log_format = AltosLib.AO_LOG_FORMAT_UNKNOWN;
263 log_space = AltosLib.MISSING;
265 config_major = AltosLib.MISSING;
266 config_minor = AltosLib.MISSING;
268 main_deploy = AltosLib.MISSING;
269 apogee_delay = AltosLib.MISSING;
270 apogee_lockout = AltosLib.MISSING;
272 radio_frequency = AltosLib.MISSING;
274 radio_enable = AltosLib.MISSING;
275 radio_calibration = AltosLib.MISSING;
276 radio_channel = AltosLib.MISSING;
277 radio_setting = AltosLib.MISSING;
278 telemetry_rate = AltosLib.MISSING;
280 accel_cal_plus_cooked = AltosLib.MISSING;
281 accel_cal_minus_cooked = AltosLib.MISSING;
282 accel_cal_plus = AltosLib.MISSING;
283 accel_cal_minus = AltosLib.MISSING;
284 pad_orientation = AltosLib.MISSING;
285 accel_cal_adjusted = false;
287 flight_log_max = AltosLib.MISSING;
288 log_fixed = AltosLib.MISSING;
289 ignite_mode = AltosLib.MISSING;
293 pyro = AltosLib.MISSING;
294 npyro = AltosLib.MISSING;
296 pyro_firing_time = AltosLib.MISSING;
298 aprs_interval = AltosLib.MISSING;
299 aprs_ssid = AltosLib.MISSING;
300 aprs_format = AltosLib.MISSING;
301 aprs_offset = AltosLib.MISSING;
303 beep = AltosLib.MISSING;
305 tracker_motion = AltosLib.MISSING;
306 tracker_interval = AltosLib.MISSING;
308 storage_size = AltosLib.MISSING;
309 storage_erase_unit = AltosLib.MISSING;
313 accel_zero_along = AltosLib.MISSING;
314 accel_zero_across = AltosLib.MISSING;
315 accel_zero_through = AltosLib.MISSING;
318 /* Return + accel calibration relative to a specific pad orientation */
319 public int accel_cal_plus(int pad_orientation) {
321 switch (pad_orientation) {
322 case AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP:
323 return accel_cal_plus_cooked;
324 case AltosLib.AO_PAD_ORIENTATION_ANTENNA_DOWN:
325 return invert_accel_value(accel_cal_minus_cooked);
327 return AltosLib.MISSING;
331 /* Return - accel calibration relative to a specific pad orientation */
332 public int accel_cal_minus(int pad_orientation) {
334 switch (pad_orientation) {
335 case AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP:
336 return accel_cal_minus_cooked;
337 case AltosLib.AO_PAD_ORIENTATION_ANTENNA_DOWN:
338 return invert_accel_value(accel_cal_plus_cooked);
340 return AltosLib.MISSING;
344 /* Once we have all of the values from the config data, compute the
345 * accel cal values relative to Antenna Up orientation.
347 private void adjust_accel_cal() {
348 if (!accel_cal_adjusted &&
349 pad_orientation != AltosLib.MISSING &&
350 accel_cal_plus != AltosLib.MISSING &&
351 accel_cal_minus != AltosLib.MISSING &&
352 log_format != AltosLib.AO_LOG_FORMAT_UNKNOWN)
354 switch (pad_orientation) {
355 case AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP:
356 accel_cal_plus_cooked = accel_cal_plus;
357 accel_cal_minus_cooked = accel_cal_minus;
358 accel_cal_adjusted = true;
360 case AltosLib.AO_PAD_ORIENTATION_ANTENNA_DOWN:
361 accel_cal_plus_cooked = invert_accel_value(accel_cal_minus);
362 accel_cal_minus_cooked = invert_accel_value(accel_cal_plus);
363 accel_cal_adjusted = true;
371 public void parse_line(String line) {
373 /* Version replies */
374 try { manufacturer = get_string(line, "manufacturer"); } catch (Exception e) {}
375 try { product = get_string(line, "product"); } catch (Exception e) {}
376 try { serial = get_int(line, "serial-number"); } catch (Exception e) {}
377 try { flight = get_int(line, "current-flight"); } catch (Exception e) {}
378 try { log_format = get_int(line, "log-format"); } catch (Exception e) {}
379 try { log_space = get_int(line, "log-space"); } catch (Exception e) {}
380 try { altitude_32 = get_int(line, "altitude-32"); } catch (Exception e) {}
381 try { version = get_string(line, "software-version"); } catch (Exception e) {}
383 /* Version also contains MS5607 info, which we ignore here */
385 try { ms5607().reserved = get_int(line, "ms5607 reserved:"); } catch (Exception e) {}
386 try { ms5607().sens = get_int(line, "ms5607 sens:"); } catch (Exception e) {}
387 try { ms5607().off = get_int(line, "ms5607 off:"); } catch (Exception e) {}
388 try { ms5607().tcs = get_int(line, "ms5607 tcs:"); } catch (Exception e) {}
389 try { ms5607().tco = get_int(line, "ms5607 tco:"); } catch (Exception e) {}
390 try { ms5607().tref = get_int(line, "ms5607 tref:"); } catch (Exception e) {}
391 try { ms5607().tempsens = get_int(line, "ms5607 tempsens:"); } catch (Exception e) {}
392 try { ms5607().crc = get_int(line, "ms5607 crc:"); } catch (Exception e) {}
394 /* Config show replies */
397 if (line.startsWith("Config version")) {
398 String[] bits = line.split("\\s+");
399 if (bits.length >= 3) {
400 String[] cfg = bits[2].split("\\.");
402 if (cfg.length >= 2) {
403 config_major = Integer.parseInt(cfg[0]);
404 config_minor = Integer.parseInt(cfg[1]);
408 } catch (Exception e) {}
411 try { main_deploy = get_int(line, "Main deploy:"); } catch (Exception e) {}
412 try { apogee_delay = get_int(line, "Apogee delay:"); } catch (Exception e) {}
413 try { apogee_lockout = get_int(line, "Apogee lockout:"); } catch (Exception e) {}
417 radio_frequency = get_int(line, "Frequency:");
418 if (radio_frequency < 0)
419 radio_frequency = 434550;
420 } catch (Exception e) {}
421 try { callsign = get_string(line, "Callsign:"); } catch (Exception e) {}
422 try { radio_enable = get_int(line, "Radio enable:"); } catch (Exception e) {}
423 try { radio_calibration = get_int(line, "Radio cal:"); } catch (Exception e) {}
424 try { telemetry_rate = get_int(line, "Telemetry rate:"); } catch (Exception e) {}
426 /* Old HAS_RADIO values */
427 try { radio_channel = get_int(line, "Radio channel:"); } catch (Exception e) {}
428 try { radio_setting = get_int(line, "Radio setting:"); } catch (Exception e) {}
432 if (line.startsWith("Accel cal")) {
433 String[] bits = line.split("\\s+");
434 if (bits.length >= 6) {
435 accel_cal_plus = Integer.parseInt(bits[3]);
436 accel_cal_minus = Integer.parseInt(bits[5]);
437 accel_cal_adjusted = false;
440 } catch (Exception e) {}
441 try { pad_orientation = get_int(line, "Pad orientation:"); } catch (Exception e) {}
444 try { flight_log_max = get_int(line, "Max flight log:"); } catch (Exception e) {}
445 try { log_fixed = get_int(line, "Log fixed:"); } catch (Exception e) {}
448 try { ignite_mode = get_int(line, "Ignite mode:"); } catch (Exception e) {}
451 try { aes_key = get_string(line, "AES key:"); } catch (Exception e) {}
455 npyro = get_int(line, "Pyro-count:");
456 pyros = new AltosPyro[npyro];
458 } catch (Exception e) {}
459 if (npyro != AltosLib.MISSING) {
461 AltosPyro p = new AltosPyro(pyro, line);
464 } catch (Exception e) {}
466 try { pyro_firing_time = get_int(line, "Pyro time:") / 100.0; } catch (Exception e) {}
469 try { aprs_interval = get_int(line, "APRS interval:"); } catch (Exception e) {}
470 try { aprs_ssid = get_int(line, "APRS SSID:"); } catch (Exception e) {}
471 try { aprs_format = get_int(line, "APRS format:"); } catch (Exception e) {}
472 try { aprs_offset = get_int(line, "APRS offset:"); } catch (Exception e) {}
475 try { beep = get_int(line, "Beeper setting:"); } catch (Exception e) {}
479 int[] values = get_values(line, "Tracker setting:");
480 tracker_motion = values[0];
481 tracker_interval = values[1];
482 } catch (Exception e) {}
484 /* Storage info replies */
485 try { storage_size = get_int(line, "Storage size:"); } catch (Exception e) {}
486 try { storage_erase_unit = get_int(line, "Storage erase unit:"); } catch (Exception e) {}
488 /* Log listing replies */
490 int flight = get_int(line, "flight");
491 String[] tokens = line.split("\\s+");
492 if (tokens.length >= 6) {
493 int start = -1, end = -1;
495 if (tokens[2].equals("start"))
496 start = AltosParse.parse_hex(tokens[3]);
497 if (tokens[4].equals("end"))
498 end = AltosParse.parse_hex(tokens[5]);
499 if (flight != 0 && start >= 0 && end > 0) {
504 len = flights.length;
505 AltosEepromFlight [] new_flights = new AltosEepromFlight[len + 1];
506 for (int i = 0; i < len; i++)
507 new_flights[i] = flights[i];
508 new_flights[len] = new AltosEepromFlight(flight, start, end);
509 flights = new_flights;
510 stored_flight = flights.length;
512 } catch (ParseException pe) { System.out.printf("Parse error %s\n", pe.toString()); }
514 } catch (Exception e) {}
518 if (line.startsWith("IMU cal along")) {
519 String[] bits = line.split("\\s+");
520 if (bits.length >= 8) {
521 accel_zero_along = Integer.parseInt(bits[3]);
522 accel_zero_across = Integer.parseInt(bits[5]);
523 accel_zero_through = Integer.parseInt(bits[7]);
526 } catch (Exception e) {}
528 /* Fix accel cal as soon as all of the necessary values appear */
532 public AltosConfigData() {
536 private void read_link(AltosLink link, String finished) throws InterruptedException, TimeoutException {
538 String line = link.get_reply();
540 throw new TimeoutException();
541 if (line.contains("Syntax error"))
543 this.parse_line(line);
545 /* signals the end of the version info */
546 if (line.startsWith(finished))
551 public boolean has_frequency() {
552 return radio_frequency != AltosLib.MISSING || radio_setting != AltosLib.MISSING || radio_channel != AltosLib.MISSING;
555 public boolean has_telemetry_rate() {
556 return telemetry_rate != AltosLib.MISSING;
559 public void set_frequency(double freq) {
560 int frequency = radio_frequency;
561 int setting = radio_setting;
563 if (frequency != AltosLib.MISSING) {
564 radio_frequency = (int) Math.floor (freq * 1000 + 0.5);
565 radio_channel = AltosLib.MISSING;
566 } else if (setting != AltosLib.MISSING) {
567 radio_setting =AltosConvert.radio_frequency_to_setting(freq, radio_calibration);
568 radio_channel = AltosLib.MISSING;
570 radio_channel = AltosConvert.radio_frequency_to_channel(freq);
574 public double frequency() {
575 int channel = radio_channel;
576 int setting = radio_setting;
578 if (radio_frequency == AltosLib.MISSING && channel == AltosLib.MISSING && setting == AltosLib.MISSING)
579 return AltosLib.MISSING;
581 if (channel == AltosLib.MISSING)
583 if (setting == AltosLib.MISSING)
586 return AltosConvert.radio_to_frequency(radio_frequency,
592 boolean use_flash_for_config() {
593 if (product.startsWith("TeleMega"))
595 if (product.startsWith("TeleMetrum-v2"))
597 if (product.startsWith("TeleMetrum-v3"))
599 if (product.startsWith("EasyMega"))
605 public boolean mma655x_inverted() throws AltosUnknownProduct {
606 if (product != null) {
607 if (product.startsWith("EasyMega-v1"))
609 if (product.startsWith("TeleMetrum-v2"))
611 if (product.startsWith("TeleMega-v2"))
613 if (product.startsWith("TeleMega-v1"))
616 throw new AltosUnknownProduct(product);
619 public boolean adxl375_inverted() throws AltosUnknownProduct {
620 if (product != null) {
621 if (product.startsWith("EasyMega-v2"))
623 if (product.startsWith("TeleMetrum-v3"))
625 if (product.startsWith("TeleMega-v4"))
628 throw new AltosUnknownProduct(product);
631 public int adxl375_axis() throws AltosUnknownProduct {
632 if (product != null) {
633 if (product.startsWith("EasyMega-v2"))
634 return AltosAdxl375.X_AXIS;
635 if (product.startsWith("TeleMetrum-v3"))
636 return AltosAdxl375.X_AXIS;
637 if (product.startsWith("TeleMega-v4"))
638 return AltosAdxl375.X_AXIS;
640 throw new AltosUnknownProduct(product);
643 public void get_values(AltosConfigValues source) throws AltosConfigDataException {
646 if (main_deploy != AltosLib.MISSING)
647 main_deploy = source.main_deploy();
648 if (apogee_delay != AltosLib.MISSING)
649 apogee_delay = source.apogee_delay();
650 if (apogee_lockout != AltosLib.MISSING)
651 apogee_lockout = source.apogee_lockout();
655 set_frequency(source.radio_frequency());
656 if (radio_enable != AltosLib.MISSING)
657 radio_enable = source.radio_enable();
658 if (callsign != null)
659 callsign = source.callsign();
660 if (telemetry_rate != AltosLib.MISSING)
661 telemetry_rate = source.telemetry_rate();
664 if (pad_orientation != AltosLib.MISSING)
665 pad_orientation = source.pad_orientation();
667 if (accel_cal_plus_cooked != AltosLib.MISSING)
668 accel_cal_plus_cooked = source.accel_cal_plus();
670 if (accel_cal_minus_cooked != AltosLib.MISSING)
671 accel_cal_minus_cooked = source.accel_cal_minus();
674 if (flight_log_max != AltosLib.MISSING)
675 flight_log_max = source.flight_log_max();
678 if (ignite_mode != AltosLib.MISSING)
679 ignite_mode = source.ignite_mode();
682 if (npyro != AltosLib.MISSING)
683 pyros = source.pyros();
684 if (pyro_firing_time != AltosLib.MISSING)
685 pyro_firing_time = source.pyro_firing_time();
688 if (aprs_interval != AltosLib.MISSING)
689 aprs_interval = source.aprs_interval();
690 if (aprs_ssid != AltosLib.MISSING)
691 aprs_ssid = source.aprs_ssid();
692 if (aprs_format != AltosLib.MISSING)
693 aprs_format = source.aprs_format();
694 if (aprs_offset != AltosLib.MISSING)
695 aprs_offset = source.aprs_offset();
698 if (beep != AltosLib.MISSING)
699 beep = source.beep();
701 if (tracker_motion != AltosLib.MISSING)
702 tracker_motion = source.tracker_motion();
703 if (tracker_interval != AltosLib.MISSING)
704 tracker_interval = source.tracker_interval();
707 public void set_values(AltosConfigValues dest) {
708 dest.set_serial(serial);
709 dest.set_product(product);
710 dest.set_version(version);
711 dest.set_altitude_32(altitude_32);
712 dest.set_main_deploy(main_deploy);
713 dest.set_apogee_delay(apogee_delay);
714 dest.set_apogee_lockout(apogee_lockout);
715 dest.set_radio_calibration(radio_calibration);
716 dest.set_radio_frequency(frequency());
717 dest.set_telemetry_rate(telemetry_rate);
718 boolean max_enabled = true;
720 if (log_space() == 0)
723 if (log_fixed != AltosLib.MISSING)
726 switch (log_format) {
727 case AltosLib.AO_LOG_FORMAT_TINY:
736 dest.set_flight_log_max_enabled(max_enabled);
737 dest.set_radio_enable(radio_enable);
738 dest.set_flight_log_max_limit(log_space() >> 10, storage_erase_unit >> 10);
739 dest.set_flight_log_max(flight_log_max);
740 dest.set_ignite_mode(ignite_mode);
741 dest.set_pad_orientation(pad_orientation);
742 dest.set_accel_cal(accel_cal_plus(AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP),
743 accel_cal_minus(AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP));
744 dest.set_callsign(callsign);
745 if (npyro != AltosLib.MISSING)
746 dest.set_pyros(pyros);
748 dest.set_pyros(null);
749 dest.set_pyro_firing_time(pyro_firing_time);
750 dest.set_aprs_interval(aprs_interval);
751 dest.set_aprs_ssid(aprs_ssid);
752 dest.set_aprs_format(aprs_format);
753 dest.set_aprs_offset(aprs_offset);
755 dest.set_tracker_motion(tracker_motion);
756 dest.set_tracker_interval(tracker_interval);
759 public boolean log_has_state() {
760 switch (log_format) {
761 case AltosLib.AO_LOG_FORMAT_TELEGPS:
767 public void save(AltosLink link, boolean remote) throws InterruptedException, TimeoutException {
770 if (main_deploy != AltosLib.MISSING)
771 link.printf("c m %d\n", main_deploy);
772 if (apogee_delay != AltosLib.MISSING)
773 link.printf("c d %d\n", apogee_delay);
774 if (apogee_lockout != AltosLib.MISSING)
775 link.printf("c L %d\n", apogee_lockout);
778 if (has_frequency()) {
779 boolean has_frequency = radio_frequency != AltosLib.MISSING;
780 boolean has_setting = radio_setting != AltosLib.MISSING;
781 double frequency = frequency();
782 link.set_radio_frequency(frequency,
786 /* When remote, reset the dongle frequency at the same time */
790 link.set_radio_frequency(frequency);
796 if (telemetry_rate != AltosLib.MISSING) {
797 link.printf("c T %d\n", telemetry_rate);
801 link.set_telemetry_rate(telemetry_rate);
807 if (callsign != null) {
808 link.printf("c c %s\n", callsign);
812 link.set_callsign(callsign);
818 if (radio_enable != AltosLib.MISSING)
819 link.printf("c e %d\n", radio_enable);
822 /* set orientation first so that we know how to set the accel cal */
823 if (pad_orientation != AltosLib.MISSING)
824 link.printf("c o %d\n", pad_orientation);
825 int plus = accel_cal_plus(pad_orientation);
826 int minus = accel_cal_minus(pad_orientation);
827 if (plus != AltosLib.MISSING && minus != AltosLib.MISSING)
828 link.printf("c a %d %d\n", plus, minus);
831 if (flight_log_max != 0 && flight_log_max != AltosLib.MISSING)
832 link.printf("c l %d\n", flight_log_max);
835 if (ignite_mode != AltosLib.MISSING)
836 link.printf("c i %d\n", ignite_mode);
839 /* UI doesn't support AES key config */
842 if (npyro != AltosLib.MISSING) {
843 for (int p = 0; p < pyros.length; p++) {
844 link.printf("c P %s\n",
845 pyros[p].toString());
848 if (pyro_firing_time != AltosLib.MISSING)
849 link.printf("c I %d\n", (int) (pyro_firing_time * 100.0 + 0.5));
852 if (aprs_interval != AltosLib.MISSING)
853 link.printf("c A %d\n", aprs_interval);
854 if (aprs_ssid != AltosLib.MISSING)
855 link.printf("c S %d\n", aprs_ssid);
856 if (aprs_format != AltosLib.MISSING)
857 link.printf("c C %d\n", aprs_format);
858 if (aprs_offset != AltosLib.MISSING)
859 link.printf("c O %d\n", aprs_offset);
862 if (beep != AltosLib.MISSING)
863 link.printf("c b %d\n", beep);
866 if (tracker_motion != AltosLib.MISSING && tracker_interval != AltosLib.MISSING)
867 link.printf("c t %d %d\n", tracker_motion, tracker_interval);
870 /* UI doesn't support accel cal */
872 link.printf("c w\n");
876 public AltosConfigData(AltosLink link) throws InterruptedException, TimeoutException {
878 link.printf("c s\nf\nv\n");
879 read_link(link, "software-version");
880 switch (log_format) {
881 case AltosLib.AO_LOG_FORMAT_UNKNOWN:
882 case AltosLib.AO_LOG_FORMAT_NONE:
886 read_link(link, "done");