* repeater: Get Stats new fields added: n_direct_dups, n_flood_dups
This commit is contained in:
@@ -106,6 +106,7 @@ struct RepeaterStats {
|
|||||||
uint32_t n_sent_flood, n_sent_direct;
|
uint32_t n_sent_flood, n_sent_direct;
|
||||||
uint32_t n_recv_flood, n_recv_direct;
|
uint32_t n_recv_flood, n_recv_direct;
|
||||||
uint32_t n_full_events;
|
uint32_t n_full_events;
|
||||||
|
uint16_t n_direct_dups, n_flood_dups;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ClientInfo {
|
struct ClientInfo {
|
||||||
@@ -183,6 +184,8 @@ class MyMesh : public mesh::Mesh {
|
|||||||
stats.n_recv_flood = getNumRecvFlood();
|
stats.n_recv_flood = getNumRecvFlood();
|
||||||
stats.n_recv_direct = getNumRecvDirect();
|
stats.n_recv_direct = getNumRecvDirect();
|
||||||
stats.n_full_events = getNumFullEvents();
|
stats.n_full_events = getNumFullEvents();
|
||||||
|
stats.n_direct_dups = ((SimpleMeshTables *)getTables())->getNumDirectDups();
|
||||||
|
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups();
|
||||||
|
|
||||||
memcpy(&reply_data[4], &stats, sizeof(stats));
|
memcpy(&reply_data[4], &stats, sizeof(stats));
|
||||||
|
|
||||||
@@ -467,7 +470,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyMesh(mesh::MainBoard& board, RadioLibWrapper& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
|
MyMesh(mesh::MainBoard& board, RadioLibWrapper& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, SimpleMeshTables& tables)
|
||||||
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables), _board(&board)
|
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables), _board(&board)
|
||||||
{
|
{
|
||||||
my_radio = &radio;
|
my_radio = &radio;
|
||||||
@@ -734,7 +737,7 @@ void setup() {
|
|||||||
#else
|
#else
|
||||||
float tcxo = 1.6f;
|
float tcxo = 1.6f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ protected:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MeshTables* getTables() const { return _tables; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void begin();
|
void begin();
|
||||||
void loop();
|
void loop();
|
||||||
|
|||||||
@@ -11,11 +11,13 @@
|
|||||||
class SimpleMeshTables : public mesh::MeshTables {
|
class SimpleMeshTables : public mesh::MeshTables {
|
||||||
uint8_t _hashes[MAX_PACKET_HASHES*MAX_HASH_SIZE];
|
uint8_t _hashes[MAX_PACKET_HASHES*MAX_HASH_SIZE];
|
||||||
int _next_idx;
|
int _next_idx;
|
||||||
|
uint32_t _direct_dups, _flood_dups;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SimpleMeshTables() {
|
SimpleMeshTables() {
|
||||||
memset(_hashes, 0, sizeof(_hashes));
|
memset(_hashes, 0, sizeof(_hashes));
|
||||||
_next_idx = 0;
|
_next_idx = 0;
|
||||||
|
_direct_dups = _flood_dups = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
@@ -35,7 +37,14 @@ public:
|
|||||||
|
|
||||||
const uint8_t* sp = _hashes;
|
const uint8_t* sp = _hashes;
|
||||||
for (int i = 0; i < MAX_PACKET_HASHES; i++, sp += MAX_HASH_SIZE) {
|
for (int i = 0; i < MAX_PACKET_HASHES; i++, sp += MAX_HASH_SIZE) {
|
||||||
if (memcmp(hash, sp, MAX_HASH_SIZE) == 0) return true;
|
if (memcmp(hash, sp, MAX_HASH_SIZE) == 0) {
|
||||||
|
if (packet->isRouteDirect()) {
|
||||||
|
_direct_dups++; // keep some stats
|
||||||
|
} else {
|
||||||
|
_flood_dups++;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&_hashes[_next_idx*MAX_HASH_SIZE], hash, MAX_HASH_SIZE);
|
memcpy(&_hashes[_next_idx*MAX_HASH_SIZE], hash, MAX_HASH_SIZE);
|
||||||
@@ -44,5 +53,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getNumDirectDups() const { return _direct_dups; }
|
||||||
|
uint32_t getNumFloodDups() const { return _flood_dups; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user