Reduce neighbor discovery RAM without changing published results
This commit is contained in:
1 parent
5fa06ea49b
commit
1eb8c19a1b
5 files changed
+261
-8
No files matched your search
@@ -13428,6 +13428,11 @@ void MyMesh::resetNeighborDiscoverJsonBudget() {
|
||||
// progress metadata; UINT32_MAX likewise reserves the widest heard-age value.
|
||||
// If this result cannot fit, stop before transmitting another scope request.
|
||||
bool MyMesh::completeNeighborDiscoverEntry() {
|
||||
if ((size_t)neighbor_discover_next >= NEIGHBOR_SCOPE_RESULTS) {
|
||||
neighbor_discover_truncated = true;
|
||||
finishNeighborDiscover();
|
||||
return false;
|
||||
}
|
||||
NeighborDiscoverEntry& entry = neighbor_discover[neighbor_discover_next];
|
||||
char pubkey_hex[65];
|
||||
mesh::Utils::toHex(pubkey_hex, entry.id.pub_key, PUB_KEY_SIZE);
|
||||
|
||||
@@ -701,9 +701,9 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks
|
||||
struct NeighborDiscoverEntry {
|
||||
mesh::Identity id; // immutable snapshot: neighbour table can change mid-pass
|
||||
uint32_t heard_timestamp;
|
||||
int8_t snr; // multiplied by 4
|
||||
int16_t rssi; // dBm from the last packet heard from this neighbour
|
||||
uint32_t tag; // anon-regions request tag we're waiting on
|
||||
int16_t rssi; // dBm from the last packet heard from this neighbour
|
||||
int8_t snr; // multiplied by 4
|
||||
uint8_t status; // NeighborDiscoverStatus
|
||||
};
|
||||
NeighborDiscoverEntry neighbor_discover[MAX_NEIGHBOURS];
|
||||
@@ -711,8 +711,8 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks
|
||||
// receives scope queries. Keep every neighbor snapshot, without reserving
|
||||
// 96 response bytes for each entry that will never be queried.
|
||||
static constexpr size_t NEIGHBOR_SCOPE_RESULTS =
|
||||
MAX_NEIGHBOURS < MQTTBridge::NEIGHBORS_MAX_PUBLISH_ENTRIES + 1
|
||||
? MAX_NEIGHBOURS : MQTTBridge::NEIGHBORS_MAX_PUBLISH_ENTRIES + 1;
|
||||
MAX_NEIGHBOURS < MQTTBridge::NEIGHBORS_SCOPE_RESULT_CAPACITY
|
||||
? MAX_NEIGHBOURS : MQTTBridge::NEIGHBORS_SCOPE_RESULT_CAPACITY;
|
||||
char neighbor_discover_scopes[NEIGHBOR_SCOPE_RESULTS][96];
|
||||
uint8_t neighbor_discover_count;
|
||||
uint8_t neighbor_discover_next; // newest-first entry currently being queried
|
||||
|
||||
Reference in new issue
Block a user