Skip to content

lora: Fix SNR value in SX126x received packets. #1000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions micropython/lora/lora-sx126x/lora/sx126x.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,9 @@ def _read_packet(self, rx_packet, flags):
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
Expand Down
2 changes: 1 addition & 1 deletion micropython/lora/lora-sx126x/manifest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
metadata(version="0.1.4")
metadata(version="0.1.5")
require("lora")
package("lora")
Loading