File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 1212
1313* Author(s): Tony DiCola, Jerry Needell
1414"""
15- import time
1615import random
17- from micropython import const
18-
16+ import time
1917
2018import adafruit_bus_device .spi_device as spidev
21-
19+ from micropython import const
2220
2321__version__ = "0.0.0-auto.0"
2422__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git"
2523
26-
2724# Internal constants:
2825# Register names (FSK Mode even though we use LoRa instead, from table 85)
2926_RH_RF95_REG_00_FIFO = const (0x00 )
@@ -497,6 +494,16 @@ def rssi(self):
497494 raw_rssi -= 164
498495 return raw_rssi
499496
497+ @property
498+ def snr (self ):
499+ """The SNR (in dB) of the last received message."""
500+ # Read SNR 0x19 register and convert to value using formula in datasheet.
501+ # SNR(dB) = PacketSnr [twos complement] / 4
502+ snr_byte = self ._read_u8 (_RH_RF95_REG_19_PKT_SNR_VALUE )
503+ if snr_byte > 127 :
504+ snr_byte = (256 - snr_byte ) * - 1
505+ return snr_byte / 4
506+
500507 @property
501508 def signal_bandwidth (self ):
502509 """The signal bandwidth used by the radio (try setting to a higher
You can’t perform that action at this time.
0 commit comments