projects
/
fw
/
altos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9605045
)
Keep reporting flight state while it changes
author
Keith Packard
<keithp@keithp.com>
Wed, 15 Apr 2009 04:24:25 +0000
(21:24 -0700)
committer
Keith Packard
<keithp@keithp.com>
Wed, 15 Apr 2009 04:24:25 +0000
(21:24 -0700)
ao_report.c
patch
|
blob
|
history
diff --git
a/ao_report.c
b/ao_report.c
index 1cc883be880d2a3756f96631682ad86f4768e9bd..0753df47cf30957b2e7712ae666c0ed0f19b0319 100644
(file)
--- a/
ao_report.c
+++ b/
ao_report.c
@@
-38,10
+38,12
@@
static const char * __xdata flight_reports[] = {
#endif
#define pause(time) ao_delay(time)
#endif
#define pause(time) ao_delay(time)
+static __xdata enum ao_flight_state ao_report_state;
+
static void
static void
-ao_report_
state
(void)
+ao_report_
beep
(void)
{
{
- char *r = flight_reports[ao_
fligh
t_state];
+ char *r = flight_reports[ao_
repor
t_state];
char c;
if (!r)
char c;
if (!r)
@@
-53,22
+55,26
@@
ao_report_state(void)
signal(AO_MS_TO_TICKS(600));
pause(AO_MS_TO_TICKS(200));
}
signal(AO_MS_TO_TICKS(600));
pause(AO_MS_TO_TICKS(200));
}
+ pause(AO_MS_TO_TICKS(400));
}
}
-static __xdata ao_report_wait;
-
void
ao_report_notify(void)
{
void
ao_report_notify(void)
{
- ao_wakeup(&ao_report_
wait
);
+ ao_wakeup(&ao_report_
state
);
}
void
ao_report(void)
{
}
void
ao_report(void)
{
+ ao_report_state = ao_flight_state;
for(;;) {
for(;;) {
- ao_report_state();
- ao_sleep(&ao_report_wait);
+ ao_report_beep();
+ __critical {
+ while (ao_report_state == ao_flight_state)
+ ao_sleep(&ao_report_state);
+ ao_report_state = ao_flight_state;
+ }
}
}
}
}