Skip to content

Commit ca81f64

Browse files
author
Scott Powell
committed
Merge branch 'multibyte-paths' into dev
2 parents 5280433 + def0188 commit ca81f64

File tree

23 files changed

+297
-196
lines changed

23 files changed

+297
-196
lines changed

examples/companion_radio/DataStore.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
222222
file.read((uint8_t *)&_prefs.rx_delay_base, sizeof(_prefs.rx_delay_base)); // 72
223223
file.read((uint8_t *)&_prefs.advert_loc_policy, sizeof(_prefs.advert_loc_policy)); // 76
224224
file.read((uint8_t *)&_prefs.multi_acks, sizeof(_prefs.multi_acks)); // 77
225-
file.read(pad, 2); // 78
225+
file.read((uint8_t *)&_prefs.path_hash_mode, sizeof(_prefs.path_hash_mode)); // 78
226+
file.read(pad, 1); // 79
226227
file.read((uint8_t *)&_prefs.ble_pin, sizeof(_prefs.ble_pin)); // 80
227228
file.read((uint8_t *)&_prefs.buzzer_quiet, sizeof(_prefs.buzzer_quiet)); // 84
228229
file.read((uint8_t *)&_prefs.gps_enabled, sizeof(_prefs.gps_enabled)); // 85
@@ -257,7 +258,8 @@ void DataStore::savePrefs(const NodePrefs& _prefs, double node_lat, double node_
257258
file.write((uint8_t *)&_prefs.rx_delay_base, sizeof(_prefs.rx_delay_base)); // 72
258259
file.write((uint8_t *)&_prefs.advert_loc_policy, sizeof(_prefs.advert_loc_policy)); // 76
259260
file.write((uint8_t *)&_prefs.multi_acks, sizeof(_prefs.multi_acks)); // 77
260-
file.write(pad, 2); // 78
261+
file.write((uint8_t *)&_prefs.path_hash_mode, sizeof(_prefs.path_hash_mode)); // 78
262+
file.write(pad, 1); // 79
261263
file.write((uint8_t *)&_prefs.ble_pin, sizeof(_prefs.ble_pin)); // 80
262264
file.write((uint8_t *)&_prefs.buzzer_quiet, sizeof(_prefs.buzzer_quiet)); // 84
263265
file.write((uint8_t *)&_prefs.gps_enabled, sizeof(_prefs.gps_enabled)); // 85

examples/companion_radio/MyMesh.cpp

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#define CMD_SET_AUTOADD_CONFIG 58
5858
#define CMD_GET_AUTOADD_CONFIG 59
5959
#define CMD_GET_ALLOWED_REPEAT_FREQ 60
60+
#define CMD_SET_PATH_HASH_MODE 61
6061

6162
// Stats sub-types for CMD_GET_STATS
6263
#define STATS_TYPE_CORE 0
@@ -258,11 +259,11 @@ int MyMesh::calcRxDelay(float score, uint32_t air_time) const {
258259
}
259260

260261
uint32_t MyMesh::getRetransmitDelay(const mesh::Packet *packet) {
261-
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * 0.5f);
262+
uint32_t t = (_radio->getEstAirtimeFor(packet->getPathByteLen() + packet->payload_len + 2) * 0.5f);
262263
return getRNG()->nextInt(0, 5*t + 1);
263264
}
264265
uint32_t MyMesh::getDirectRetransmitDelay(const mesh::Packet *packet) {
265-
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * 0.2f);
266+
uint32_t t = (_radio->getEstAirtimeFor(packet->getPathByteLen() + packet->payload_len + 2) * 0.2f);
266267
return getRNG()->nextInt(0, 5*t + 1);
267268
}
268269

@@ -349,7 +350,7 @@ void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path
349350
}
350351

