summaryrefslogtreecommitdiff
path: root/src/kernel/ao_log_gps.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-08-17 20:59:45 -0700
committerKeith Packard <keithp@keithp.com>2014-08-17 20:59:45 -0700
commitbb7522acf040f41740ecd059e3d5d2480b652420 (patch)
tree9c174cdac4493d3e2ab0fdec0ca065df0d25f2ed /src/kernel/ao_log_gps.c
parent1530c24cc75cdf9ba87c7e153ff28bf7beb4384c (diff)
telegps-v1.0: Provide one log and append to it
Instead of creating per-flight logs, create a single log and append data to it each time TeleGPS is powered on. This avoids potentially running out of log space just because the device is powered off/on. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_log_gps.c')
-rw-r--r--src/kernel/ao_log_gps.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/kernel/ao_log_gps.c b/src/kernel/ao_log_gps.c
index a5a6358b..7643091c 100644
--- a/src/kernel/ao_log_gps.c
+++ b/src/kernel/ao_log_gps.c
@@ -26,6 +26,7 @@
static __xdata struct ao_log_gps log;
__code uint8_t ao_log_format = AO_LOG_FORMAT_TELEGPS;
+__code uint8_t ao_log_size = sizeof (struct ao_log_gps);
static uint8_t
ao_log_csum(__xdata uint8_t *b) __reentrant
@@ -136,3 +137,16 @@ ao_log_flight(uint8_t slot)
return log.u.flight.flight;
return 0;
}
+
+uint8_t
+ao_log_check(uint32_t pos)
+{
+ if (!ao_storage_read(pos,
+ &log,
+ sizeof (struct ao_log_gps)))
+ return 0;
+
+ if (ao_log_dump_check_data())
+ return 1;
+ return 0;
+}