Skip to content

Commit 07d354f

Browse files
authored
Move airtime calculation to when Tx is complete (#8427)
1 parent 15ee1c2 commit 07d354f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/mesh/RadioLibInterface.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,7 @@ void RadioLibInterface::onNotify(uint32_t notification)
289289
// actual transmission as short as possible
290290
txp = txQueue.dequeue();
291291
assert(txp);
292-
bool sent = startSend(txp);
293-
if (sent) {
294-
// Packet has been sent, count it toward our TX airtime utilization.
295-
uint32_t xmitMsec = getPacketTime(txp);
296-
airTime->logAirtime(TX_LOG, xmitMsec);
297-
}
292+
startSend(txp);
298293
LOG_DEBUG("%d packets remain in the TX queue", txQueue.getMaxLen() - txQueue.getFree());
299294
}
300295
}
@@ -413,6 +408,10 @@ void RadioLibInterface::completeSending()
413408
sendingPacket = NULL;
414409

415410
if (p) {
411+
// Packet has been sent, count it toward our TX airtime utilization.
412+
uint32_t xmitMsec = getPacketTime(p);
413+
airTime->logAirtime(TX_LOG, xmitMsec);
414+
416415
txGood++;
417416
if (!isFromUs(p))
418417
txRelay++;

0 commit comments

Comments
 (0)