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>
/* 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_romconfig.serial_number);
+#if HAS_LOG
+ printf("log-format %u\n", ao_log_format);
+#endif
printf("software-version %s\n", ao_version);
}
__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)
{
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
{
#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)
{
#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
#include "ao.h"
+__code uint8_t ao_log_format = AO_LOG_FORMAT_NONE; /* until we actually log stuff */
+
void
main(void)
{