From 83929cd290279963b01b2ccd52c70d61bdeff6b0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 22 Oct 2017 15:44:32 -0500 Subject: altos: Share common logging code. Deal with corrupt initial flight records Move common logging APIs from per-format files into ao_log.c. Then, change that code to check the first log record in a slot (containing the flight number) to see if it's invalid and deal with it. That involves not re-using that slot, and allowing it to be erased. Corrupted log blocks are reported with a negative flight number. Signed-off-by: Keith Packard --- src/kernel/ao_log_tiny.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/kernel/ao_log_tiny.c') diff --git a/src/kernel/ao_log_tiny.c b/src/kernel/ao_log_tiny.c index 7769b7b5..0b8e39d6 100644 --- a/src/kernel/ao_log_tiny.c +++ b/src/kernel/ao_log_tiny.c @@ -29,8 +29,6 @@ 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) { @@ -149,7 +147,7 @@ ao_log(void) } } -uint16_t +int16_t ao_log_flight(uint8_t slot) { static __xdata uint16_t flight; -- cgit v1.2.3