summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-01-07 20:26:39 -0800
committerKeith Packard <keithp@keithp.com>2011-01-07 20:26:39 -0800
commit52ac83fedbfd380d14d4df2e79992bbdfba3552a (patch)
treed7d9d74d72060de6066a83c3e275469e3b0c5d74
parent00891b40754962ef6530b237ef52017bb58112d5 (diff)
altos: Check for full log and complain
Reports special tone along with the continuity checks. Reports flight 0 in telemetry. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/ao.h4
-rw-r--r--src/ao_log.c6
-rw-r--r--src/ao_report.c10
-rw-r--r--src/ao_telemetry.c2
4 files changed, 21 insertions, 1 deletions
diff --git a/src/ao.h b/src/ao.h
index ad02a829..37a39a79 100644
--- a/src/ao.h
+++ b/src/ao.h
@@ -628,6 +628,10 @@ ao_log_write_erase(uint8_t pos);
uint8_t
ao_log_present(void);
+/* Returns true if there is no more storage space available */
+uint8_t
+ao_log_full(void);
+
/*
* ao_flight.c
*/
diff --git a/src/ao_log.c b/src/ao_log.c
index 55b9dfff..ba019992 100644
--- a/src/ao_log.c
+++ b/src/ao_log.c
@@ -315,6 +315,12 @@ ao_log_present(void)
return ao_log_max_flight() != 0;
}
+uint8_t
+ao_log_full(void)
+{
+ return ao_log_current_pos == ao_log_end_pos;
+}
+
static __xdata struct ao_task ao_log_task;
void
diff --git a/src/ao_report.c b/src/ao_report.c
index 511b4f16..cc8b512b 100644
--- a/src/ao_report.c
+++ b/src/ao_report.c
@@ -128,6 +128,16 @@ ao_report_continuity(void) __reentrant
ao_beep_for(AO_BEEP_LOW, AO_MS_TO_TICKS(20));
}
}
+ if (ao_log_full()) {
+ pause(AO_MS_TO_TICKS(100));
+ c = 2;
+ while (c--) {
+ ao_beep_for(AO_BEEP_LOW, AO_MS_TO_TICKS(100));
+ ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(100));
+ ao_beep_for(AO_BEEP_HIGH, AO_MS_TO_TICKS(100));
+ ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(100));
+ }
+ }
c = 50;
while (c-- && ao_flight_state == ao_flight_pad)
pause(AO_MS_TO_TICKS(100));
diff --git a/src/ao_telemetry.c b/src/ao_telemetry.c
index 277c3ce0..22ab1d67 100644
--- a/src/ao_telemetry.c
+++ b/src/ao_telemetry.c
@@ -34,7 +34,7 @@ ao_telemetry(void)
ao_sleep(&ao_flight_number);
memcpy(telemetry.callsign, ao_config.callsign, AO_MAX_CALLSIGN);
telemetry.addr = ao_serial_number;
- telemetry.flight = ao_flight_number;
+ telemetry.flight = ao_log_full() ? 0 : ao_flight_number;
telemetry.accel_plus_g = ao_config.accel_plus_g;
telemetry.accel_minus_g = ao_config.accel_minus_g;
ao_rdf_time = ao_time();