From 15ee1c2819340da759d0dbb11ce302804004d707 Mon Sep 17 00:00:00 2001 From: Ford Jones <107664313+ford-jones@users.noreply.github.com> Date: Wed, 22 Oct 2025 22:08:17 +1300 Subject: [PATCH 1/3] Include RSSI in rangetest csv (#8395) * Include RSSI in rangetest csv * Fix typo * Preserve csv column order --------- Co-authored-by: Ben Meadors --- src/modules/RangeTestModule.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/RangeTestModule.cpp b/src/modules/RangeTestModule.cpp index 3d78d0dc9..026b3028d 100644 --- a/src/modules/RangeTestModule.cpp +++ b/src/modules/RangeTestModule.cpp @@ -159,6 +159,7 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const meshtastic_MeshPacket LOG_DEBUG("---- Received Packet:"); LOG_DEBUG("mp.from %d", mp.from); LOG_DEBUG("mp.rx_snr %f", mp.rx_snr); + LOG_DEBUG("mp.rx_rssi %f", mp.rx_rssi); LOG_DEBUG("mp.hop_limit %d", mp.hop_limit); LOG_DEBUG("---- Node Information of Received Packet (mp.from):"); LOG_DEBUG("n->user.long_name %s", n->user.long_name); @@ -234,8 +235,8 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp) } // Print the CSV header - if (fileToWrite.println( - "time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx snr,distance,hop limit,payload")) { + if (fileToWrite.println("time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx " + "snr,distance,hop limit,payload,rx rssi")) { LOG_INFO("File was written"); } else { LOG_ERROR("File write failed"); @@ -297,6 +298,8 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp) // TODO: If quotes are found in the payload, it has to be escaped. fileToAppend.printf("\"%s\"\n", p.payload.bytes); + fileToAppend.printf("%i,", mp.rx_rssi); // RX RSSI + fileToAppend.flush(); fileToAppend.close(); From 07d354fa02e7d9843fac8d22d4db9027165a0044 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:42:36 +0200 Subject: [PATCH 2/3] Move airtime calculation to when Tx is complete (#8427) --- src/mesh/RadioLibInterface.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 2567d9e7f..80e51b8bc 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -289,12 +289,7 @@ void RadioLibInterface::onNotify(uint32_t notification) // actual transmission as short as possible txp = txQueue.dequeue(); assert(txp); - bool sent = startSend(txp); - if (sent) { - // Packet has been sent, count it toward our TX airtime utilization. - uint32_t xmitMsec = getPacketTime(txp); - airTime->logAirtime(TX_LOG, xmitMsec); - } + startSend(txp); LOG_DEBUG("%d packets remain in the TX queue", txQueue.getMaxLen() - txQueue.getFree()); } } @@ -413,6 +408,10 @@ void RadioLibInterface::completeSending() sendingPacket = NULL; if (p) { + // Packet has been sent, count it toward our TX airtime utilization. + uint32_t xmitMsec = getPacketTime(p); + airTime->logAirtime(TX_LOG, xmitMsec); + txGood++; if (!isFromUs(p)) txRelay++; From 39780656ef58b9d928902c4dcc6c60e866b74a3e Mon Sep 17 00:00:00 2001 From: korbinianbauer <64415847+korbinianbauer@users.noreply.github.com> Date: Thu, 23 Oct 2025 16:15:12 +0200 Subject: [PATCH 3/3] Don't assign negative SNR to unsigned int type SNR-based contention windows are broken on systems with 64-bit long integers. Fixes #8430 --- src/mesh/RadioInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 31ec5acc5..3c0da4494 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -272,10 +272,10 @@ uint32_t RadioInterface::getTxDelayMsec() uint8_t RadioInterface::getCWsize(float snr) { // The minimum value for a LoRa SNR - const uint32_t SNR_MIN = -20; + const int32_t SNR_MIN = -20; // The maximum value for a LoRa SNR - const uint32_t SNR_MAX = 10; + const int32_t SNR_MAX = 10; return map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax); }