xg590 / SX1276

MicroPython Library for SX1276 (A Long Range Radio Chip from Semtech)
Apache License 2.0
34 stars 8 forks source link

Add checking packet length in _irq_handler #1

Closed przemobe closed 2 years ago

przemobe commented 2 years ago

No. Checking range is not necessary as self.spi_read() returns just value from a byte. The idea is to cast the byte to signed integer. For example: value 255 shall be interpreted as -1/4 = -0.25. Currently we get 255/4 = 63.75 which is incorrect. Please refer to page 122 of SX1276/77/78/79 Data Sheet: "Estimation of SNR on last packet received. In two’s compliment format mutiplied by 4."

xg590 commented 2 years ago

The old SNR is calculated based on a wrong formula. This right formula is in page 112 of datasheet.


SNR[dB] = PacketSnr[twos complement]/4