diff options
author | Keith Packard <keithp@keithp.com> | 2010-08-26 23:37:29 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-08-26 23:37:29 -0700 |
commit | 68b2b66d7574dfd0bd5e3571b8ffad32ca5d2b73 (patch) | |
tree | 23e144c57c6f2193cb71feeb4848633a2853d44f /src/ao_log.c | |
parent | aa6c27df5db6bdae59d00affccb891854a6caa18 (diff) |
altos: mark gps date written only after it gets into eeprom
Data logging doesn't start until boost detect occurs. As the GPS date
is only logged once, if that happens before logging is written to the
flash, then the GPS date will never get saved.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_log.c')
-rw-r--r-- | src/ao_log.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ao_log.c b/src/ao_log.c index d550d408..18bdb8c8 100644 --- a/src/ao_log.c +++ b/src/ao_log.c @@ -33,14 +33,16 @@ ao_log_csum(__xdata uint8_t *b) __reentrant return -sum; } -void +uint8_t ao_log_data(__xdata struct ao_log_record *log) __reentrant { + uint8_t wrote = 0; /* set checksum */ log->csum = 0; log->csum = ao_log_csum((__xdata uint8_t *) log); ao_mutex_get(&ao_log_mutex); { if (ao_log_running) { + wrote = 1; ao_ee_write(ao_log_current_pos, (uint8_t *) log, sizeof (struct ao_log_record)); @@ -51,6 +53,7 @@ ao_log_data(__xdata struct ao_log_record *log) __reentrant ao_log_running = 0; } } ao_mutex_put(&ao_log_mutex); + return wrote; } void |