altos: Report log format in the version command
authorKeith Packard <keithp@keithp.com>
Sat, 13 Aug 2011 20:12:05 +0000 (13:12 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 13 Aug 2011 20:14:26 +0000 (13:14 -0700)
Cherry-pick from 8624213ee204bfdcb219c65b3618751d8278d9db

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>
src-avr/ao.h
src-avr/ao_cmd.c
src-avr/ao_log.c
src-avr/ao_log_telescience.c
src-avr/ao_log_tiny.c
src-avr/ao_pins.h
src-avr/ao_telebt.c

index 9ff9dc2518424b3b963c6def423233a4a2934b78..c5032d16fe8ad5fc51d092a8b6ad5c233320c3e4 100644 (file)
@@ -594,6 +594,15 @@ extern struct ao_log_telescience ao_log_store;
 
 /* 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);
index 131c3d8934af11a32e82e9b8755e5d06ca590ee7..c36b9d944aded56f30fd97b5d89ec9e47dfe3c20 100644 (file)
@@ -223,6 +223,9 @@ version(void)
        printf("manufacturer     %s\n", ao_manufacturer);
        printf("product          %s\n", ao_product);
 //     printf("serial-number    %u\n", ao_romconfig.serial_number);
+#if HAS_LOG
+       printf("log-format       %u\n", ao_log_format);
+#endif
        printf("software-version %s\n", ao_version);
 }
 
index 433e9c3a9b6a2a870df6bcb2e4f3b94f02e6a2af..3dc2ee1e0b62d8b8c5c172516507058187277163 100644 (file)
@@ -24,6 +24,8 @@ __xdata uint8_t       ao_log_running;
 __xdata 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)
 {
index 387eb6eacf2f0331b0564987d0df758bf18170e4..18d836d0733cabca39c09b42ef07c478ce834f5f 100644 (file)
@@ -35,6 +35,8 @@ struct ao_log_telescience ao_log_fetch;
 
 static uint8_t ao_log_adc_pos;
 
+__code uint8_t ao_log_format = AO_LOG_FORMAT_TELESCIENCE;
+
 static uint8_t
 ao_log_csum(__xdata uint8_t *b) __reentrant
 {
index d26e0080ec5715c88897e4cd45402f902c6353ff..d5a3b99f903e111f7058eb9ebb7e4defe5a9dab1 100644 (file)
@@ -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)
 {
index afe1e941167ef29693fa64aef0d5596c61f743c4..feffd5ee030c09f0f80401568cfd34f0fe07e3a4 100644 (file)
 #ifdef TELESCIENCE
        #define LEDS_AVAILABLE          0
        #define HAS_USB                 1
+       #define HAS_LOG                 1
        #define TEENSY                  0
        #define USE_SERIAL_STDIN        1
        #define HAS_SERIAL_1            1
 #error Please define HAS_ADC
 #endif
 
+#ifndef HAS_LOG
+#define HAS_LOG HAS_EEPROM
+#endif
+
 #ifndef HAS_EEPROM
 #error Please define HAS_EEPROM
 #endif
index 295f0cec8e3d30accce1fc58dd2d050c5582245b..c49ce770f43ff51aaa4edc0537a2f520c5c2e21b 100644 (file)
@@ -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)
 {