From af27e44a525802267f51d6e93cdc73d31a3f5b0b Mon Sep 17 00:00:00 2001 From: jgromes Date: Wed, 25 Sep 2024 17:02:37 +0100 Subject: [PATCH] [SX126x] Fix instant RSSI reading --- src/modules/SX126x/SX126x.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 40c076e85..17ad06635 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -1260,9 +1260,9 @@ float SX126x::getRSSI(bool packet) { return(-1.0 * rssiPkt/2.0); } else { // get instantaneous RSSI value - uint8_t data[3] = {0, 0, 0}; // RssiInst, Status, RFU - this->mod->SPIreadStream(RADIOLIB_SX126X_CMD_GET_RSSI_INST, data, 3); - return((float)data[0] / (-2.0)); + uint8_t rssiRaw = 0; + this->mod->SPIreadStream(RADIOLIB_SX126X_CMD_GET_RSSI_INST, &rssiRaw, 1); + return((float)rssiRaw / (-2.0)); } }