altosui: Set callsign when fetching eeprom data over the air
[fw/altos] / src / ao_report.c
index e52b29281a3a1d46d614fd8c282b294b6afc22cc..3b469de6983ad8f732138e00c6baea5671be79bf 100644 (file)
 static const char * __xdata flight_reports[] = {
        "...",          /* startup, 'S' */
        "..",           /* idle 'I' */
 static const char * __xdata flight_reports[] = {
        "...",          /* startup, 'S' */
        "..",           /* idle 'I' */
-       ".--.",         /* launchpad 'P' */
+       ".--.",         /* pad 'P' */
        "-...",         /* boost 'B' */
        "-...",         /* boost 'B' */
+       "..-.",         /* fast 'F' */
        "-.-.",         /* coast 'C' */
        "-.-.",         /* coast 'C' */
-       ".-",           /* apogee 'A' */
        "-..",          /* drogue 'D' */
        "--",           /* main 'M' */
        ".-..",         /* landed 'L' */
        "-..",          /* drogue 'D' */
        "--",           /* main 'M' */
        ".-..",         /* landed 'L' */
@@ -97,6 +97,34 @@ ao_report_altitude(void)
        }
 }
 
        }
 }
 
+static uint8_t
+ao_report_igniter_ready(enum ao_igniter igniter)
+{
+       return ao_igniter_status(igniter) == ao_igniter_ready ? 1 : 0;
+}
+
+static void
+ao_report_continuity(void) __reentrant
+{
+       uint8_t c = (ao_report_igniter_ready(ao_igniter_drogue) |
+                    (ao_report_igniter_ready(ao_igniter_main) << 1));
+       if (c) {
+               while (c--) {
+                       ao_beep_for(AO_BEEP_HIGH, AO_MS_TO_TICKS(25));
+                       pause(AO_MS_TO_TICKS(100));
+               }
+       } else {
+               c = 10;
+               while (c--) {
+                       ao_beep_for(AO_BEEP_HIGH, AO_MS_TO_TICKS(20));
+                       ao_beep_for(AO_BEEP_LOW, AO_MS_TO_TICKS(20));
+               }
+       }
+       c = 50;
+       while (c-- && ao_flight_state == ao_flight_pad)
+               pause(AO_MS_TO_TICKS(100));
+}
+
 void
 ao_report(void)
 {
 void
 ao_report(void)
 {
@@ -105,6 +133,10 @@ ao_report(void)
                if (ao_flight_state == ao_flight_landed)
                        ao_report_altitude();
                ao_report_beep();
                if (ao_flight_state == ao_flight_landed)
                        ao_report_altitude();
                ao_report_beep();
+               if (ao_flight_state == ao_flight_idle)
+                       ao_report_continuity();
+               while (ao_flight_state == ao_flight_pad)
+                       ao_report_continuity();
                __critical {
                        while (ao_report_state == ao_flight_state)
                                ao_sleep(DATA_TO_XDATA(&ao_flight_state));
                __critical {
                        while (ao_report_state == ao_flight_state)
                                ao_sleep(DATA_TO_XDATA(&ao_flight_state));