16f56abfad
As discussed in #1341, the current CC13xx/CC26xx IEEE mode driver sends `CMD_GET_RSSI` once and returns the RSSI reading uncondtionally. This happens within the `get_rssi()` function. This logic is broken if `get_rssi()` is called with the radio off. The function will make sure to turn on the radio first, but it does not make sure the RSSI reading is valid, which only happens a number of symbol periods after the radio enters RX. The outcome is that `NETSTACK_RADIO.get_value(RADIO_PARAM_RSSI, ...)` will always return -128 (meaning that RSSI is unavailable) if the radio was off at the time of calling the function. The same condition affects the prop mode driver. This commit changes the logic of `get_rssi()`: * For PROP mode, if `CMD_GET_RSSI` returns an invalid RSSI, we send it again. For unknown reasons, `CMD_GET_RSSI` on occasion returns 0, so we ignore that value too. * For IEEE mode, we use `CMD_IEEE_CCA_REQ` and we inspect the value of `ccaInfo.ccaEnergy` of the return structure. If the value is 0x02 (Invalid), we send the command again. Fixes #1341 |
||
---|---|---|
.. | ||
api | ||
dot-15-4g.h | ||
ieee-mode.c | ||
prop-mode.c | ||
rf-ble.c | ||
rf-ble.h | ||
rf-core.c | ||
rf-core.h | ||
smartrf-settings.c | ||
smartrf-settings.h |