diff options
author | Keith Packard <keithp@keithp.com> | 2010-11-23 19:02:54 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-11-23 19:10:27 -0800 |
commit | 3b9db8c82d26a6a2e43d4ca40742fc1bdc502380 (patch) | |
tree | 1b505c74968307a2e6f558bd8f6f703b4d9a0fac /src | |
parent | 54468e5dc567aaac5c5c20e921859b7cec28bb88 (diff) |
altos: Make radio test command careful with the radio mutex.
Remember whether the radio test mode is on or off and don't try to do
either of them twice to prevent the mutex from being acquired or
released twice.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/ao_radio.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ao_radio.c b/src/ao_radio.c index b2105ff8..67d5f6ba 100644 --- a/src/ao_radio.c +++ b/src/ao_radio.c @@ -452,26 +452,29 @@ void ao_radio_test(void) { uint8_t mode = 2; + static __xdata radio_on; ao_cmd_white(); if (ao_cmd_lex_c != '\n') { ao_cmd_decimal(); mode = (uint8_t) ao_cmd_lex_u32; } mode++; - if (mode & 2) { + if ((mode & 2) && !radio_on) { ao_set_monitor(0); ao_packet_slave_stop(); ao_radio_get(); RFST = RFST_STX; + radio_on = 1; } if (mode == 3) { printf ("Hit a character to stop..."); flush(); getchar(); putchar('\n'); } - if (mode & 1) { + if ((mode & 1) && radio_on) { ao_radio_idle(); ao_radio_put(); + radio_on = 0; } } |