altos: Check for full log and complain
authorKeith Packard <keithp@keithp.com>
Sat, 8 Jan 2011 04:26:39 +0000 (20:26 -0800)
committerKeith Packard <keithp@keithp.com>
Sat, 8 Jan 2011 04:26:39 +0000 (20:26 -0800)
Reports special tone along with the continuity checks.
Reports flight 0 in telemetry.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao.h
src/ao_log.c
src/ao_report.c
src/ao_telemetry.c

index ad02a8296f22de94c1eca7bdb029805607b1ee11..37a39a790b643b7061a1614fa3e6f128d90b4a5d 100644 (file)
--- 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
  */
index 55b9dfff32e7f8abbaae42d4a69e2ee27c562ce3..ba01999275745d806e2c220bf81381c03414400e 100644 (file)
@@ -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
index 511b4f16643cda099dbf94679c0c5dc5eda4e48c..cc8b512b095ca0af903620e9d7802fd32e3905ca 100644 (file)
@@ -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));
index 277c3ce01e4a30c807279e551f6663d688ab51de..22ab1d67d51422f35f23ada36177275ad31c14c1 100644 (file)
@@ -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();