string_to_state.put("fast", ao_flight_fast);
string_to_state.put("coast", ao_flight_coast);
string_to_state.put("drogue", ao_flight_drogue);
+ string_to_state.put("apogee", ao_flight_coast);
string_to_state.put("main", ao_flight_main);
string_to_state.put("landed", ao_flight_landed);
string_to_state.put("invalid", ao_flight_invalid);
int_ref radio_setting;
int_ref storage_size;
int_ref storage_erase_unit;
+ int_ref stored_flight;
+ int_ref radio_enable;
string_ref version;
string_ref product;
string_ref callsign;
config_ui.set_apogee_delay(apogee_delay.get());
config_ui.set_radio_calibration(radio_calibration.get());
config_ui.set_radio_frequency(frequency());
+ config_ui.set_flight_log_max_enabled(stored_flight.get() < 0);
+ config_ui.set_radio_enable(radio_enable.get());
config_ui.set_flight_log_max_limit(log_limit());
config_ui.set_flight_log_max(flight_log_max.get());
config_ui.set_ignite_mode(ignite_mode.get());
get_int(line, "Ignite mode:", ignite_mode);
get_int(line, "Pad orientation:", pad_orientation);
get_int(line, "Radio setting:", radio_setting);
+ get_int(line, "Radio enable:", radio_enable);
get_int(line, "Storage size:", storage_size);
get_int(line, "Storage erase unit:", storage_erase_unit);
+ get_int(line, "flight", stored_flight);
get_string(line, "Callsign:", callsign);
get_string(line,"software-version", version);
get_string(line,"product", product);
void get_data() {
try {
config.start_serial();
- config.serial_line.printf("c s\nf\nv\n");
+ stored_flight.set(-1);
+ config.serial_line.printf("c s\nf\nl\nv\n");
for (;;) {
try {
String line = config.serial_line.get_reply(5000);
serial_line.printf("c c %s\n", callsign.get());
if (flight_log_max.get() != 0)
serial_line.printf("c l %d\n", flight_log_max.get());
+ if (radio_enable.get() >= 0)
+ serial_line.printf("c e %d\n", radio_enable.get());
if (ignite_mode.get() >= 0)
serial_line.printf("c i %d\n", ignite_mode.get());
if (pad_orientation.get() >= 0)
radio_calibration.set(config_ui.radio_calibration());
set_frequency(config_ui.radio_frequency());
flight_log_max.set(config_ui.flight_log_max());
+ if (radio_enable.get() >= 0)
+ radio_enable.set(config_ui.radio_enable());
if (ignite_mode.get() >= 0)
ignite_mode.set(config_ui.ignite_mode());
if (pad_orientation.get() >= 0)
radio_channel = new int_ref(0);
radio_setting = new int_ref(0);
radio_calibration = new int_ref(1186611);
+ radio_enable = new int_ref(-1);
flight_log_max = new int_ref(0);
ignite_mode = new int_ref(-1);
pad_orientation = new int_ref(-1);
storage_size = new int_ref(-1);
storage_erase_unit = new int_ref(-1);
+ stored_flight = new int_ref(-1);
callsign = new string_ref("N0CALL");
version = new string_ref("unknown");
product = new string_ref("unknown");
JLabel frequency_label;
JLabel radio_calibration_label;
JLabel radio_frequency_label;
+ JLabel radio_enable_label;
JLabel flight_log_max_label;
JLabel ignite_mode_label;
JLabel pad_orientation_label;
JComboBox apogee_delay_value;
AltosFreqList radio_frequency_value;
JTextField radio_calibration_value;
+ JRadioButton radio_enable_value;
JComboBox flight_log_max_value;
JComboBox ignite_mode_value;
JComboBox pad_orientation_value;
radio_calibration_value.setEnabled(false);
pane.add(radio_calibration_value, c);
- /* Callsign */
+ /* Radio Enable */
c = new GridBagConstraints();
c.gridx = 0; c.gridy = 7;
c.gridwidth = 4;
c.anchor = GridBagConstraints.LINE_START;
c.insets = il;
c.ipady = 5;
+ radio_enable_label = new JLabel("Telemetry/RDF Enable:");
+ pane.add(radio_enable_label, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 4; c.gridy = 7;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = ir;
+ c.ipady = 5;
+ radio_enable_value = new JRadioButton("Enabled");
+ radio_enable_value.addItemListener(this);
+ pane.add(radio_enable_value, c);
+
+ /* Callsign */
+ c = new GridBagConstraints();
+ c.gridx = 0; c.gridy = 8;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = il;
+ c.ipady = 5;
callsign_label = new JLabel("Callsign:");
pane.add(callsign_label, c);
c = new GridBagConstraints();
- c.gridx = 4; c.gridy = 7;
+ c.gridx = 4; c.gridy = 8;
c.gridwidth = 4;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1;
/* Flight log max */
c = new GridBagConstraints();
- c.gridx = 0; c.gridy = 8;
+ c.gridx = 0; c.gridy = 9;
c.gridwidth = 4;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.LINE_START;
pane.add(flight_log_max_label, c);
c = new GridBagConstraints();
- c.gridx = 4; c.gridy = 8;
+ c.gridx = 4; c.gridy = 9;
c.gridwidth = 4;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1;
/* Ignite mode */
c = new GridBagConstraints();
- c.gridx = 0; c.gridy = 9;
+ c.gridx = 0; c.gridy = 10;
c.gridwidth = 4;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.LINE_START;
pane.add(ignite_mode_label, c);
c = new GridBagConstraints();
- c.gridx = 4; c.gridy = 9;
+ c.gridx = 4; c.gridy = 10;
c.gridwidth = 4;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1;
/* Pad orientation */
c = new GridBagConstraints();
- c.gridx = 0; c.gridy = 10;
+ c.gridx = 0; c.gridy = 11;
c.gridwidth = 4;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.LINE_START;
pane.add(pad_orientation_label, c);
c = new GridBagConstraints();
- c.gridx = 4; c.gridy = 10;
+ c.gridx = 4; c.gridy = 11;
c.gridwidth = 4;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1;
/* Buttons */
c = new GridBagConstraints();
- c.gridx = 0; c.gridy = 11;
+ c.gridx = 0; c.gridy = 12;
c.gridwidth = 2;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.LINE_START;
save.setActionCommand("Save");
c = new GridBagConstraints();
- c.gridx = 2; c.gridy = 11;
+ c.gridx = 2; c.gridy = 12;
c.gridwidth = 2;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.CENTER;
reset.setActionCommand("Reset");
c = new GridBagConstraints();
- c.gridx = 4; c.gridy = 11;
+ c.gridx = 4; c.gridy = 12;
c.gridwidth = 2;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.CENTER;
reboot.setActionCommand("Reboot");
c = new GridBagConstraints();
- c.gridx = 6; c.gridy = 11;
+ c.gridx = 6; c.gridy = 12;
c.gridwidth = 2;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.LINE_END;
return Integer.parseInt(radio_calibration_value.getText());
}
+ public void set_radio_enable(int new_radio_enable) {
+ if (new_radio_enable >= 0)
+ radio_enable_value.setSelected(new_radio_enable > 0);
+ else {
+ radio_enable_value.setSelected(true);
+ radio_enable_value.setEnabled(false);
+ }
+ }
+
+ public int radio_enable() {
+ if (radio_enable_value.isEnabled())
+ return radio_enable_value.isSelected() ? 1 : 0;
+ else
+ return -1;
+ }
+
public void set_callsign(String new_callsign) {
callsign_value.setText(new_callsign);
}
flight_log_max_value.setSelectedItem(Integer.toString(new_flight_log_max));
}
+ public void set_flight_log_max_enabled(boolean enable) {
+ flight_log_max_value.setEnabled(enable);
+ }
+
public int flight_log_max() {
return Integer.parseInt(flight_log_max_value.getSelectedItem().toString());
}
Main main;
+ class LoggingReady extends LaunchStatus {
+ void show (AltosState state, int crc_errors) {
+ show();
+ if (state.data.flight != 0) {
+ if (state.data.state <= Altos.ao_flight_pad)
+ value.setText("Ready to record");
+ else if (state.data.state < Altos.ao_flight_landed)
+ value.setText("Recording data");
+ else
+ value.setText("Recorded data");
+ }
+ else
+ value.setText("Storage full");
+ lights.set(state.data.flight != 0);
+ }
+ public LoggingReady (GridBagLayout layout, int y) {
+ super(layout, y, "On-board Data Logging");
+ }
+ }
+
+ LoggingReady logging_ready;
+
class GPSLocked extends LaunchStatus {
void show (AltosState state, int crc_errors) {
show();
battery.reset();
apogee.reset();
main.reset();
+ logging_ready.reset();
gps_locked.reset();
gps_ready.reset();
pad_lat.reset();
main.hide();
else
main.show(state, crc_errors);
+ logging_ready.show(state, crc_errors);
pad_alt.show(state, crc_errors);
if (state.gps != null && state.gps.connected) {
gps_locked.show(state, crc_errors);
battery = new Battery(layout, 0);
apogee = new Apogee(layout, 1);
main = new Main(layout, 2);
- gps_locked = new GPSLocked(layout, 3);
- gps_ready = new GPSReady(layout, 4);
- pad_lat = new PadLat(layout, 5);
- pad_lon = new PadLon(layout, 6);
- pad_alt = new PadAlt(layout, 7);
+ logging_ready = new LoggingReady(layout, 3);
+ gps_locked = new GPSLocked(layout, 4);
+ gps_ready = new GPSReady(layout, 5);
+ pad_lat = new PadLat(layout, 6);
+ pad_lon = new PadLon(layout, 7);
+ pad_alt = new PadAlt(layout, 8);
}
}
}
}
+ static final int process_none = 0;
static final int process_csv = 1;
static final int process_kml = 2;
+ static final int process_graph = 3;
+ static final int process_replay = 4;
- static void process_file(String input, int process) {
+ static void process_csv(String input) {
AltosRecordIterable iterable = open_logfile(input);
if (iterable == null)
return;
- if (process == 0)
- process = process_csv;
- if ((process & process_csv) != 0) {
- String output = Altos.replace_extension(input,".csv");
- System.out.printf("Processing \"%s\" to \"%s\"\n", input, output);
- if (input.equals(output)) {
- System.out.printf("Not processing '%s'\n", input);
- } else {
- AltosWriter writer = open_csv("/dev/stdout");
- if (writer != null) {
- writer.write(iterable);
- writer.close();
- }
- }
+
+ String output = Altos.replace_extension(input,".csv");
+ System.out.printf("Processing \"%s\" to \"%s\"\n", input, output);
+ if (input.equals(output)) {
+ System.out.printf("Not processing '%s'\n", input);
+ } else {
+ AltosWriter writer = open_csv(output);
+ if (writer == null)
+ return;
+ writer.write(iterable);
+ writer.close();
}
- if ((process & process_kml) != 0) {
- String output = Altos.replace_extension(input,".kml");
- System.out.printf("Processing \"%s\" to \"%s\"\n", input, output);
- if (input.equals(output)) {
- System.out.printf("Not processing '%s'\n", input);
- } else {
- AltosWriter writer = open_kml(output);
- if (writer == null)
- return;
- writer.write(iterable);
- writer.close();
- }
+ }
+
+ static void process_kml(String input) {
+ AltosRecordIterable iterable = open_logfile(input);
+ if (iterable == null)
+ return;
+
+ String output = Altos.replace_extension(input,".kml");
+ System.out.printf("Processing \"%s\" to \"%s\"\n", input, output);
+ if (input.equals(output)) {
+ System.out.printf("Not processing '%s'\n", input);
+ } else {
+ AltosWriter writer = open_kml(output);
+ if (writer == null)
+ return;
+ writer.write(iterable);
+ writer.close();
}
}
- public static void main(final String[] args) {
- int process = 0;
- /* Handle batch-mode */
- if (args.length == 1 && args[0].equals("--help")) {
+ static void process_replay(String filename) {
+ FileInputStream in;
+ try {
+ in = new FileInputStream(filename);
+ } catch (Exception e) {
+ System.out.printf("Failed to open file '%s'\n", filename);
+ return;
+ }
+ AltosRecordIterable recs;
+ AltosReplayReader reader;
+ if (filename.endsWith("eeprom")) {
+ recs = new AltosEepromIterable(in);
+ } else {
+ recs = new AltosTelemetryIterable(in);
+ }
+ reader = new AltosReplayReader(recs.iterator(), new File(filename));
+ AltosFlightUI flight_ui = new AltosFlightUI(new AltosVoice(), reader);
+ flight_ui.set_exit_on_close();
+ }
+
+ static void process_graph(String filename) {
+ FileInputStream in;
+ try {
+ in = new FileInputStream(filename);
+ } catch (Exception e) {
+ System.out.printf("Failed to open file '%s'\n", filename);
+ return;
+ }
+ AltosRecordIterable recs;
+ if (filename.endsWith("eeprom")) {
+ recs = new AltosEepromIterable(in);
+ } else {
+ recs = new AltosTelemetryIterable(in);
+ }
+ try {
+ new AltosGraphUI(recs);
+ } catch (InterruptedException ie) {
+ } catch (IOException ie) {
+ }
+ }
+
+ public static void help(int code) {
System.out.printf("Usage: altosui [OPTION]... [FILE]...\n");
System.out.printf(" Options:\n");
System.out.printf(" --fetchmaps <lat> <lon>\tpre-fetch maps for site map view\n");
System.out.printf(" --replay <filename>\t\trelive the glory of past flights \n");
+ System.out.printf(" --graph <filename>\t\tgraph a flight\n");
System.out.printf(" --csv\tgenerate comma separated output for spreadsheets, etc\n");
System.out.printf(" --kml\tgenerate KML output for use with Google Earth\n");
- } else if (args.length == 3 && args[0].equals("--fetchmaps")) {
- double lat = Double.parseDouble(args[1]);
- double lon = Double.parseDouble(args[2]);
- AltosSiteMap.prefetchMaps(lat, lon, 5, 5);
- } else if (args.length == 2 && args[0].equals("--replay")) {
- String filename = args[1];
- FileInputStream in;
- try {
- in = new FileInputStream(filename);
- } catch (Exception e) {
- System.out.printf("Failed to open file '%s'\n", filename);
- return;
- }
- AltosRecordIterable recs;
- AltosReplayReader reader;
- if (filename.endsWith("eeprom")) {
- recs = new AltosEepromIterable(in);
- } else {
- recs = new AltosTelemetryIterable(in);
- }
- reader = new AltosReplayReader(recs.iterator(), new File(filename));
- AltosFlightUI flight_ui = new AltosFlightUI(new AltosVoice(), reader);
- flight_ui.set_exit_on_close();
- return;
- } else if (args.length > 0) {
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("--kml"))
- process |= process_kml;
- else if (args[i].equals("--csv"))
- process |= process_csv;
- else
- process_file(args[i], process);
- }
- } else {
+ System.exit(code);
+ }
+
+ public static void main(final String[] args) {
+ /* Handle batch-mode */
+ if (args.length == 0) {
AltosUI altosui = new AltosUI();
altosui.setVisible(true);
java.util.List<AltosDevice> devices = AltosUSBDevice.list(Altos.product_basestation);
for (AltosDevice device : devices)
altosui.telemetry_window(device);
+ } else {
+ int process = process_none;
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("--help"))
+ help(0);
+ else if (args[i].equals("--fetchmaps")) {
+ if (args.length < i + 3) {
+ help(1);
+ } else {
+ double lat = Double.parseDouble(args[i+1]);
+ double lon = Double.parseDouble(args[i+2]);
+ AltosSiteMap.prefetchMaps(lat, lon, 5, 5);
+ i += 2;
+ }
+ } else if (args[i].equals("--replay"))
+ process = process_replay;
+ else if (args[i].equals("--kml"))
+ process = process_kml;
+ else if (args[i].equals("--csv"))
+ process = process_csv;
+ else if (args[i].equals("--graph"))
+ process = process_graph;
+ else if (args[i].startsWith("--"))
+ help(1);
+ else {
+ switch (process) {
+ case process_none:
+ case process_graph:
+ process_graph(args[i]);
+ break;
+ case process_replay:
+ process_replay(args[i]);
+ break;
+ case process_kml:
+ process_kml(args[i]);
+ break;
+ case process_csv:
+ process_csv(args[i]);
+ break;
+ }
+ }
+ }
}
}
}
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
-AC_INIT([altos], 0.9.6.0)
+AC_INIT([altos], 0.9.7.0)
AC_CONFIG_SRCDIR([src/ao.h])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
*/
#define AO_CONFIG_MAJOR 1
-#define AO_CONFIG_MINOR 7
+#define AO_CONFIG_MINOR 8
struct ao_config {
uint8_t major;
uint8_t ignite_mode; /* minor version 5 */
uint8_t pad_orientation; /* minor version 6 */
uint32_t radio_setting; /* minor version 7 */
+ uint8_t radio_enable; /* minor version 8 */
};
#define AO_IGNITE_MODE_DUAL 0
ao_config.pad_orientation = AO_CONFIG_DEFAULT_PAD_ORIENTATION;
if (ao_config.minor < 7)
ao_config.radio_setting = ao_config.radio_cal;
+ if (ao_config.minor < 8)
+ ao_config.radio_enable = TRUE;
ao_config.minor = AO_CONFIG_MINOR;
ao_config_dirty = 1;
}
ao_config_loaded = 1;
}
-void
-ao_config_get(void)
+static void
+_ao_config_edit_start(void)
{
ao_mutex_get(&ao_config_mutex);
_ao_config_get();
+}
+
+static void
+_ao_config_edit_finish(void)
+{
+ ao_config_dirty = 1;
+ ao_mutex_put(&ao_config_mutex);
+}
+
+void
+ao_config_get(void)
+{
+ _ao_config_edit_start();
ao_mutex_put(&ao_config_mutex);
}
}
if (ao_cmd_status != ao_cmd_success)
return;
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
memcpy(&ao_config.callsign, &callsign,
AO_MAX_CALLSIGN + 1);
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_callsign_show();
+ _ao_config_edit_finish();
}
void
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
ao_config.radio_channel = ao_cmd_lex_i;
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_radio_channel_show();
+ _ao_config_edit_finish();
ao_radio_recv_abort();
}
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
ao_config.main_deploy = ao_cmd_lex_i;
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_main_deploy_show();
+ _ao_config_edit_finish();
}
#if HAS_ACCEL
up, down);
return;
}
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
ao_config.accel_plus_g = up;
ao_config.accel_minus_g = down;
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_accel_calibrate_show();
+ _ao_config_edit_finish();
}
#endif /* HAS_ACCEL */
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
ao_config.apogee_delay = ao_cmd_lex_i;
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_apogee_delay_show();
+ _ao_config_edit_finish();
}
#endif /* HAS_ADC */
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
ao_config.radio_setting = ao_config.radio_cal = ao_cmd_lex_u32;
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_radio_cal_show();
+ _ao_config_edit_finish();
}
#if HAS_EEPROM
else if (ao_cmd_lex_i > config)
printf("Flight log max %d kB\n", config);
else {
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
ao_config.flight_log_max = (uint32_t) ao_cmd_lex_i << 10;
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_log_show();
+ _ao_config_edit_finish();
}
}
#endif /* HAS_EEPROM */
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
ao_config.ignite_mode = ao_cmd_lex_i;
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_ignite_mode_show();
+ _ao_config_edit_finish();
}
#endif
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
ao_cmd_lex_i &= 1;
if (ao_config.pad_orientation != ao_cmd_lex_i) {
uint16_t t;
ao_config.accel_minus_g = 0x7fff - t;
}
ao_config.pad_orientation = ao_cmd_lex_i;
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_pad_orientation_show();
+ _ao_config_edit_finish();
}
#endif
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- ao_mutex_get(&ao_config_mutex);
- _ao_config_get();
+ _ao_config_edit_start();
ao_config.radio_setting = ao_cmd_lex_u32;
ao_config.radio_channel = 0;
- ao_config_dirty = 1;
- ao_mutex_put(&ao_config_mutex);
- ao_config_radio_setting_show();
+ _ao_config_edit_finish();
ao_radio_recv_abort();
}
+void
+ao_config_radio_enable_show(void) __reentrant
+{
+ printf("Radio enable: %d\n", ao_config.radio_enable);
+}
+
+void
+ao_config_radio_enable_set(void) __reentrant
+{
+ ao_cmd_decimal();
+ if (ao_cmd_status != ao_cmd_success)
+ return;
+ _ao_config_edit_start();
+ ao_config.radio_enable = ao_cmd_lex_i;
+ _ao_config_edit_finish();
+}
+
struct ao_config_var {
__code char *str;
void (*set)(void) __reentrant;
ao_config_radio_channel_set, ao_config_radio_channel_show },
{ "c <call>\0Callsign (8 char max)",
ao_config_callsign_set, ao_config_callsign_show },
+ { "R <setting>\0Radio freq control (freq = 434.550 * setting/cal)",
+ ao_config_radio_setting_set, ao_config_radio_setting_show },
+ { "e <0 disable, 1 enable>\0Enable telemetry and RDF",
+ ao_config_radio_enable_set, ao_config_radio_enable_show },
#if HAS_ACCEL
{ "a <+g> <-g>\0Accel calib (0 for auto)",
ao_config_accel_calibrate_set,ao_config_accel_calibrate_show },
{ "o <0 antenna up, 1 antenna down>\0Set pad orientation",
ao_config_pad_orientation_set,ao_config_pad_orientation_show },
#endif
- { "R <setting>\0Radio freq control (freq = 434.550 * setting/cal)",
- ao_config_radio_setting_set, ao_config_radio_setting_show },
{ "s\0Show",
- ao_config_show, ao_config_show },
+ ao_config_show, 0 },
#if HAS_EEPROM
{ "w\0Write to eeprom",
- ao_config_write, ao_config_write },
+ ao_config_write, 0 },
#endif
{ "?\0Help",
- ao_config_help, ao_config_help },
+ ao_config_help, 0 },
{ 0, 0, 0 }
};
func = 0;
for (cmd = 0; ao_config_vars[cmd].str != NULL; cmd++)
if (ao_config_vars[cmd].str[0] == c) {
- func = ao_config_vars[cmd].set;
- break;
+ (*ao_config_vars[cmd].set)();
+ return;
}
- if (func)
- (*func)();
- else
- ao_cmd_status = ao_cmd_syntax_error;
+ ao_cmd_status = ao_cmd_syntax_error;
}
static void
printf("Config version: %d.%d\n",
ao_config.major, ao_config.minor);
for (cmd = 0; ao_config_vars[cmd].str != NULL; cmd++)
- if (ao_config_vars[cmd].show != ao_config_vars[cmd].set)
+ if (ao_config_vars[cmd].show)
(*ao_config_vars[cmd].show)();
}
{
telemetry.generic.type = AO_TELEMETRY_CONFIGURATION;
telemetry.configuration.device = AO_idProduct_NUMBER;
- telemetry.configuration.flight = ao_flight_number;
+ telemetry.configuration.flight = ao_log_full() ? 0 : ao_flight_number;
telemetry.configuration.config_major = AO_CONFIG_MAJOR;
telemetry.configuration.config_minor = AO_CONFIG_MINOR;
telemetry.configuration.apogee_delay = ao_config.apogee_delay;
int16_t delay;
ao_config_get();
+ if (!ao_config.radio_enable)
+ ao_exit();
while (!ao_flight_number)
ao_sleep(&ao_flight_number);