From d83afa9320c24056469984873af0a3c70bee0962 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 6 Sep 2014 20:44:30 -0700 Subject: [PATCH 1/1] 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 --- src/drivers/ao_packet_master.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { -- 2.30.2