From 75503ed52abccb79ee2c377888ec9fc6e3806189 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Tue, 3 Jun 2025 20:27:09 +1000 Subject: [PATCH] * Companion now can be configured with TXT_ACK_DELAY (default is 200ms) --- src/helpers/BaseChatMesh.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/helpers/BaseChatMesh.cpp b/src/helpers/BaseChatMesh.cpp index 36ddcbb4..bcf83f8b 100644 --- a/src/helpers/BaseChatMesh.cpp +++ b/src/helpers/BaseChatMesh.cpp @@ -1,6 +1,10 @@ #include #include +#ifndef TXT_ACK_DELAY + #define TXT_ACK_DELAY 200 +#endif + mesh::Packet* BaseChatMesh::createSelfAdvert(const char* name, double lat, double lon) { uint8_t app_data[MAX_ADVERT_DATA_SIZE]; uint8_t app_data_len; @@ -131,14 +135,14 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender // let this sender know path TO here, so they can use sendDirect(), and ALSO encode the ACK mesh::Packet* path = createPathReturn(from.id, secret, packet->path, packet->path_len, PAYLOAD_TYPE_ACK, (uint8_t *) &ack_hash, 4); - if (path) sendFlood(path); + if (path) sendFlood(path, TXT_ACK_DELAY); } else { mesh::Packet* ack = createAck(ack_hash); if (ack) { if (from.out_path_len < 0) { - sendFlood(ack); + sendFlood(ack, TXT_ACK_DELAY); } else { - sendDirect(ack, from.out_path, from.out_path_len); + sendDirect(ack, from.out_path, from.out_path_len, TXT_ACK_DELAY); } } } @@ -164,14 +168,14 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender // let this sender know path TO here, so they can use sendDirect(), and ALSO encode the ACK mesh::Packet* path = createPathReturn(from.id, secret, packet->path, packet->path_len, PAYLOAD_TYPE_ACK, (uint8_t *) &ack_hash, 4); - if (path) sendFlood(path); + if (path) sendFlood(path, TXT_ACK_DELAY); } else { mesh::Packet* ack = createAck(ack_hash); if (ack) { if (from.out_path_len < 0) { - sendFlood(ack); + sendFlood(ack, TXT_ACK_DELAY); } else { - sendDirect(ack, from.out_path, from.out_path_len); + sendDirect(ack, from.out_path, from.out_path_len, TXT_ACK_DELAY); } } }