projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Allow target-specific USB endpoint specifications
[fw/altos]
/
src
/
core
/
ao_report.c
diff --git
a/src/core/ao_report.c
b/src/core/ao_report.c
index e0355d96b75cde650c54f0974084ab0fbda63910..1104cd82532ff8173334591ee06c534b968e1f42 100644
(file)
--- a/
src/core/ao_report.c
+++ b/
src/core/ao_report.c
@@
-16,6
+16,8
@@
*/
#include "ao.h"
*/
#include "ao.h"
+#include <ao_flight.h>
+#include <ao_sample.h>
#define BIT(i,x) ((x) ? (1 << (i)) : 0)
#define MORSE1(a) (1 | BIT(3,a))
#define BIT(i,x) ((x) ? (1 << (i)) : 0)
#define MORSE1(a) (1 | BIT(3,a))
@@
-99,14
+101,10
@@
ao_report_altitude(void)
agl /= 10;
} while (agl);
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_REPORT
}
#if HAS_IGNITE_REPORT
@@
-116,11
+114,23
@@
ao_report_igniter_ready(enum ao_igniter igniter)
return ao_igniter_status(igniter) == ao_igniter_ready ? 1 : 0;
}
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
{
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));
+ uint8_t c;
+
+#if !HAS_IGNITE
+ if (!ao_igniter_present)
+ return;
+#endif
+ c = ao_report_igniter();
if (c) {
while (c--) {
high(AO_MS_TO_TICKS(25));
if (c) {
while (c--) {
high(AO_MS_TO_TICKS(25));
@@
-145,9
+155,6
@@
ao_report_continuity(void) __reentrant
}
}
#endif
}
}
#endif
- c = 50;
- while (c-- && ao_flight_state == ao_flight_pad)
- pause(AO_MS_TO_TICKS(100));
}
#endif
}
#endif
@@
-156,20
+163,29
@@
ao_report(void)
{
ao_report_state = ao_flight_state;
for(;;) {
{
ao_report_state = ao_flight_state;
for(;;) {
- if (ao_flight_state == ao_flight_landed)
- ao_report_altitude();
ao_report_beep();
ao_report_beep();
+ 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();
#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();
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;
}
}
}
}