From 122c4101164d598e655fa9ad8473053d30ff4212 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 28 Aug 2011 16:55:55 -0700 Subject: [PATCH] altos: Report continuity in telebt Report continuity values from remote altimeter Signed-off-by: Keith Packard --- src/cc1111/ao_pins.h | 6 ++++++ src/core/ao_log_telem.c | 29 +++++++++++++++++++++++++++++ src/core/ao_report.c | 6 ++++-- src/product/Makefile.telebt | 1 - src/product/ao_telebt.c | 2 ++ src/telebt-v0.1/Makefile | 1 + 6 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/cc1111/ao_pins.h b/src/cc1111/ao_pins.h index 57de67b2..723f1500 100644 --- a/src/cc1111/ao_pins.h +++ b/src/cc1111/ao_pins.h @@ -274,6 +274,7 @@ #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 @@ -313,6 +314,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 @@ -449,6 +451,10 @@ #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 diff --git a/src/core/ao_log_telem.c b/src/core/ao_log_telem.c index 9afa13b2..193c11f3 100644 --- a/src/core/ao_log_telem.c +++ b/src/core/ao_log_telem.c @@ -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) { diff --git a/src/core/ao_report.c b/src/core/ao_report.c index 3cf558e1..e0355d96 100644 --- a/src/core/ao_report.c +++ b/src/core/ao_report.c @@ -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) diff --git a/src/product/Makefile.telebt b/src/product/Makefile.telebt index 04dd044e..46c87db0 100644 --- a/src/product/Makefile.telebt +++ b/src/product/Makefile.telebt @@ -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 diff --git a/src/product/ao_telebt.c b/src/product/ao_telebt.c index 6fe18a4d..9e409db7 100644 --- a/src/product/ao_telebt.c +++ b/src/product/ao_telebt.c @@ -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(); diff --git a/src/telebt-v0.1/Makefile b/src/telebt-v0.1/Makefile index 01fbaf52..90cd3cac 100644 --- a/src/telebt-v0.1/Makefile +++ b/src/telebt-v0.1/Makefile @@ -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 -- 2.30.2