diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ao.h | 25 | ||||
-rw-r--r-- | src/core/ao_report.c | 10 | ||||
-rw-r--r-- | src/core/ao_telemetry.c | 14 |
3 files changed, 41 insertions, 8 deletions
diff --git a/src/core/ao.h b/src/core/ao.h index 861a0fd4..2e012f08 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -264,6 +264,26 @@ ao_cmd_filter(void); * ao_report.c */ +#define AO_RDF_INTERVAL_TICKS AO_SEC_TO_TICKS(5) +#define AO_RDF_LENGTH_MS 500 +#define AO_RDF_CONTINUITY_MS 32 +#define AO_RDF_CONTINUITY_PAUSE 96 +#define AO_RDF_CONTINUITY_TOTAL ((AO_RDF_CONTINUITY_PAUSE + AO_RDF_CONTINUITY_MS) * 3 + AO_RDF_CONTINUITY_PAUSE) + +/* This assumes that we're generating a 1kHz tone, which + * modulates the carrier at 2kbps, or 250kBps + */ +#define AO_MS_TO_RDF_LEN(ms) ((ms) / 4) + +#define AO_RADIO_RDF_LEN AO_MS_TO_RDF_LEN(AO_RDF_LENGTH_MS) +#define AO_RADIO_CONT_TONE_LEN AO_MS_TO_RDF_LEN(AO_RDF_CONTINUITY_MS) +#define AO_RADIO_CONT_PAUSE_LEN AO_MS_TO_RDF_LEN(AO_RDF_CONTINUITY_PAUSE) +#define AO_RADIO_CONT_TOTAL_LEN AO_MS_TO_RDF_LEN(AO_RDF_CONTINUITY_TOTAL) + +/* returns a value 0-3 to indicate igniter continuity */ +uint8_t +ao_report_igniter(void); + void ao_report_init(void); @@ -538,10 +558,11 @@ ao_radio_recv_abort(void); * 2 * ms bits, or ms / 4 bytes */ -#define AO_MS_TO_RDF_LEN(ms) ((ms) > 255 * 4 ? 255 : ((ms) >> 2)) +void +ao_radio_rdf(void); void -ao_radio_rdf(uint8_t pkt_len); +ao_radio_continuity(uint8_t c); void ao_radio_rdf_abort(void); diff --git a/src/core/ao_report.c b/src/core/ao_report.c index eb90a4f8..1104cd82 100644 --- a/src/core/ao_report.c +++ b/src/core/ao_report.c @@ -114,6 +114,13 @@ ao_report_igniter_ready(enum ao_igniter igniter) return ao_igniter_status(igniter) == ao_igniter_ready ? 1 : 0; } +uint8_t +ao_report_igniter(void) +{ + return (ao_report_igniter_ready(ao_igniter_drogue) | + (ao_report_igniter_ready(ao_igniter_main) << 1)); +} + static void ao_report_continuity(void) __reentrant { @@ -123,8 +130,7 @@ ao_report_continuity(void) __reentrant if (!ao_igniter_present) return; #endif - c = (ao_report_igniter_ready(ao_igniter_drogue) | - (ao_report_igniter_ready(ao_igniter_main) << 1)); + c = ao_report_igniter(); if (c) { while (c--) { high(AO_MS_TO_TICKS(25)); diff --git a/src/core/ao_telemetry.c b/src/core/ao_telemetry.c index 3c747520..583a6636 100644 --- a/src/core/ao_telemetry.c +++ b/src/core/ao_telemetry.c @@ -22,9 +22,6 @@ static __pdata uint16_t ao_telemetry_interval; static __pdata uint8_t ao_rdf = 0; static __pdata uint16_t ao_rdf_time; -#define AO_RDF_INTERVAL_TICKS AO_SEC_TO_TICKS(5) -#define AO_RDF_LENGTH_MS 500 - #if defined(MEGAMETRUM) #define AO_SEND_MEGA 1 #endif @@ -317,8 +314,16 @@ ao_telemetry(void) if (ao_rdf && (int16_t) (ao_time() - ao_rdf_time) >= 0) { +#if HAS_IGNITE_REPORT + uint8_t c; +#endif ao_rdf_time = ao_time() + AO_RDF_INTERVAL_TICKS; - ao_radio_rdf(AO_MS_TO_RDF_LEN(AO_RDF_LENGTH_MS)); +#if HAS_IGNITE_REPORT + if (ao_flight_state == ao_flight_pad && (c = ao_report_igniter())) + ao_radio_continuity(c); + else +#endif + ao_radio_rdf(); } #endif time += ao_telemetry_interval; @@ -330,6 +335,7 @@ ao_telemetry(void) } else time = ao_time(); + bottom: ; } } } |