static final int AO_LOG_MANUFACTURER = 2000;
static final int AO_LOG_PRODUCT = 2001;
static final int AO_LOG_SERIAL_NUMBER = 2002;
+ static final int AO_LOG_LOG_FORMAT = 2003;
static final int AO_LOG_SOFTWARE_VERSION = 9999;
/* Added to flag invalid records */
static final int AO_GPS_NUM_SAT_SHIFT = 0;
static final int AO_GPS_NUM_SAT_MASK = 0xf;
+ static final int AO_LOG_FORMAT_UNKNOWN = 0;
+ static final int AO_LOG_FORMAT_FULL = 1;
+ static final int AO_LOG_FORMAT_TINY = 2;
+ static final int AO_LOG_FORMAT_TELEMETRY = 3;
+ static final int AO_LOG_FORMAT_TELESCIENCE = 4;
+ static final int AO_LOG_FORMAT_NONE = 127;
+
static boolean isspace(int c) {
switch (c) {
case ' ':
return 0x000e;
}
+ static int usb_product_telelaunch() {
+ load_library();
+ return 0x000f;
+ }
+
+ static int usb_product_telelco() {
+ load_library();
+ return 0x0010;
+ }
+
+ static int usb_product_telescience() {
+ load_library();
+ return 0x0011;
+ }
+
+ static int usb_product_telepyro() {
+ load_library();
+ return 0x0012;
+ }
+
public final static int vendor_altusmetrum = usb_vendor_altusmetrum();
public final static int product_altusmetrum = usb_product_altusmetrum();
public final static int product_telemetrum = usb_product_telemetrum();
public final static int product_teledongle = usb_product_teledongle();
public final static int product_teleterra = usb_product_teleterra();
public final static int product_telebt = usb_product_telebt();
+ public final static int product_telelaunch = usb_product_telelaunch();
+ public final static int product_tele10 = usb_product_telelco();
+ public final static int product_telescience = usb_product_telescience();
+ public final static int product_telepyro = usb_product_telepyro();
public final static int product_altusmetrum_min = usb_product_altusmetrum_min();
public final static int product_altusmetrum_max = usb_product_altusmetrum_max();
AltosConfigData remote_config_data;
double remote_frequency;
int_ref serial;
+ int_ref log_format;
int_ref main_deploy;
int_ref apogee_delay;
int_ref radio_channel;
return;
}
get_int(line, "serial-number", serial);
+ get_int(line, "log-format", log_format);
get_int(line, "Main deploy:", main_deploy);
get_int(line, "Apogee delay:", apogee_delay);
get_int(line, "Radio channel:", radio_channel);
owner = given_owner;
serial = new int_ref(0);
+ log_format = new int_ref(Altos.AO_LOG_FORMAT_UNKNOWN);
main_deploy = new int_ref(250);
apogee_delay = new int_ref(0);
radio_channel = new int_ref(0);
String manufacturer;
String product;
String version;
+ int log_format;
int serial;
/* Strings returned */
continue;
lines.add(line);
try { serial = get_int(line, "serial-number"); } catch (Exception e) {}
+ try { log_format = get_int(line, "log-format"); } catch (Exception e) {}
try { main_deploy = get_int(line, "Main deploy:"); } catch (Exception e) {}
try { apogee_delay = get_int(line, "Apogee delay:"); } catch (Exception e) {}
try { radio_channel = get_int(line, "Radio channel:"); } catch (Exception e) {}
}
}
- static final int log_full = 1;
- static final int log_tiny = 2;
-
boolean done;
int state;
void CaptureLog(AltosEepromLog log) throws IOException, InterruptedException, TimeoutException {
int block, state_block = 0;
- int log_style = 0;
+ int log_format = flights.config_data.log_format;
state = 0;
done = false;
AltosEepromChunk eechunk = new AltosEepromChunk(serial_line, block);
/*
- * Figure out what kind of data is there
+ * Guess what kind of data is there if the device
+ * didn't tell us
*/
- if (block == log.start_block) {
- if (eechunk.data(0) == Altos.AO_LOG_FLIGHT)
- log_style = log_full;
- else
- log_style = log_tiny;
+ if (log_format == Altos.AO_LOG_FORMAT_UNKNOWN) {
+ if (block == log.start_block) {
+ if (eechunk.data(0) == Altos.AO_LOG_FLIGHT)
+ log_format = Altos.AO_LOG_FORMAT_FULL;
+ else
+ log_format = Altos.AO_LOG_FORMAT_TINY;
+ }
}
- switch (log_style) {
- case log_full:
+ switch (log_format) {
+ case Altos.AO_LOG_FORMAT_FULL:
CaptureFull(eechunk);
break;
- case log_tiny:
+ case Altos.AO_LOG_FORMAT_TINY:
CaptureTiny(eechunk);
break;
}
} else if (tokens[0].equals("serial-number")) {
cmd = Altos.AO_LOG_SERIAL_NUMBER;
a = Integer.parseInt(tokens[1]);
+ } else if (tokens[0].equals("log-format")) {
+ cmd = Altos.AO_LOG_LOG_FORMAT;
+ a = Integer.parseInt(tokens[1]);
} else if (tokens[0].equals("software-version")) {
cmd = Altos.AO_LOG_SOFTWARE_VERSION;
data = tokens[1];
/* required functions from the underlying log system */
+#define AO_LOG_FORMAT_UNKNOWN 0 /* unknown; altosui will have to guess */
+#define AO_LOG_FORMAT_FULL 1 /* 8 byte typed log records */
+#define AO_LOG_FORMAT_TINY 2 /* two byte state/baro records */
+#define AO_LOG_FORMAT_TELEMETRY 3 /* 32 byte ao_telemetry records */
+#define AO_LOG_FORMAT_TELESCIENCE 4 /* 32 byte typed telescience records */
+#define AO_LOG_FORMAT_NONE 127 /* No log at all */
+
+extern __code uint8_t ao_log_format;
+
/* Return the flight number from the given log slot, 0 if none */
uint16_t
ao_log_flight(uint8_t slot);
printf("manufacturer %s\n", ao_manufacturer);
printf("product %s\n", ao_product);
printf("serial-number %u\n", ao_serial_number);
+#if HAS_EEPROM
+ printf("log-format %u\n", ao_log_format);
+#endif
printf("software-version %s\n", ao_version);
}
__pdata enum flight_state ao_log_state;
__xdata uint16_t ao_flight_number;
+__code uint8_t ao_log_format = AO_LOG_FORMAT_FULL;
+
void
ao_log_flush(void)
{
#define AO_PAD_RING 2
#endif
+__code uint8_t ao_log_format = AO_LOG_FORMAT_TINY;
+
void
ao_log_tiny_set_interval(uint16_t ticks)
{
#include "ao.h"
+__code uint8_t ao_log_format = AO_LOG_FORMAT_NONE; /* until we actually log stuff */
+
void
main(void)
{