summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-04-09 17:51:01 -0700
committerKeith Packard <keithp@keithp.com>2010-04-09 17:51:01 -0700
commit9394393c24c0a96b94319f2d0aa78fb498a121c9 (patch)
treea9bc64b9c9c042e10322b9c4ba5a808c8742a625
parentce39372a3aeffff1a08d609e63164a00cf974663 (diff)
Only have the slave return a packet if it received one.
When the receive is aborted to switch modes, it's important to not immediately re-acquire the radio and try to send a packet as the aborting thread won't know to kick the receiver again. This prevents the 'C' command from locking up as it tries to stop the packet slave before turning on the transmitter. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/ao_packet_slave.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ao_packet_slave.c b/src/ao_packet_slave.c
index 4c947fbf..e03ebdc3 100644
--- a/src/ao_packet_slave.c
+++ b/src/ao_packet_slave.c
@@ -20,12 +20,15 @@
void
ao_packet_slave(void)
{
+ uint8_t status;
+
ao_radio_set_packet();
ao_tx_packet.addr = ao_serial_number;
ao_tx_packet.len = AO_PACKET_SYN;
while (ao_packet_enable) {
- ao_packet_recv();
- ao_packet_send();
+ status = ao_packet_recv();
+ if (status & AO_DMA_DONE)
+ ao_packet_send();
}
ao_exit();
}