kopia lustrzana https://github.com/micropython/micropython-lib
lora: Fix SNR value in SX126x received packets.
Wasn't being treated as a signed value. Fixes issue #999. Signed-off-by: Angus Gratton <angus@redyak.com.au>pull/1000/head
rodzic
5b496e944e
commit
f8c8875e25
|
@ -596,8 +596,9 @@ class _SX126x(BaseModem):
|
|||
pkt_status = self._cmd("B", _CMD_GET_PACKET_STATUS, n_read=4)
|
||||
|
||||
rx_packet.ticks_ms = ticks_ms
|
||||
rx_packet.snr = pkt_status[2] # SNR, units: dB *4
|
||||
rx_packet.rssi = 0 - pkt_status[1] // 2 # RSSI, units: dBm
|
||||
# SNR units are dB * 4 (signed)
|
||||
rx_packet.rssi, rx_packet.snr = struct.unpack("xBbx", pkt_status)
|
||||
rx_packet.rssi //= -2 # RSSI, units: dBm
|
||||
rx_packet.crc_error = (flags & _IRQ_CRC_ERR) != 0
|
||||
|
||||
return rx_packet
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
metadata(version="0.1.4")
|
||||
metadata(version="0.1.5")
|
||||
require("lora")
|
||||
package("lora")
|
||||
|
|
Ładowanie…
Reference in New Issue