diff options
| author | Keith Packard <keithp@keithp.com> | 2011-08-12 21:43:56 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2011-08-13 18:44:26 -0700 | 
| commit | bf06af154e232d4caa1585a1d6d5279a075292e4 (patch) | |
| tree | f3e6a4f162eef9284996b7637e360422a9b12ba5 | |
| parent | c2f2f519dbc8ce233ab36222088c1be6b1362f01 (diff) | |
altos/altosui: Report log format in the version command
This will make it easier to figure out what the contents of the flash
should look like from altosui; the current 'guessing' mechanism will
not scale to many more formats.
Signed-off-by: Keith Packard <keithp@keithp.com>
| -rw-r--r-- | altosui/Altos.java | 32 | ||||
| -rw-r--r-- | altosui/AltosConfig.java | 3 | ||||
| -rw-r--r-- | altosui/AltosConfigData.java | 2 | ||||
| -rw-r--r-- | altosui/AltosEepromDownload.java | 26 | ||||
| -rw-r--r-- | altosui/AltosEepromRecord.java | 3 | ||||
| -rw-r--r-- | src/ao.h | 9 | ||||
| -rw-r--r-- | src/ao_cmd.c | 3 | ||||
| -rw-r--r-- | src/ao_log.c | 2 | ||||
| -rw-r--r-- | src/ao_log_tiny.c | 2 | ||||
| -rw-r--r-- | src/ao_telebt.c | 2 | 
10 files changed, 71 insertions, 13 deletions
| diff --git a/altosui/Altos.java b/altosui/Altos.java index 73dc7468..416d9328 100644 --- a/altosui/Altos.java +++ b/altosui/Altos.java @@ -51,6 +51,7 @@ public class Altos {  	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 */ @@ -177,6 +178,13 @@ public class Altos {  	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 ' ': @@ -404,12 +412,36 @@ public class Altos {  		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(); diff --git a/altosui/AltosConfig.java b/altosui/AltosConfig.java index 7312ea6c..ffabe209 100644 --- a/altosui/AltosConfig.java +++ b/altosui/AltosConfig.java @@ -67,6 +67,7 @@ public class AltosConfig implements ActionListener {  	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; @@ -153,6 +154,7 @@ public class AltosConfig implements ActionListener {  			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); @@ -374,6 +376,7 @@ public class AltosConfig implements ActionListener {  		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); diff --git a/altosui/AltosConfigData.java b/altosui/AltosConfigData.java index 016033a3..710231d7 100644 --- a/altosui/AltosConfigData.java +++ b/altosui/AltosConfigData.java @@ -36,6 +36,7 @@ public class AltosConfigData implements Iterable<String> {  	String	manufacturer;  	String	product;  	String	version; +	int	log_format;  	int	serial;  	/* Strings returned */ @@ -94,6 +95,7 @@ public class AltosConfigData implements Iterable<String> {  				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) {} diff --git a/altosui/AltosEepromDownload.java b/altosui/AltosEepromDownload.java index 64dcdff7..417aab00 100644 --- a/altosui/AltosEepromDownload.java +++ b/altosui/AltosEepromDownload.java @@ -89,9 +89,6 @@ public class AltosEepromDownload implements Runnable {  		}  	} -	static final int	log_full = 1; -	static final int	log_tiny = 2; -  	boolean			done;  	int			state; @@ -186,7 +183,7 @@ public class AltosEepromDownload implements Runnable {  	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; @@ -215,21 +212,24 @@ public class AltosEepromDownload implements Runnable {  			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;  			} diff --git a/altosui/AltosEepromRecord.java b/altosui/AltosEepromRecord.java index 52acb435..c0f97035 100644 --- a/altosui/AltosEepromRecord.java +++ b/altosui/AltosEepromRecord.java @@ -143,6 +143,9 @@ public class AltosEepromRecord {  				} 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]; @@ -539,6 +539,15 @@ extern __pdata enum flight_state ao_log_state;  /* 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); diff --git a/src/ao_cmd.c b/src/ao_cmd.c index 6d3ae38d..1442ebea 100644 --- a/src/ao_cmd.c +++ b/src/ao_cmd.c @@ -219,6 +219,9 @@ version(void)  	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);  } diff --git a/src/ao_log.c b/src/ao_log.c index 80d7243d..6d3ad535 100644 --- a/src/ao_log.c +++ b/src/ao_log.c @@ -24,6 +24,8 @@ __xdata uint8_t	ao_log_running;  __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)  { diff --git a/src/ao_log_tiny.c b/src/ao_log_tiny.c index d26e0080..d5a3b99f 100644 --- a/src/ao_log_tiny.c +++ b/src/ao_log_tiny.c @@ -28,6 +28,8 @@ static __data uint16_t	ao_log_tiny_interval;  #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)  { diff --git a/src/ao_telebt.c b/src/ao_telebt.c index 8e77c4d9..85565172 100644 --- a/src/ao_telebt.c +++ b/src/ao_telebt.c @@ -17,6 +17,8 @@  #include "ao.h" +__code uint8_t ao_log_format = AO_LOG_FORMAT_NONE;	/* until we actually log stuff */ +  void  main(void)  { | 
