diff options
author | Keith Packard <keithp@keithp.com> | 2014-09-06 20:44:30 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-09-06 20:44:30 -0700 |
commit | d83afa9320c24056469984873af0a3c70bee0962 (patch) | |
tree | ea87b1e0b5eb9036f6a7fe57d7c4a8eadebcc534 /src | |
parent | e7515e3a88d53c50dd9b962cc8f43ce5376ccd0b (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')
-rw-r--r-- | src/drivers/ao_packet_master.c | 8 |
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) { |