mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge pull request #1477 from Cisien/dev
Expose a counter to track RadioLib receive errors
This commit is contained in:
commit
4b7684c7df
5 changed files with 9 additions and 5 deletions
|
|
@ -226,7 +226,7 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t
|
||||||
stats.n_direct_dups = ((SimpleMeshTables *)getTables())->getNumDirectDups();
|
stats.n_direct_dups = ((SimpleMeshTables *)getTables())->getNumDirectDups();
|
||||||
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups();
|
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups();
|
||||||
stats.total_rx_air_time_secs = getReceiveAirTime() / 1000;
|
stats.total_rx_air_time_secs = getReceiveAirTime() / 1000;
|
||||||
|
stats.n_recv_errors = radio_driver.getPacketsRecvErrors();
|
||||||
memcpy(&reply_data[4], &stats, sizeof(stats));
|
memcpy(&reply_data[4], &stats, sizeof(stats));
|
||||||
|
|
||||||
return 4 + sizeof(stats); // reply_len
|
return 4 + sizeof(stats); // reply_len
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ struct RepeaterStats {
|
||||||
int16_t last_snr; // x 4
|
int16_t last_snr; // x 4
|
||||||
uint16_t n_direct_dups, n_flood_dups;
|
uint16_t n_direct_dups, n_flood_dups;
|
||||||
uint32_t total_rx_air_time_secs;
|
uint32_t total_rx_air_time_secs;
|
||||||
|
uint32_t n_recv_errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef MAX_CLIENTS
|
#ifndef MAX_CLIENTS
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,14 @@ public:
|
||||||
uint32_t n_recv_flood,
|
uint32_t n_recv_flood,
|
||||||
uint32_t n_recv_direct) {
|
uint32_t n_recv_direct) {
|
||||||
sprintf(reply,
|
sprintf(reply,
|
||||||
"{\"recv\":%u,\"sent\":%u,\"flood_tx\":%u,\"direct_tx\":%u,\"flood_rx\":%u,\"direct_rx\":%u}",
|
"{\"recv\":%u,\"sent\":%u,\"flood_tx\":%u,\"direct_tx\":%u,\"flood_rx\":%u,\"direct_rx\":%u,\"recv_errors\":%u}",
|
||||||
driver.getPacketsRecv(),
|
driver.getPacketsRecv(),
|
||||||
driver.getPacketsSent(),
|
driver.getPacketsSent(),
|
||||||
n_sent_flood,
|
n_sent_flood,
|
||||||
n_sent_direct,
|
n_sent_direct,
|
||||||
n_recv_flood,
|
n_recv_flood,
|
||||||
n_recv_direct
|
n_recv_direct,
|
||||||
|
driver.getPacketsRecvErrors()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) {
|
||||||
if (err != RADIOLIB_ERR_NONE) {
|
if (err != RADIOLIB_ERR_NONE) {
|
||||||
MESH_DEBUG_PRINTLN("RadioLibWrapper: error: readData(%d)", err);
|
MESH_DEBUG_PRINTLN("RadioLibWrapper: error: readData(%d)", err);
|
||||||
len = 0;
|
len = 0;
|
||||||
|
n_recv_errors++;
|
||||||
} else {
|
} else {
|
||||||
// Serial.print(" readData() -> "); Serial.println(len);
|
// Serial.print(" readData() -> "); Serial.println(len);
|
||||||
n_recv++;
|
n_recv++;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ class RadioLibWrapper : public mesh::Radio {
|
||||||
protected:
|
protected:
|
||||||
PhysicalLayer* _radio;
|
PhysicalLayer* _radio;
|
||||||
mesh::MainBoard* _board;
|
mesh::MainBoard* _board;
|
||||||
uint32_t n_recv, n_sent;
|
uint32_t n_recv, n_sent, n_recv_errors;
|
||||||
int16_t _noise_floor, _threshold;
|
int16_t _noise_floor, _threshold;
|
||||||
uint16_t _num_floor_samples;
|
uint16_t _num_floor_samples;
|
||||||
int32_t _floor_sample_sum;
|
int32_t _floor_sample_sum;
|
||||||
|
|
@ -45,8 +45,9 @@ public:
|
||||||
void loop() override;
|
void loop() override;
|
||||||
|
|
||||||
uint32_t getPacketsRecv() const { return n_recv; }
|
uint32_t getPacketsRecv() const { return n_recv; }
|
||||||
|
uint32_t getPacketsRecvErrors() const { return n_recv_errors; }
|
||||||
uint32_t getPacketsSent() const { return n_sent; }
|
uint32_t getPacketsSent() const { return n_sent; }
|
||||||
void resetStats() { n_recv = n_sent = 0; }
|
void resetStats() { n_recv = n_sent = n_recv_errors = 0; }
|
||||||
|
|
||||||
virtual float getLastRSSI() const override;
|
virtual float getLastRSSI() const override;
|
||||||
virtual float getLastSNR() const override;
|
virtual float getLastSNR() const override;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue