Skip to content

Commit

Permalink
samples: lora: receive: update SNR unit to dB
Browse files Browse the repository at this point in the history
Signal-to-noise ratio is a unitless quantity, so its unit is dB, not
dBm (dBm is the power relative to 1 milliwatt). At the same time output
the received payload using `LOG_HEXDUMP_INF`, instead of limiting the
sample solely to string payloads.

Fixes #82414

Signed-off-by: Jordan Yates <[email protected]>
  • Loading branch information
JordanYates committed Dec 2, 2024
1 parent 8c9a2b2 commit a25b18f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/drivers/lora/receive/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ void lora_receive_cb(const struct device *dev, uint8_t *data, uint16_t size,
ARG_UNUSED(dev);
ARG_UNUSED(size);

LOG_INF("Received data: %s (RSSI:%ddBm, SNR:%ddBm)",
data, rssi, snr);
LOG_INF("LoRa RX RSSI: %ddBm, SNR: %ddB", rssi, snr);
LOG_HEXDUMP_INF(data, size, "LoRa RX payload");

/* Stop receiving after 10 packets */
if (++cnt == 10) {
Expand Down

0 comments on commit a25b18f

Please sign in to comment.