X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fcore%2Fao_report.c;h=7c9287928e28a5cdbd5ac8b6bce75a48594c88ee;hb=059f09dbca4703c25b42389b54c6510331c39485;hp=3cf558e1d97ff9d72018fe0f14167f2c6702d9e1;hpb=9513be7f9d3d0b0ec29f6487fa9dc8f1ac24d0de;p=fw%2Faltos diff --git a/src/core/ao_report.c b/src/core/ao_report.c index 3cf558e1..7c928792 100644 --- a/src/core/ao_report.c +++ b/src/core/ao_report.c @@ -99,17 +99,13 @@ ao_report_altitude(void) agl /= 10; } while (agl); - for (;;) { - ao_report_beep(); - i = ndigits; - do - ao_report_digit(digits[--i]); - while (i != 0); - pause(AO_SEC_TO_TICKS(5)); - } + i = ndigits; + do + ao_report_digit(digits[--i]); + while (i != 0); } -#if HAS_IGNITE +#if HAS_IGNITE_REPORT static uint8_t ao_report_igniter_ready(enum ao_igniter igniter) { @@ -119,7 +115,13 @@ ao_report_igniter_ready(enum ao_igniter igniter) static void ao_report_continuity(void) __reentrant { - uint8_t c = (ao_report_igniter_ready(ao_igniter_drogue) | + uint8_t c; + +#if !HAS_IGNITE + if (!ao_igniter_present) + return; +#endif + c = (ao_report_igniter_ready(ao_igniter_drogue) | (ao_report_igniter_ready(ao_igniter_main) << 1)); if (c) { while (c--) { @@ -133,6 +135,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,9 +146,7 @@ ao_report_continuity(void) __reentrant mid(AO_MS_TO_TICKS(100)); } } - c = 50; - while (c-- && ao_flight_state == ao_flight_pad) - pause(AO_MS_TO_TICKS(100)); +#endif } #endif @@ -154,20 +155,29 @@ ao_report(void) { ao_report_state = ao_flight_state; for(;;) { - if (ao_flight_state == ao_flight_landed) - ao_report_altitude(); ao_report_beep(); -#if HAS_IGNITE + if (ao_flight_state == ao_flight_landed) { + ao_report_altitude(); +#if HAS_FLIGHT + ao_delay(AO_SEC_TO_TICKS(5)); + continue; +#endif + } +#if HAS_IGNITE_REPORT if (ao_flight_state == ao_flight_idle) ao_report_continuity(); - while (ao_flight_state == ao_flight_pad) + while (ao_flight_state == ao_flight_pad) { + uint8_t c; ao_report_continuity(); -#endif - __critical { - while (ao_report_state == ao_flight_state) - ao_sleep(DATA_TO_XDATA(&ao_flight_state)); - ao_report_state = ao_flight_state; + c = 50; + while (c-- && ao_flight_state == ao_flight_pad) + pause(AO_MS_TO_TICKS(100)); } +#endif + + while (ao_report_state == ao_flight_state) + ao_sleep(DATA_TO_XDATA(&ao_flight_state)); + ao_report_state = ao_flight_state; } }