Trim direct retry cleanup

This commit is contained in:
mikecarper
2026-06-16 13:15:52 -07:00
parent 4ed9415866
commit 7d2ff38120
4 changed files with 10 additions and 21 deletions
-13
View File
@@ -579,10 +579,6 @@ uint8_t MyMesh::getDirectRetryCodingRateForSNR(int8_t snr_x4) const {
return 7;
}
uint8_t MyMesh::getDirectRetryPreset() const {
return _prefs.retry_preset;
}
uint8_t MyMesh::getDirectRetryConfiguredMaxAttempts() const {
return constrain(_prefs.direct_retry_attempts, 1, 15);
}
@@ -631,11 +627,6 @@ void MyMesh::configureDirectRetryPacket(mesh::Packet* retry, const mesh::Packet*
retry->tx_cr = getDirectRetryCodingRateForSNR(snr_x4);
}
bool MyMesh::maybeShortCircuitDirect(mesh::Packet* packet) {
(void)packet;
return false;
}
uint32_t MyMesh::getDirectRetryEchoDelay(const mesh::Packet* packet) const {
(void)packet;
return 200;
@@ -1071,7 +1062,6 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
next_local_advert = next_flood_advert = 0;
dirty_contacts_expiry = 0;
set_radio_at = revert_radio_at = 0;
active_bw = 0.0f;
active_sf = 0;
active_cr = 0;
_logging = false;
@@ -1184,7 +1174,6 @@ void MyMesh::begin(FILESYSTEM *fs) {
#endif
radio_driver.setParams(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
active_bw = _prefs.bw;
active_sf = _prefs.sf;
active_cr = _prefs.cr;
radio_driver.setTxPower(_prefs.tx_power_dbm);
@@ -1514,7 +1503,6 @@ void MyMesh::loop() {
if (set_radio_at && millisHasNowPassed(set_radio_at)) { // apply pending (temporary) radio params
set_radio_at = 0; // clear timer
radio_driver.setParams(pending_freq, pending_bw, pending_sf, pending_cr);
active_bw = pending_bw;
active_sf = pending_sf;
active_cr = pending_cr;
MESH_DEBUG_PRINTLN("Temp radio params");
@@ -1523,7 +1511,6 @@ void MyMesh::loop() {
if (revert_radio_at && millisHasNowPassed(revert_radio_at)) { // revert radio params to orig
revert_radio_at = 0; // clear timer
radio_driver.setParams(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
active_bw = _prefs.bw;
active_sf = _prefs.sf;
active_cr = _prefs.cr;
MESH_DEBUG_PRINTLN("Radio params restored");
-3
View File
@@ -110,7 +110,6 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
unsigned long set_radio_at, revert_radio_at;
float pending_freq;
float pending_bw;
float active_bw; // live BW, including temporary radio overrides
uint8_t pending_sf;
uint8_t active_sf; // live SF, including temporary radio overrides
uint8_t pending_cr;
@@ -125,7 +124,6 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
bool extractDirectRetryPrefix(const mesh::Packet* packet, uint8_t* prefix, uint8_t& prefix_len) const;
int8_t getDirectRetryMinSNRX4() const;
uint8_t getDirectRetryCodingRateForSNR(int8_t snr_x4) const;
uint8_t getDirectRetryPreset() const;
uint8_t getDirectRetryConfiguredMaxAttempts() const;
uint32_t getDirectRetryAttemptStepMillis() const;
void putNeighbour(const mesh::Identity& id, uint32_t timestamp, float snr);
@@ -157,7 +155,6 @@ protected:
uint32_t getDirectRetransmitDelay(const mesh::Packet* packet) override;
uint8_t getDefaultTxCodingRate() const override { return active_cr; }
bool allowDirectRetry(const mesh::Packet* packet, const uint8_t* next_hop_hash, uint8_t next_hop_hash_len) const override;
bool maybeShortCircuitDirect(mesh::Packet* packet) override;
void configureDirectRetryPacket(mesh::Packet* retry, const mesh::Packet* original, uint8_t retry_attempt) override;
uint32_t getDirectRetryEchoDelay(const mesh::Packet* packet) const override;
uint8_t getDirectRetryMaxAttempts(const mesh::Packet* packet) const override;
+2 -3
View File
@@ -185,7 +185,7 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
}
}
if (self_id.isHashMatch(pkt->path, pkt->getPathHashSize()) || maybeShortCircuitDirect(pkt)) {
if (self_id.isHashMatch(pkt->path, pkt->getPathHashSize())) {
if (allowPacketForward(pkt)) {
if (pkt->getPayloadType() == PAYLOAD_TYPE_MULTIPART) {
return forwardMultipartDirect(pkt);
@@ -448,9 +448,8 @@ DispatcherAction Mesh::routeRecvPacket(Packet* packet) {
packet->setPathHashCount(n + 1);
uint32_t d = getRetransmitDelay(packet);
uint8_t priority = packet->getPathHashCount();
// as this propagates outwards, give it lower and lower priority
return ACTION_RETRANSMIT_DELAYED(priority, d); // give priority to closer sources, than ones further away
return ACTION_RETRANSMIT_DELAYED(packet->getPathHashCount(), d); // give priority to closer sources, than ones further away
}
return ACTION_RELEASE;
}
+8 -2
View File
@@ -111,8 +111,6 @@ protected:
/**
* \brief Allow subclasses to rewrite a non-TRACE DIRECT packet path when this node can safely skip ahead.
*/
virtual bool maybeShortCircuitDirect(Packet* packet) { return false; }
/**
* \returns milliseconds to wait for the next-hop echo before queueing one retry of the DIRECT packet.
*/
@@ -190,6 +188,8 @@ protected:
/**
* \brief A path TO peer (sender_idx) has been received. (also with optional 'extra' data encoded)
* NOTE: these can be received multiple times (per sender), via different routes
* NOTE: these can be received multiple times (per sender), via differen routes
* \param sender_idx index of peer, [0..n) where n is what searchPeersByHash() returned
* \param secret the pre-calculated shared-secret (handy for sending response packet)
* \returns true, if path was accepted and that reciprocal path should be sent
@@ -212,6 +212,8 @@ protected:
/**
* \brief A path TO 'sender' has been received. (also with optional 'extra' data encoded)
* NOTE: these can be received multiple times (per sender), via different routes
* NOTE: these can be received multiple times (per sender), via differen routes
*/
virtual void onPathRecv(Packet* packet, Identity& sender, uint8_t* path, uint8_t path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) { }
@@ -293,10 +295,14 @@ public:
void sendDirect(Packet* packet, const uint8_t* path, uint8_t path_len, uint32_t delay_millis=0);
/**
* \brief send a locally-generated Packet to just neighbor nodes (zero hops)
* \brief send a locally-generated Packet to just neigbor nodes (zero hops)
*/
void sendZeroHop(Packet* packet, uint32_t delay_millis=0);
/**
* \brief send a locally-generated Packet to just neighbor nodes (zero hops), with specific transport codes
* \brief send a locally-generated Packet to just neigbor nodes (zero hops), with specific transort 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);