fix(mesh): sendZeroHop mazal šířku path hashe, uzel se hlásil jako 1bajtový
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
480582f344
commit
89f08f76b7
3 files changed
+20
-10
No files matched your search
+8
-4
@@ -725,24 +725,28 @@ void Mesh::sendDirect(Packet* packet, const uint8_t* path, uint8_t path_len, uin
|
||||
sendPacket(packet, pri, delay_millis);
|
||||
}
|
||||
|
||||
void Mesh::sendZeroHop(Packet* packet, uint32_t delay_millis) {
|
||||
void Mesh::sendZeroHop(Packet* packet, uint32_t delay_millis, uint8_t path_hash_size) {
|
||||
packet->header &= ~PH_ROUTE_MASK;
|
||||
packet->header |= ROUTE_TYPE_DIRECT;
|
||||
|
||||
packet->path_len = 0; // path_len of zero means Zero Hop
|
||||
// Zero Hop = nulový počet hopů. POZOR, dřív tu bylo `packet->path_len = 0`,
|
||||
// což vynulovalo CELÝ bajt — a v jeho horních dvou bitech bydlí šířka hashe
|
||||
// (Packet.h:85). Každý zerohop paket proto hlásil 1 B bez ohledu na
|
||||
// nastavení uzlu a v analyzerech kreslil dvoubajtový uzel jako jednobajtový.
|
||||
packet->setPathHashSizeAndCount(path_hash_size, 0);
|
||||
|
||||
_tables->markSeen(packet); // mark this packet as already sent in case it is rebroadcast back to us
|
||||
|
||||
sendPacket(packet, 0, delay_millis);
|
||||
}
|
||||
|
||||
void Mesh::sendZeroHop(Packet* packet, uint16_t* transport_codes, uint32_t delay_millis) {
|
||||
void Mesh::sendZeroHop(Packet* packet, uint16_t* transport_codes, uint32_t delay_millis, uint8_t path_hash_size) {
|
||||
packet->header &= ~PH_ROUTE_MASK;
|
||||
packet->header |= ROUTE_TYPE_TRANSPORT_DIRECT;
|
||||
packet->transport_codes[0] = transport_codes[0];
|
||||
packet->transport_codes[1] = transport_codes[1];
|
||||
|
||||
packet->path_len = 0; // path_len of zero means Zero Hop
|
||||
packet->setPathHashSizeAndCount(path_hash_size, 0); // viz komentář výš
|
||||
|
||||
_tables->markSeen(packet); // mark this packet as already sent in case it is rebroadcast back to us
|
||||
|
||||
|
||||
+5
-2
@@ -215,13 +215,16 @@ public:
|
||||
/**
|
||||
* \brief send a locally-generated Packet to just neighbor nodes (zero hops)
|
||||
*/
|
||||
void sendZeroHop(Packet* packet, uint32_t delay_millis=0);
|
||||
// `path_hash_size` tu je ze stejného důvodu jako u sendFlood: zerohop paket
|
||||
// sice cestu nenese, ale ta šířka je v hlavičce a analyzery z ní odvozují,
|
||||
// na kolika bajtech uzel jede. Bez toho parametru hlásí každý zerohop 1 B.
|
||||
void sendZeroHop(Packet* packet, uint32_t delay_millis=0, uint8_t path_hash_size=1);
|
||||
|
||||
/**
|
||||
* \brief send a locally-generated Packet to just neighbor nodes (zero hops), with specific transport codes
|
||||
* \param transport_codes array of 2 codes to attach to packet
|
||||
*/
|
||||
void sendZeroHop(Packet* packet, uint16_t* transport_codes, uint32_t delay_millis=0);
|
||||
void sendZeroHop(Packet* packet, uint16_t* transport_codes, uint32_t delay_millis=0, uint8_t path_hash_size=1);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user