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 57de67b2e3b3c763418207dee28bf030c12da5bb..723f150040e65a26fc34fe690f1a63badd345eb8 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 9afa13b21abd9c6bd83a4995a8eba62c552ffc80..193c11f300826ba99bda40e8c232a7efda83d111 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 3cf558e1d97ff9d72018fe0f14167f2c6702d9e1..e0355d96b75cde650c54f0974084ab0fbda63910 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 04dd044ef212e1b412f15088796633beadfc40ad..46c87db0865782f393497c0baa35296d3badc552 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 6fe18a4d36b4b1954bd54d9adb9e0762b49ff492..9e409db761c0f3644637fb84c7a19a68b6d5cbf0 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 01fbaf5205b471ca1820010b98601fb833411386..90cd3cacf037b3dc4cbc3d6d6998159f5a7f0606 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