cpu/nrf52/nrf802154_radio: fix rssi calculation
This commit is contained in:
parent
f8bc934785
commit
6d4d00ebe9
@ -230,11 +230,10 @@ static int _read(ieee802154_dev_t *dev, void *buf, size_t max_size,
|
|||||||
radio_info->lqi = (uint8_t)(hwlqi > UINT8_MAX/ED_RSSISCALE
|
radio_info->lqi = (uint8_t)(hwlqi > UINT8_MAX/ED_RSSISCALE
|
||||||
? UINT8_MAX
|
? UINT8_MAX
|
||||||
: hwlqi * ED_RSSISCALE);
|
: hwlqi * ED_RSSISCALE);
|
||||||
/* Calculate RSSI by subtracting the offset from the datasheet.
|
/* We calculate RSSI from LQI, since it's already 8-bit
|
||||||
* Intentionally using a different calculation than the one from
|
saturated (see page 321 of product spec v1.1) */
|
||||||
* figure 122 of the v1.1 product specification. This appears to
|
radio_info->rssi = _hwval_to_ieee802154_dbm(radio_info->lqi)
|
||||||
* match real world performance better */
|
+ IEEE802154_RADIO_RSSI_OFFSET;
|
||||||
radio_info->rssi = _hwval_to_ieee802154_dbm(hwlqi) + IEEE802154_RADIO_RSSI_OFFSET;
|
|
||||||
}
|
}
|
||||||
memcpy(buf, &rxbuf[1], pktlen);
|
memcpy(buf, &rxbuf[1], pktlen);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user