summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ao.h3
-rw-r--r--src/ao_gps_report.c4
-rw-r--r--src/ao_log.c5
3 files changed, 8 insertions, 4 deletions
diff --git a/src/ao.h b/src/ao.h
index d289ced1..8db22799 100644
--- a/src/ao.h
+++ b/src/ao.h
@@ -564,6 +564,7 @@ struct ao_log_record {
uint8_t year;
uint8_t month;
uint8_t day;
+ uint8_t extra;
} gps_date;
struct {
uint16_t d0;
@@ -573,7 +574,7 @@ struct ao_log_record {
};
/* Write a record to the eeprom log */
-void
+uint8_t
ao_log_data(__xdata struct ao_log_record *log) __reentrant;
/* Flush the log */
diff --git a/src/ao_gps_report.c b/src/ao_gps_report.c
index cceb79ff..7abc93f5 100644
--- a/src/ao_gps_report.c
+++ b/src/ao_gps_report.c
@@ -51,12 +51,12 @@ ao_gps_report(void)
gps_log.u.gps_altitude.unused = 0xffff;
ao_log_data(&gps_log);
if (!date_reported && (gps_data.flags & AO_GPS_DATE_VALID)) {
- date_reported = 1;
gps_log.type = AO_LOG_GPS_DATE;
gps_log.u.gps_date.year = gps_data.year;
gps_log.u.gps_date.month = gps_data.month;
gps_log.u.gps_date.day = gps_data.day;
- ao_log_data(&gps_log);
+ gps_log.u.gps_date.extra = 0;
+ date_reported = ao_log_data(&gps_log);
}
}
}
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