diff --git a/proto b/proto index 323b814f..ce422b7c 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 323b814f4392ae0f9c42a0f14557c6b9333efce3 +Subproject commit ce422b7c448906c6fee3eef64bbd41adfbc990f0 diff --git a/src/airtime.h b/src/airtime.h index 0324cd56..482ab394 100644 --- a/src/airtime.h +++ b/src/airtime.h @@ -4,6 +4,24 @@ #include #include +/* + TX_LOG - Time on air this device has transmitted + + RX_LOG - Time on air used by valid and routable mesh packets, does not include + TX air time + + RX_ALL_LOG - Time of all received lora packets. This includes packets that are not + for meshtastic devices. Does not include TX air time. + + Example analytics: + + TX_LOG + RX_LOG = Total air time for a perticular meshtastic channel. + + TX_LOG + RX_LOG = Total air time for a perticular meshtastic channel, including + other lora radios. + + RX_ALL_LOG - RX_LOG = Other lora radios on our frequency channel. +*/ enum reportTypes { TX_LOG, RX_LOG, RX_ALL_LOG }; void logAirtime(reportTypes reportType, uint32_t airtime_ms); diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index c8159745..f4ceeded 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -58,7 +58,6 @@ void INTERRUPT_ATTR RadioLibInterface::isrTxLevel0() */ RadioLibInterface *RadioLibInterface::instance; - /** Could we send right now (i.e. either not actively receving or transmitting)? */ bool RadioLibInterface::canSendImmediately() { @@ -88,7 +87,6 @@ ErrorCode RadioLibInterface::send(MeshPacket *p) printPacket("enqueuing for send", p); uint32_t xmitMsec = getPacketTime(p); - DEBUG_MSG("txGood=%d,rxGood=%d,rxBad=%d\n", txGood, rxGood, rxBad); ErrorCode res = txQueue.enqueue(p, 0) ? ERRNO_OK : ERRNO_UNKNOWN; @@ -100,7 +98,6 @@ ErrorCode RadioLibInterface::send(MeshPacket *p) // Count the packet toward our TX airtime utilization. // We only count it if it can be added to the TX queue. 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 // 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 @@ -211,12 +208,16 @@ void RadioLibInterface::completeSending() void RadioLibInterface::handleReceiveInterrupt() { + uint32_t xmitMsec; assert(isReceiving); isReceiving = false; // read the number of actually received bytes size_t length = iface->getPacketLength(); + xmitMsec = getPacketTime(length); + logAirtime(RX_ALL_LOG, xmitMsec); + int state = iface->readData(radiobuf, length); if (state != ERR_NONE) { DEBUG_MSG("ignoring received packet due to error=%d\n", state); @@ -256,11 +257,14 @@ void RadioLibInterface::handleReceiveInterrupt() printPacket("Lora RX", mp); + xmitMsec = getPacketTime(mp); + logAirtime(RX_LOG, xmitMsec); + deliverToReceiver(mp); } } } - + /** start an immediate transmit */ void RadioLibInterface::startSend(MeshPacket *txp) {