Skip to content

Commit

Permalink
fix SNR calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmayer committed Oct 1, 2019
1 parent 19fc2fc commit 918f20d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SX127x/LoRa.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def get_modem_status(self):

def get_pkt_snr_value(self):
v = self.spi.xfer([REG.LORA.PKT_SNR_VALUE, 0])[1]
return float(256-v) / 4.
return (float(v-256) if v > 127 else float(v)) / 4.

def get_pkt_rssi_value(self):
v = self.spi.xfer([REG.LORA.PKT_RSSI_VALUE, 0])[1]
Expand Down

0 comments on commit 918f20d

Please sign in to comment.