diff options
| author | Keith Packard <keithp@keithp.com> | 2009-04-14 21:24:25 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2009-04-14 21:24:25 -0700 | 
| commit | 545478dd02eaeff6a65d318e722b1e4fce5e01b4 (patch) | |
| tree | c413de550aa25c28ffa47f4dbfb0b787743b5ef4 | |
| parent | 9605045164882b4ca3d1317ac860b02513a51f30 (diff) | |
Keep reporting flight state while it changes
| -rw-r--r-- | ao_report.c | 20 | 
1 files changed, 13 insertions, 7 deletions
| diff --git a/ao_report.c b/ao_report.c index 1cc883be..0753df47 100644 --- 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) +static __xdata enum ao_flight_state ao_report_state; +  static void -ao_report_state(void) +ao_report_beep(void)  { -	char *r = flight_reports[ao_flight_state]; +	char *r = flight_reports[ao_report_state];  	char c;  	if (!r) @@ -53,22 +55,26 @@ ao_report_state(void)  			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)  { -	ao_wakeup(&ao_report_wait); +	ao_wakeup(&ao_report_state);  }  void  ao_report(void)  { +	ao_report_state = ao_flight_state;  	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; +		}  	}  } | 
