* Repeater: neighbour table now only of other repeaters

This commit is contained in:
Scott Powell
2025-04-30 18:43:48 +10:00
parent f261599608
commit 056bcf83d9

View File

@@ -403,9 +403,12 @@ protected:
// if this a zero hop advert, add it to neighbours // if this a zero hop advert, add it to neighbours
if (packet->path_len == 0) { if (packet->path_len == 0) {
AdvertDataParser parser(app_data, app_data_len);
if (parser.isValid() && parser.getType() == ADV_TYPE_REPEATER) { // just keep neigbouring Repeaters
putNeighbour(id, timestamp, packet->getSNR()); putNeighbour(id, timestamp, packet->getSNR());
} }
} }
}
void onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_idx, const uint8_t* secret, uint8_t* data, size_t len) override { void onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_idx, const uint8_t* secret, uint8_t* data, size_t len) override {
int i = matching_peer_indexes[sender_idx]; int i = matching_peer_indexes[sender_idx];
@@ -481,7 +484,7 @@ protected:
} else if (memcmp(command, "neighbors", 9) == 0) { } else if (memcmp(command, "neighbors", 9) == 0) {
char *dp = reply; char *dp = reply;
for (int i = 0; i < MAX_NEIGHBOURS && dp - reply < 130; i++) { for (int i = 0; i < MAX_NEIGHBOURS && dp - reply < 136; i++) {
NeighbourInfo* neighbour = &neighbours[i]; NeighbourInfo* neighbour = &neighbours[i];
if (neighbour->heard_timestamp == 0) continue; // skip empty slots if (neighbour->heard_timestamp == 0) continue; // skip empty slots