diff options
author | Keith Packard <keithp@keithp.com> | 2015-05-24 17:28:07 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2015-05-24 17:28:07 -0700 |
commit | 0e76cb2a7d5db24b6cecdccb6fb8d5bf5527fadf (patch) | |
tree | 3857a62e5a1164157cc8ec00195113885b4e5a8b | |
parent | e7c25e3ba04b1e9f8e6fa31e2d464fe96a074dad (diff) |
altos: Only set CMAC RSSI value on valid packet received
This ignores spurious packets for the purpose of showing the RSSI
value in telelco/telefire, avoiding warning about 'low RSSI' when the
radio receives noise.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/kernel/ao_radio_cmac.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/kernel/ao_radio_cmac.c b/src/kernel/ao_radio_cmac.c index bff848f6..b6835346 100644 --- a/src/kernel/ao_radio_cmac.c +++ b/src/kernel/ao_radio_cmac.c @@ -91,7 +91,6 @@ radio_cmac_recv(uint8_t len, uint16_t timeout) __reentrant return AO_RADIO_CMAC_TIMEOUT; } - ao_radio_cmac_rssi = ao_radio_rssi; if (!(cmac_data[len + AO_CMAC_KEY_LEN +1] & AO_RADIO_STATUS_CRC_OK)) return AO_RADIO_CMAC_CRC_ERROR; @@ -114,13 +113,15 @@ radio_cmac_recv(uint8_t len, uint16_t timeout) __reentrant /* Check the packet signature against the signature provided * over the link */ - + if (memcmp(&cmac_data[len], &cmac_data[len + AO_CMAC_KEY_LEN + 2], AO_CMAC_KEY_LEN) != 0) { return AO_RADIO_CMAC_MAC_ERROR; } + ao_radio_cmac_rssi = ao_radio_rssi; + return AO_RADIO_CMAC_OK; } @@ -161,4 +162,3 @@ ao_radio_cmac_recv(__xdata void *packet, uint8_t len, uint16_t timeout) __reentr ao_mutex_put(&ao_radio_cmac_mutex); return i; } - |