Skip to content

Commit 75503ed

Browse files
author
Scott Powell
committed
* Companion now can be configured with TXT_ACK_DELAY (default is 200ms)
1 parent 6e2a0f3 commit 75503ed

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/helpers/BaseChatMesh.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#include <helpers/BaseChatMesh.h>
22
#include <Utils.h>
33

4+
#ifndef TXT_ACK_DELAY
5+
#define TXT_ACK_DELAY 200
6+
#endif
7+
48
mesh::Packet* BaseChatMesh::createSelfAdvert(const char* name, double lat, double lon) {
59
uint8_t app_data[MAX_ADVERT_DATA_SIZE];
610
uint8_t app_data_len;
@@ -131,14 +135,14 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender
131135
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the ACK
132136
mesh::Packet* path = createPathReturn(from.id, secret, packet->path, packet->path_len,
133137
PAYLOAD_TYPE_ACK, (uint8_t *) &ack_hash, 4);
134-
if (path) sendFlood(path);
138+
if (path) sendFlood(path, TXT_ACK_DELAY);
135139
} else {
136140
mesh::Packet* ack = createAck(ack_hash);
137141
if (ack) {
138142
if (from.out_path_len < 0) {
139-
sendFlood(ack);
143+
sendFlood(ack, TXT_ACK_DELAY);
140144
} else {
141-
sendDirect(ack, from.out_path, from.out_path_len);
145+
sendDirect(ack, from.out_path, from.out_path_len, TXT_ACK_DELAY);
142146
}
143147
}
144148
}
@@ -164,14 +168,14 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender
164168
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the ACK
165169
mesh::Packet* path = createPathReturn(from.id, secret, packet->path, packet->path_len,
166170
PAYLOAD_TYPE_ACK, (uint8_t *) &ack_hash, 4);
167-
if (path) sendFlood(path);
171+
if (path) sendFlood(path, TXT_ACK_DELAY);
168172
} else {
169173
mesh::Packet* ack = createAck(ack_hash);
170174
if (ack) {
171175
if (from.out_path_len < 0) {
172-
sendFlood(ack);
176+
sendFlood(ack, TXT_ACK_DELAY);
173177
} else {
174-
sendDirect(ack, from.out_path, from.out_path_len);
178+
sendDirect(ack, from.out_path, from.out_path_len, TXT_ACK_DELAY);
175179
}
176180
}
177181
}

0 commit comments

Comments
 (0)