diff options
author | Keith Packard <keithp@keithp.com> | 2009-10-10 15:08:14 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-10-10 15:08:14 -0700 |
commit | 8f7ea3de7037f40b0ff462b60d503c19431ae62b (patch) | |
tree | 11a94602290e1a6ba51708a79fd3f2852e4b697d | |
parent | 5f26ad663b3f60dddc9d967206e365f45dc4acd1 (diff) |
Report igniter continuity in pad/idle mode via beeper
one short beep = drogue
two short beeps = main
three short beeps = both
one long warble = neither
In idle mode, it does this just once. In pad mode, it keeps testing
and reporting.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/ao_report.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ao_report.c b/src/ao_report.c index 14eaf428..3b469de6 100644 --- a/src/ao_report.c +++ b/src/ao_report.c @@ -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) { @@ -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_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)); |