fixed missing bytes from radio packet

This commit is contained in:
medentem 2024-12-28 12:22:49 -06:00
parent f9c7471c31
commit 5755ebaafc
2 changed files with 25 additions and 0 deletions

View File

@ -15,6 +15,22 @@ ErrorCode FloodingRouter::send(meshtastic_MeshPacket *p)
// Add any messages _we_ send to the seen message list (so we will ignore all retransmissions we see)
wasSeenRecently(p); // FIXME, move this to a sniffSent method
// -- START coverage filter population --
// If this is a floodable packet (for example, has non-zero hop_limit and ID),
// we can add our coverage.
if (p->id != 0 && p->hop_limit > 0) {
CoverageFilter coverage;
// Is there anything upstream of this? I think not, but if so, we need to merge coverage.
// loadCoverageFilterFromPacket(p, coverage);
// Add our coverage (neighbors, etc.) so they are in the filter from the get-go
mergeMyCoverage(coverage);
// Save the coverage bits into the packet:
storeCoverageFilterInPacket(coverage, p);
}
// -- END coverage filter population --
return Router::send(p);
}

View File

@ -634,6 +634,15 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p)
p->hop_limit | (p->want_ack ? PACKET_FLAGS_WANT_ACK_MASK : 0) | (p->via_mqtt ? PACKET_FLAGS_VIA_MQTT_MASK : 0);
radioBuffer.header.flags |= (p->hop_start << PACKET_FLAGS_HOP_START_SHIFT) & PACKET_FLAGS_HOP_START_MASK;
// Coverage filter is 16 bytes, but p->coverage_filter.size might be 0..16.
// Usually, you set p->coverage_filter.size = 16 if you want to transmit.
radioBuffer.header.coverage_filter.fill(0); // Clear first, in case size < 16
if (p->coverage_filter.size > 0) {
memcpy(radioBuffer.header.coverage_filter.data(),
p->coverage_filter.bytes,
std::min((size_t)p->coverage_filter.size, (size_t)BLOOM_FILTER_SIZE_BYTES));
}
// if the sender nodenum is zero, that means uninitialized
assert(radioBuffer.header.from);