Browse Source
Merge pull request #563 from Cisien/cisien/add-rx-time
Add a counter to track rx time for repeater stats
pull/571/head
ripplebiz
10 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
7 additions and
3 deletions
-
examples/simple_repeater/main.cpp
-
src/Dispatcher.cpp
-
src/Dispatcher.h
|
|
|
@ -98,6 +98,7 @@ struct RepeaterStats { |
|
|
|
uint16_t err_events; // was 'n_full_events'
|
|
|
|
int16_t last_snr; // x 4
|
|
|
|
uint16_t n_direct_dups, n_flood_dups; |
|
|
|
uint32_t total_rx_air_time_secs; |
|
|
|
}; |
|
|
|
|
|
|
|
struct ClientInfo { |
|
|
|
@ -208,6 +209,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks { |
|
|
|
stats.last_snr = (int16_t)(radio_driver.getLastSNR() * 4); |
|
|
|
stats.n_direct_dups = ((SimpleMeshTables *)getTables())->getNumDirectDups(); |
|
|
|
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups(); |
|
|
|
stats.total_rx_air_time_secs = getReceiveAirTime() / 1000; |
|
|
|
|
|
|
|
memcpy(&reply_data[4], &stats, sizeof(stats)); |
|
|
|
|
|
|
|
|
|
|
|
@ -159,6 +159,7 @@ void Dispatcher::checkRecv() { |
|
|
|
pkt->_snr = _radio->getLastSNR() * 4.0f; |
|
|
|
score = _radio->packetScore(_radio->getLastSNR(), len); |
|
|
|
air_time = _radio->getEstAirtimeFor(len); |
|
|
|
rx_air_time += air_time; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -169,9 +170,9 @@ void Dispatcher::checkRecv() { |
|
|
|
if (pkt) { |
|
|
|
#if MESH_PACKET_LOGGING |
|
|
|
Serial.print(getLogDateTime()); |
|
|
|
Serial.printf(": RX, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d", |
|
|
|
Serial.printf(": RX, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d time=%d", |
|
|
|
pkt->getRawLength(), pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len, |
|
|
|
(int)pkt->getSNR(), (int)_radio->getLastRSSI(), (int)(score*1000)); |
|
|
|
(int)pkt->getSNR(), (int)_radio->getLastRSSI(), (int)(score*1000), air_time); |
|
|
|
|
|
|
|
static uint8_t packet_hash[MAX_HASH_SIZE]; |
|
|
|
pkt->calculatePacketHash(packet_hash); |
|
|
|
|
|
|
|
@ -114,7 +114,7 @@ typedef uint32_t DispatcherAction; |
|
|
|
*/ |
|
|
|
class Dispatcher { |
|
|
|
Packet* outbound; // current outbound packet
|
|
|
|
unsigned long outbound_expiry, outbound_start, total_air_time; |
|
|
|
unsigned long outbound_expiry, outbound_start, total_air_time, rx_air_time; |
|
|
|
unsigned long next_tx_time; |
|
|
|
unsigned long cad_busy_start; |
|
|
|
unsigned long radio_nonrx_start; |
|
|
|
@ -167,6 +167,7 @@ public: |
|
|
|
void sendPacket(Packet* packet, uint8_t priority, uint32_t delay_millis=0); |
|
|
|
|
|
|
|
unsigned long getTotalAirTime() const { return total_air_time; } // in milliseconds
|
|
|
|
unsigned long getReceiveAirTime() const {return rx_air_time; } |
|
|
|
uint32_t getNumSentFlood() const { return n_sent_flood; } |
|
|
|
uint32_t getNumSentDirect() const { return n_sent_direct; } |
|
|
|
uint32_t getNumRecvFlood() const { return n_recv_flood; } |
|
|
|
|