summaryrefslogtreecommitdiff
path: root/src/drivers/ao_packet_master.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-09-06 20:44:30 -0700
committerKeith Packard <keithp@keithp.com>2014-09-06 20:44:30 -0700
commitd83afa9320c24056469984873af0a3c70bee0962 (patch)
treeea87b1e0b5eb9036f6a7fe57d7c4a8eadebcc534 /src/drivers/ao_packet_master.c
parente7515e3a88d53c50dd9b962cc8f43ce5376ccd0b (diff)
altos: Scale packet master receive delay by baud rate
Increase the time we wait for return packets based on the remote protocol baud rate. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_packet_master.c')
-rw-r--r--src/drivers/ao_packet_master.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/drivers/ao_packet_master.c b/src/drivers/ao_packet_master.c
index d6c99cbd..23545049 100644
--- a/src/drivers/ao_packet_master.c
+++ b/src/drivers/ao_packet_master.c
@@ -57,6 +57,12 @@ static __xdata uint16_t ao_packet_master_time;
#define AO_PACKET_MASTER_DELAY_LONG AO_MS_TO_TICKS(1000)
#define AO_PACKET_MASTER_DELAY_TIMEOUT AO_MS_TO_TICKS(2000)
+#if HAS_RADIO_RATE
+#define AO_PACKET_MASTER_RECV_DELAY AO_MS_TO_TICKS(100) << (ao_config.radio_rate << 1)
+#else
+#define AO_PACKET_MASTER_RECV_DELAY AO_MS_TO_TICKS(100)
+#endif
+
static void
ao_packet_master_busy(void)
{
@@ -91,7 +97,7 @@ ao_packet_master(void)
if (ao_tx_packet.len)
ao_packet_master_busy();
ao_packet_master_check_busy();
- ao_alarm(ao_packet_master_delay);
+ ao_alarm(AO_PACKET_MASTER_RECV_DELAY);
r = ao_packet_recv();
ao_clear_alarm();
if (r) {