Skip to content

Commit 2e00298

Browse files
author
Scott Powell
committed
* companion: retransmit delays now hard-coded (only for client repeat mode)
1 parent 5de3e1b commit 2e00298

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

examples/companion_radio/MyMesh.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,15 @@ int MyMesh::calcRxDelay(float score, uint32_t air_time) const {
257257
return (int)((pow(_prefs.rx_delay_base, 0.85f - score) - 1.0) * air_time);
258258
}
259259

260+
uint32_t MyMesh::getRetransmitDelay(const mesh::Packet *packet) {
261+
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * 0.5f);
262+
return getRNG()->nextInt(0, 5*t + 1);
263+
}
264+
uint32_t MyMesh::getDirectRetransmitDelay(const mesh::Packet *packet) {
265+
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * 0.2f);
266+
return getRNG()->nextInt(0, 5*t + 1);
267+
}
268+
260269
uint8_t MyMesh::getExtraAckTransmitCount() const {
261270
return _prefs.multi_acks;
262271
}

examples/companion_radio/MyMesh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ class MyMesh : public BaseChatMesh, public DataStoreHost {
106106
float getAirtimeBudgetFactor() const override;
107107
int getInterferenceThreshold() const override;
108108
int calcRxDelay(float score, uint32_t air_time) const override;
109+
uint32_t getRetransmitDelay(const mesh::Packet *packet) override;
110+
uint32_t getDirectRetransmitDelay(const mesh::Packet *packet) override;
109111
uint8_t getExtraAckTransmitCount() const override;
110112
bool filterRecvFloodPacket(mesh::Packet* packet) override;
111113
bool allowPacketForward(const mesh::Packet* packet) override;

0 commit comments

Comments
 (0)