mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-27 15:02:41 +00:00
Merge pull request #8432 from korbinianbauer/develop
Don't use unsigned integer type for negative SNR value
This commit is contained in:
commit
585d9d36a8
@ -272,10 +272,10 @@ uint32_t RadioInterface::getTxDelayMsec()
|
|||||||
uint8_t RadioInterface::getCWsize(float snr)
|
uint8_t RadioInterface::getCWsize(float snr)
|
||||||
{
|
{
|
||||||
// The minimum value for a LoRa 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
|
// 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);
|
return map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -289,12 +289,7 @@ void RadioLibInterface::onNotify(uint32_t notification)
|
|||||||
// actual transmission as short as possible
|
// actual transmission as short as possible
|
||||||
txp = txQueue.dequeue();
|
txp = txQueue.dequeue();
|
||||||
assert(txp);
|
assert(txp);
|
||||||
bool sent = startSend(txp);
|
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);
|
|
||||||
}
|
|
||||||
LOG_DEBUG("%d packets remain in the TX queue", txQueue.getMaxLen() - txQueue.getFree());
|
LOG_DEBUG("%d packets remain in the TX queue", txQueue.getMaxLen() - txQueue.getFree());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -413,6 +408,10 @@ void RadioLibInterface::completeSending()
|
|||||||
sendingPacket = NULL;
|
sendingPacket = NULL;
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
|
// Packet has been sent, count it toward our TX airtime utilization.
|
||||||
|
uint32_t xmitMsec = getPacketTime(p);
|
||||||
|
airTime->logAirtime(TX_LOG, xmitMsec);
|
||||||
|
|
||||||
txGood++;
|
txGood++;
|
||||||
if (!isFromUs(p))
|
if (!isFromUs(p))
|
||||||
txRelay++;
|
txRelay++;
|
||||||
|
|||||||
@ -159,6 +159,7 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const meshtastic_MeshPacket
|
|||||||
LOG_DEBUG("---- Received Packet:");
|
LOG_DEBUG("---- Received Packet:");
|
||||||
LOG_DEBUG("mp.from %d", mp.from);
|
LOG_DEBUG("mp.from %d", mp.from);
|
||||||
LOG_DEBUG("mp.rx_snr %f", mp.rx_snr);
|
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("mp.hop_limit %d", mp.hop_limit);
|
||||||
LOG_DEBUG("---- Node Information of Received Packet (mp.from):");
|
LOG_DEBUG("---- Node Information of Received Packet (mp.from):");
|
||||||
LOG_DEBUG("n->user.long_name %s", n->user.long_name);
|
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
|
// Print the CSV header
|
||||||
if (fileToWrite.println(
|
if (fileToWrite.println("time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx "
|
||||||
"time,from,sender name,sender lat,sender long,rx lat,rx long,rx elevation,rx snr,distance,hop limit,payload")) {
|
"snr,distance,hop limit,payload,rx rssi")) {
|
||||||
LOG_INFO("File was written");
|
LOG_INFO("File was written");
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("File write failed");
|
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.
|
// TODO: If quotes are found in the payload, it has to be escaped.
|
||||||
fileToAppend.printf("\"%s\"\n", p.payload.bytes);
|
fileToAppend.printf("\"%s\"\n", p.payload.bytes);
|
||||||
|
fileToAppend.printf("%i,", mp.rx_rssi); // RX RSSI
|
||||||
|
|
||||||
fileToAppend.flush();
|
fileToAppend.flush();
|
||||||
fileToAppend.close();
|
fileToAppend.close();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user