altos: Report continuity in telebt
authorKeith Packard <keithp@keithp.com>
Sun, 28 Aug 2011 23:55:55 +0000 (16:55 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 28 Aug 2011 23:55:55 +0000 (16:55 -0700)
Report continuity values from remote altimeter

Signed-off-by: Keith Packard <keithp@keithp.com>
src/cc1111/ao_pins.h
src/core/ao_log_telem.c
src/core/ao_report.c
src/product/Makefile.telebt
src/product/ao_telebt.c
src/telebt-v0.1/Makefile

index 57de67b..723f150 100644 (file)
        #define SPI_CS_ON_P1            1
        #define SPI_CS_ON_P0            0
        #define HAS_IGNITE              0
+       #define HAS_IGNITE_REPORT       1
        #define BT_LINK_ON_P2           1
        #define BT_LINK_ON_P1           0
        #define BT_LINK_PIN_INDEX       7
        #define M25_MAX_CHIPS           1
        #define HAS_ACCEL               0
        #define HAS_IGNITE              0
+       #define HAS_IGNITE_REPORT       1
        #define BT_LINK_ON_P2           0
        #define BT_LINK_ON_P1           1
        #define BT_LINK_PIN_INDEX       7
 #error Please define HAS_IGNITE
 #endif
 
+#if HAS_IGNITE
+#define HAS_IGNITE_REPORT 1
+#endif
+
 #ifndef PACKET_HAS_MASTER
 #error Please define PACKET_HAS_MASTER
 #endif
index 9afa13b..193c11f 100644 (file)
@@ -22,6 +22,7 @@ __code uint8_t ao_log_format = AO_LOG_FORMAT_TELEMETRY;
 static __data uint8_t                  ao_log_monitor_pos;
 __pdata enum ao_flight_state           ao_flight_state;
 __pdata int16_t                                ao_max_height;  /* max of ao_height */
+__pdata int16_t                                sense_d, sense_m;
 
 static void
 ao_log_telem_track() {
@@ -29,6 +30,9 @@ ao_log_telem_track() {
                switch (ao_log_single_write_data.telemetry.generic.type) {
                case AO_TELEMETRY_SENSOR_TELEMETRUM:
                case AO_TELEMETRY_SENSOR_TELEMINI:
+                       sense_d = ao_log_single_write_data.telemetry.sensor.sense_d;
+                       sense_m = ao_log_single_write_data.telemetry.sensor.sense_m;
+                       /* fall through ... */
                case AO_TELEMETRY_SENSOR_TELENANO:
                        if (ao_log_single_write_data.telemetry.sensor.height > ao_max_height) {
                                ao_max_height = ao_log_single_write_data.telemetry.sensor.height;
@@ -42,6 +46,31 @@ ao_log_telem_track() {
                }
        }
 }
+
+enum ao_igniter_status
+ao_igniter_status(enum ao_igniter igniter)
+{
+       int16_t value;
+
+       switch (igniter) {
+       case ao_igniter_drogue:
+               value = sense_d;
+               break;
+       case ao_igniter_main:
+               value = sense_m;
+               break;
+       default:
+               value = 0;
+               break;
+       }
+       if (value < AO_IGNITER_OPEN)
+               return ao_igniter_open;
+       else if (value > AO_IGNITER_CLOSED)
+               return ao_igniter_ready;
+       else
+               return ao_igniter_unknown;
+}
+
 void
 ao_log_single(void)
 {
index 3cf558e..e0355d9 100644 (file)
@@ -109,7 +109,7 @@ ao_report_altitude(void)
        }
 }
 
-#if HAS_IGNITE
+#if HAS_IGNITE_REPORT
 static uint8_t
 ao_report_igniter_ready(enum ao_igniter igniter)
 {
@@ -133,6 +133,7 @@ ao_report_continuity(void) __reentrant
                        low(AO_MS_TO_TICKS(20));
                }
        }
+#if HAS_LOG
        if (ao_log_full()) {
                pause(AO_MS_TO_TICKS(100));
                c = 2;
@@ -143,6 +144,7 @@ ao_report_continuity(void) __reentrant
                        mid(AO_MS_TO_TICKS(100));
                }
        }
+#endif
        c = 50;
        while (c-- && ao_flight_state == ao_flight_pad)
                pause(AO_MS_TO_TICKS(100));
@@ -157,7 +159,7 @@ ao_report(void)
                if (ao_flight_state == ao_flight_landed)
                        ao_report_altitude();
                ao_report_beep();
-#if HAS_IGNITE
+#if HAS_IGNITE_REPORT
                if (ao_flight_state == ao_flight_idle)
                        ao_report_continuity();
                while (ao_flight_state == ao_flight_pad)
index 04dd044..46c87db 100644 (file)
@@ -26,7 +26,6 @@ CORE_SRC = \
        ao_monitor.c \
        ao_mutex.c \
        ao_panic.c \
-       ao_report.c \
        ao_state.c \
        ao_stdio.c \
        ao_task.c
index 6fe18a4..9e409db 100644 (file)
@@ -38,7 +38,9 @@ main(void)
 #endif
        ao_usb_init();
        ao_monitor_init(AO_LED_RED, sizeof (union ao_telemetry_all));
+#if HAS_LOG
        ao_report_init();
+#endif
        ao_radio_init();
        ao_packet_master_init();
        ao_btm_init();
index 01fbaf5..90cd3ca 100644 (file)
@@ -12,6 +12,7 @@ TELEBT_SRC = \
        ao_beep.c \
        ao_log_single.c \
        ao_log_telem.c \
+       ao_report.c \
        ao_spi.c \
        ao_storage.c \
        ao_m25.c