351352
// add inbound-path to mem cache
352-
if (path && path_len <= sizeof(AdvertPath::path)) { // check path is valid
353+
if (path && mesh::Packet::isValidPathLen(path_len)) { // check path is valid
353354
AdvertPath* p = advert_paths;
354355
uint32_t oldest = 0xFFFFFFFF;
355356
for (int i = 0; i < ADVERT_PATH_TABLE_SIZE; i++) { // check if already in table, otherwise evict oldest
@@ -366,8 +367,7 @@ void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path
366367
memcpy(p->pubkey_prefix, contact.id.pub_key, sizeof(p->pubkey_prefix));
367368
strcpy(p->name, contact.name);
368369
p->recv_timestamp = getRTCClock()->getCurrentTime();
369-
p->path_len = path_len;
370-
memcpy(p->path, path, p->path_len);
370+
p->path_len = mesh::Packet::copyPath(p->path, path, path_len);
371371
}
372372

373373
if (!is_new) dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY); // only schedule lazy write for contacts that are in contacts[]
@@ -473,23 +473,23 @@ bool MyMesh::allowPacketForward(const mesh::Packet* packet) {
473473
void MyMesh::sendFloodScoped(const ContactInfo& recipient, mesh::Packet* pkt, uint32_t delay_millis) {
474474
// TODO: dynamic send_scope, depending on recipient and current 'home' Region
475475
if (send_scope.isNull()) {
476-
sendFlood(pkt, delay_millis);
476+
sendFlood(pkt, delay_millis, _prefs.path_hash_mode + 1);
477477
} else {
478478
uint16_t codes[2];
479479
codes[0] = send_scope.calcTransportCode(pkt);
480480
codes[1] = 0; // REVISIT: set to 'home' Region, for sender/return region?
481-
sendFlood(pkt, codes, delay_millis);
481+
sendFlood(pkt, codes, delay_millis, _prefs.path_hash_mode + 1);
482482
}
483483
}
484484
void MyMesh::sendFloodScoped(const mesh::GroupChannel& channel, mesh::Packet* pkt, uint32_t delay_millis) {
485485
// TODO: have per-channel send_scope
486486
if (send_scope.isNull()) {
487-
sendFlood(pkt, delay_millis);
487+
sendFlood(pkt, delay_millis, _prefs.path_hash_mode + 1);
488488
} else {
489489
uint16_t codes[2];
490490
codes[0] = send_scope.calcTransportCode(pkt);
491491
codes[1] = 0; // REVISIT: set to 'home' Region, for sender/return region?
492-
sendFlood(pkt, codes, delay_millis);
492+
sendFlood(pkt, codes, delay_millis, _prefs.path_hash_mode + 1);
493493
}
494494
}
495495

@@ -686,7 +686,7 @@ bool MyMesh::onContactPathRecv(ContactInfo& contact, uint8_t* in_path, uint8_t i
686686
if (tag == pending_discovery) { // check for matching response tag)
687687
pending_discovery = 0;
688688

689-
if (in_path_len > MAX_PATH_SIZE || out_path_len > MAX_PATH_SIZE) {
689+
if (!mesh::Packet::isValidPathLen(in_path_len) || !mesh::Packet::isValidPathLen(out_path_len)) {
690690
MESH_DEBUG_PRINTLN("onContactPathRecv, invalid path sizes: %d, %d", in_path_len, out_path_len);
691691
} else {
692692
int i = 0;
@@ -695,11 +695,9 @@ bool MyMesh::onContactPathRecv(ContactInfo& contact, uint8_t* in_path, uint8_t i
695695
memcpy(&out_frame[i], contact.id.pub_key, 6);
696696
i += 6; // pub_key_prefix
697697
out_frame[i++] = out_path_len;
698-
memcpy(&out_frame[i], out_path, out_path_len);
699-
i += out_path_len;
698+
i += mesh::Packet::writePath(&out_frame[i], out_path, out_path_len);
700699
out_frame[i++] = in_path_len;
701-
memcpy(&out_frame[i], in_path, in_path_len);
702-
i += in_path_len;
700+
i += mesh::Packet::writePath(&out_frame[i], in_path, in_path_len);
703701
// NOTE: telemetry data in 'extra' is discarded at present
704702

705703
_serial->writeFrame(out_frame, i);
@@ -785,9 +783,10 @@ uint32_t MyMesh::calcFloodTimeoutMillisFor(uint32_t pkt_airtime_millis) const {
785783
return SEND_TIMEOUT_BASE_MILLIS + (FLOOD_SEND_TIMEOUT_FACTOR * pkt_airtime_millis);
786784
}
787785
uint32_t MyMesh::calcDirectTimeoutMillisFor(uint32_t pkt_airtime_millis, uint8_t path_len) const {
786+
uint8_t path_hash_count = path_len & 63;
788787
return SEND_TIMEOUT_BASE_MILLIS +
789788
((pkt_airtime_millis * DIRECT_SEND_PERHOP_FACTOR + DIRECT_SEND_PERHOP_EXTRA_MILLIS) *
790-
(path_len + 1));
789+
(path_hash_count + 1));
791790
}
792791

793792
void MyMesh::onSendTimeout() {}
@@ -938,6 +937,7 @@ void MyMesh::handleCmdFrame(size_t len) {
938937
StrHelper::strzcpy((char *)&out_frame[i], FIRMWARE_VERSION, 20);
939938
i += 20;
940939
out_frame[i++] = _prefs.client_repeat; // v9+
940+
out_frame[i++] = _prefs.path_hash_mode; // v10+
941941
_serial->writeFrame(out_frame, i);
942942
} else if (cmd_frame[0] == CMD_APP_START &&
943943
len >= 8) { // sent when app establishes connection, respond with node ID
@@ -1115,7 +1115,8 @@ void MyMesh::handleCmdFrame(size_t len) {
11151115
}
11161116
if (pkt) {
11171117
if (len >= 2 && cmd_frame[1] == 1) { // optional param (1 = flood, 0 = zero hop)
1118-
sendFlood(pkt);
1118+
unsigned long delay_millis = 0;
1119+
sendFlood(pkt, delay_millis, _prefs.path_hash_mode + 1);
11191120
} else {
11201121
sendZeroHop(pkt);
11211122
}
@@ -1127,7 +1128,7 @@ void MyMesh::handleCmdFrame(size_t len) {
11271128
uint8_t *pub_key = &cmd_frame[1];
11281129
ContactInfo *recipient = lookupContactByPubKey(pub_key, PUB_KEY_SIZE);
11291130
if (recipient) {
1130-
recipient->out_path_len = -1;
1131+
recipient->out_path_len = OUT_PATH_UNKNOWN;
11311132
// recipient->lastmod = ?? shouldn't be needed, app already has this version of contact
11321133
dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY);
11331134
writeOKFrame();
@@ -1312,6 +1313,14 @@ void MyMesh::handleCmdFrame(size_t len) {
13121313
}
13131314
savePrefs();
13141315
writeOKFrame();
1316+
} else if (cmd_frame[0] == CMD_SET_PATH_HASH_MODE && cmd_frame[1] == 0 && len >= 3) {
1317+
if (cmd_frame[2] >= 3) {
1318+
writeErrFrame(ERR_CODE_ILLEGAL_ARG);
1319+
} else {
1320+
_prefs.path_hash_mode = cmd_frame[2];
1321+
savePrefs();
1322+
writeOKFrame();
1323+
}
13151324
} else if (cmd_frame[0] == CMD_REBOOT && memcmp(&cmd_frame[1], "reboot", 6) == 0) {
13161325
if (dirty_contacts_expiry) { // is there are pending dirty contacts write needed?
13171326
saveContacts();
@@ -1449,7 +1458,7 @@ void MyMesh::handleCmdFrame(size_t len) {
14491458
memset(&req_data[2], 0, 3); // reserved
14501459
getRNG()->random(&req_data[5], 4); // random blob to help make packet-hash unique
14511460
auto save = recipient->out_path_len; // temporarily force sendRequest() to flood
1452-
recipient->out_path_len = -1;
1461+
recipient->out_path_len = OUT_PATH_UNKNOWN;
14531462
int result = sendRequest(*recipient, req_data, sizeof(req_data), tag, est_timeout);
14541463
recipient->out_path_len = save;
14551464
if (result == MSG_SEND_FAILED) {
@@ -1686,11 +1695,12 @@ void MyMesh::handleCmdFrame(size_t len) {
16861695
}
16871696
}
16881697
if (found) {
1689-
out_frame[0] = RESP_CODE_ADVERT_PATH;
1690-
memcpy(&out_frame[1], &found->recv_timestamp, 4);
1691-
out_frame[5] = found->path_len;
1692-
memcpy(&out_frame[6], found->path, found->path_len);
1693-
_serial->writeFrame(out_frame, 6 + found->path_len);
1698+
int i = 0;
1699+
out_frame[i++] = RESP_CODE_ADVERT_PATH;
1700+
memcpy(&out_frame[i], &found->recv_timestamp, 4); i += 4;
1701+
out_frame[i++] = found->path_len;
1702+
i += mesh::Packet::writePath(&out_frame[i], found->path, found->path_len);
1703+
_serial->writeFrame(out_frame, i);
16941704
} else {
16951705
writeErrFrame(ERR_CODE_NOT_FOUND);
16961706
}

examples/companion_radio/MyMesh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "AbstractUITask.h"
66

77
/*------------ Frame Protocol --------------*/
8-
#define FIRMWARE_VER_CODE 9
8+
#define FIRMWARE_VER_CODE 10
99

1010
#ifndef FIRMWARE_BUILD_DATE
1111
#define FIRMWARE_BUILD_DATE "15 Feb 2026"

examples/companion_radio/NodePrefs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ struct NodePrefs { // persisted to file
2929
uint32_t gps_interval; // GPS read interval in seconds
3030
uint8_t autoadd_config; // bitmask for auto-add contacts config
3131
uint8_t client_repeat;
32+
uint8_t path_hash_mode; // which path mode to use when sending
3233
};

examples/simple_repeater/MyMesh.cpp

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
129129
}
130130

131131
if (is_flood) {
132-
client->out_path_len = -1; // need to rediscover out_path
132+
client->out_path_len = OUT_PATH_UNKNOWN; // need to rediscover out_path
133133
}
134134

135135
uint32_t now = getRTCClock()->getCurrentTimeUnique();
@@ -147,9 +147,12 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
147147
uint8_t MyMesh::handleAnonRegionsReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data) {
148148
if (anon_limiter.allow(rtc_clock.getCurrentTime())) {
149149
// request data has: {reply-path-len}{reply-path}
150-
reply_path_len = *data++ & 0x3F;
151-
memcpy(reply_path, data, reply_path_len);
152-
// data += reply_path_len;
150+
reply_path_len = *data & 63;
151+
reply_path_hash_size = (*data >> 6) + 1;
152+
data++;
153+
154+
memcpy(reply_path, data, ((uint8_t)reply_path_len) * reply_path_hash_size);
155+
// data += (uint8_t)reply_path_len * reply_path_hash_size;
153156

154157
memcpy(reply_data, &sender_timestamp, 4); // prefix with sender_timestamp, like a tag
155158
uint32_t now = getRTCClock()->getCurrentTime();
@@ -163,9 +166,12 @@ uint8_t MyMesh::handleAnonRegionsReq(const mesh::Identity& sender, uint32_t send
163166
uint8_t MyMesh::handleAnonOwnerReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data) {
164167
if (anon_limiter.allow(rtc_clock.getCurrentTime())) {
165168
// request data has: {reply-path-len}{reply-path}
166-
reply_path_len = *data++ & 0x3F;
167-
memcpy(reply_path, data, reply_path_len);
168-
// data += reply_path_len;
169+
reply_path_len = *data & 63;
170+
reply_path_hash_size = (*data >> 6) + 1;
171+
data++;
172+
173+
memcpy(reply_path, data, ((uint8_t)reply_path_len) * reply_path_hash_size);
174+
// data += (uint8_t)reply_path_len * reply_path_hash_size;
169175

170176
memcpy(reply_data, &sender_timestamp, 4); // prefix with sender_timestamp, like a tag
171177
uint32_t now = getRTCClock()->getCurrentTime();
@@ -180,9 +186,12 @@ uint8_t MyMesh::handleAnonOwnerReq(const mesh::Identity& sender, uint32_t sender
180186
uint8_t MyMesh::handleAnonClockReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data) {
181187
if (anon_limiter.allow(rtc_clock.getCurrentTime())) {
182188
// request data has: {reply-path-len}{reply-path}
183-
reply_path_len = *data++ & 0x3F;
184-
memcpy(reply_path, data, reply_path_len);
185-
// data += reply_path_len;
189+
reply_path_len = *data & 63;
190+
reply_path_hash_size = (*data >> 6) + 1;
191+
data++;
192+
193+
memcpy(reply_path, data, ((uint8_t)reply_path_len) * reply_path_hash_size);
194+
// data += (uint8_t)reply_path_len * reply_path_hash_size;
186195

187196
memcpy(reply_data, &sender_timestamp, 4); // prefix with sender_timestamp, like a tag
188197
uint32_t now = getRTCClock()->getCurrentTime();
@@ -389,7 +398,7 @@ File MyMesh::openAppend(const char *fname) {
389398

390399
bool MyMesh::allowPacketForward(const mesh::Packet *packet) {
391400
if (_prefs.disable_fwd) return false;
392-
if (packet->isRouteFlood() && packet->path_len >= _prefs.flood_max) return false;
401+
if (packet->isRouteFlood() && packet->getPathHashCount() >= _prefs.flood_max) return false;
393402
if (packet->isRouteFlood() && recv_pkt_region == NULL) {
394403
MESH_DEBUG_PRINTLN("allowPacketForward: unknown transport code, or wildcard not allowed for FLOOD packet");
395404
return false;
@@ -484,11 +493,11 @@ int MyMesh::calcRxDelay(float score, uint32_t air_time) const {
484493
}
485494

486495
uint32_t MyMesh::getRetransmitDelay(const mesh::Packet *packet) {
487-
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.tx_delay_factor);
496+
uint32_t t = (_radio->getEstAirtimeFor(packet->getPathByteLen() + packet->payload_len + 2) * _prefs.tx_delay_factor);
488497
return getRNG()->nextInt(0, 5*t + 1);
489498
}
490499
uint32_t MyMesh::getDirectRetransmitDelay(const mesh::Packet *packet) {
491-
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.direct_tx_delay_factor);
500+
uint32_t t = (_radio->getEstAirtimeFor(packet->getPathByteLen() + packet->payload_len + 2) * _prefs.direct_tx_delay_factor);
492501
return getRNG()->nextInt(0, 5*t + 1);
493502
}
494503

@@ -538,13 +547,14 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
538547
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
539548
mesh::Packet* path = createPathReturn(sender, secret, packet->path, packet->path_len,
540549
PAYLOAD_TYPE_RESPONSE, reply_data, reply_len);
541-
if (path) sendFlood(path, SERVER_RESPONSE_DELAY);
550+
if (path) sendFlood(path, SERVER_RESPONSE_DELAY, packet->getPathHashSize());
542551
} else if (reply_path_len < 0) {
543552
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, secret, reply_data, reply_len);
544-
if (reply) sendFlood(reply, SERVER_RESPONSE_DELAY);
553+
if (reply) sendFlood(reply, SERVER_RESPONSE_DELAY, packet->getPathHashSize());
545554
} else {
546555
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, secret, reply_data, reply_len);
547-
if (reply) sendDirect(reply, reply_path, reply_path_len, SERVER_RESPONSE_DELAY);
556+
uint8_t path_len = ((reply_path_hash_size - 1) << 6) | (reply_path_len & 63);
557+
if (reply) sendDirect(reply, reply_path, path_len, SERVER_RESPONSE_DELAY);
548558
}
549559
}
550560
}
@@ -613,15 +623,15 @@ void MyMesh::onPeerDataRecv(mesh::Packet *packet, uint8_t type, int sender_idx,
613623
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
614624
mesh::Packet *path = createPathReturn(client->id, secret, packet->path, packet->path_len,
615625
PAYLOAD_TYPE_RESPONSE, reply_data, reply_len);
616-
if (path) sendFlood(path, SERVER_RESPONSE_DELAY);
626+
if (path) sendFlood(path, SERVER_RESPONSE_DELAY, packet->getPathHashSize());
617627
} else {
618628
mesh::Packet *reply =
619629
createDatagram(PAYLOAD_TYPE_RESPONSE, client->id, secret, reply_data, reply_len);
620630
if (reply) {
621-
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
631+
if (client->out_path_len != OUT_PATH_UNKNOWN) { // we have an out_path, so send DIRECT
622632
sendDirect(reply, client->out_path, client->out_path_len, SERVER_RESPONSE_DELAY);
623633
} else {
624-
sendFlood(reply, SERVER_RESPONSE_DELAY);
634+
sendFlood(reply, SERVER_RESPONSE_DELAY, packet->getPathHashSize());
625635
}
626636
}
627637
}
@@ -651,8 +661,8 @@ void MyMesh::onPeerDataRecv(mesh::Packet *packet, uint8_t type, int sender_idx,
651661

652662
mesh::Packet *ack = createAck(ack_hash);
653663
if (ack) {
654-
if (client->out_path_len < 0) {
655-
sendFlood(ack, TXT_ACK_DELAY);
664+
if (client->out_path_len == OUT_PATH_UNKNOWN) {
665+
sendFlood(ack, TXT_ACK_DELAY, packet->getPathHashSize());
656666
} else {
657667
sendDirect(ack, client->out_path, client->out_path_len, TXT_ACK_DELAY);
658668
}
@@ -679,8 +689,8 @@ void MyMesh::onPeerDataRecv(mesh::Packet *packet, uint8_t type, int sender_idx,
679689

680690
auto reply = createDatagram(PAYLOAD_TYPE_TXT_MSG, client->id, secret, temp, 5 + text_len);
681691
if (reply) {
682-
if (client->out_path_len < 0) {
683-
sendFlood(reply, CLI_REPLY_DELAY_MILLIS);
692+
if (client->out_path_len == OUT_PATH_UNKNOWN) {
693+
sendFlood(reply, CLI_REPLY_DELAY_MILLIS, packet->getPathHashSize());
684694
} else {
685695
sendDirect(reply, client->out_path, client->out_path_len, CLI_REPLY_DELAY_MILLIS);
686696
}
@@ -701,7 +711,8 @@ bool MyMesh::onPeerPathRecv(mesh::Packet *packet, int sender_idx, const uint8_t
701711
MESH_DEBUG_PRINTLN("PATH to client, path_len=%d", (uint32_t)path_len);
702712
auto client = acl.getClientByIdx(i);
703713

704-
memcpy(client->out_path, path, client->out_path_len = path_len); // store a copy of path, for sendDirect()
714+
// store a copy of path, for sendDirect()
715+
client->out_path_len = mesh::Packet::copyPath(client->out_path, path, path_len);
705716
client->last_activity = getRTCClock()->getCurrentTime();
706717
} else {
707718
MESH_DEBUG_PRINTLN("onPeerPathRecv: invalid peer idx: %d", i);
@@ -906,7 +917,7 @@ void MyMesh::sendSelfAdvertisement(int delay_millis, bool flood) {
906917
mesh::Packet *pkt = createSelfAdvert();
907918
if (pkt) {
908919
if (flood) {
909-
sendFlood(pkt, delay_millis);
920+
sendFlood(pkt, delay_millis, _prefs.path_hash_mode + 1);
910921
} else {
911922
sendZeroHop(pkt, delay_millis);
912923
}

examples/simple_repeater/MyMesh.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
9292
uint8_t reply_data[MAX_PACKET_PAYLOAD];
9393
uint8_t reply_path[MAX_PATH_SIZE];
9494
int8_t reply_path_len;
95+
uint8_t reply_path_hash_size;
9596
TransportKeyStore key_store;
9697
RegionMap region_map, temp_map;
9798
RegionEntry* load_stack[8];

0 commit comments

Comments
 (0)