mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-03 03:09:59 +00:00
Count tx airtime only after it's sent by the radio
This commit is contained in:
parent
c00c2744bf
commit
9a87ec7353
@ -101,7 +101,6 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
|||||||
// Sometimes when testing it is useful to be able to never turn on the xmitter
|
// Sometimes when testing it is useful to be able to never turn on the xmitter
|
||||||
#ifndef LORA_DISABLE_SENDING
|
#ifndef LORA_DISABLE_SENDING
|
||||||
printPacket("enqueuing for send", p);
|
printPacket("enqueuing for send", p);
|
||||||
uint32_t xmitMsec = getPacketTime(p);
|
|
||||||
|
|
||||||
DEBUG_MSG("txGood=%d,rxGood=%d,rxBad=%d\n", txGood, rxGood, rxBad);
|
DEBUG_MSG("txGood=%d,rxGood=%d,rxBad=%d\n", txGood, rxGood, rxBad);
|
||||||
ErrorCode res = txQueue.enqueue(p) ? ERRNO_OK : ERRNO_UNKNOWN;
|
ErrorCode res = txQueue.enqueue(p) ? ERRNO_OK : ERRNO_UNKNOWN;
|
||||||
@ -111,10 +110,6 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count the packet toward our TX airtime utilization.
|
|
||||||
// We only count it if it can be added to the TX queue.
|
|
||||||
airTime->logAirtime(TX_LOG, xmitMsec);
|
|
||||||
|
|
||||||
// We want all sending/receiving to be done by our daemon thread, We use a delay here because this packet might have been sent
|
// We want all sending/receiving to be done by our daemon thread, We use a delay here because this packet might have been sent
|
||||||
// in response to a packet we just received. So we want to make sure the other side has had a chance to reconfigure its radio
|
// in response to a packet we just received. So we want to make sure the other side has had a chance to reconfigure its radio
|
||||||
startTransmitTimer(true);
|
startTransmitTimer(true);
|
||||||
@ -188,6 +183,10 @@ void RadioLibInterface::onNotify(uint32_t notification)
|
|||||||
MeshPacket *txp = txQueue.dequeue();
|
MeshPacket *txp = txQueue.dequeue();
|
||||||
assert(txp);
|
assert(txp);
|
||||||
startSend(txp);
|
startSend(txp);
|
||||||
|
|
||||||
|
// Packet has been sent, count it toward our TX airtime utilization.
|
||||||
|
uint32_t xmitMsec = getPacketTime(txp);
|
||||||
|
airTime->logAirtime(TX_LOG, xmitMsec);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// DEBUG_MSG("done with txqueue\n");
|
// DEBUG_MSG("done with txqueue\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user