mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-02 17:33:43 +00:00
fix: airtime LDRO threshold must track driver (was BW-blind sf>=11)
getEstAirtimeFor() set LDRO from `sf >= 11`, correct only at BW125. Now matches the driver's should_enable_ldro() (t_sym > 16.38 ms) so the estimate's DE tracks hardware DE on every SF/BW. Also drop dead calcRxDelay() + unused MAX_RX_DELAY_MILLIS.
This commit is contained in:
@@ -21,7 +21,6 @@ LOG_MODULE_REGISTER(zephcore_dispatcher, CONFIG_ZEPHCORE_LORA_LOG_LEVEL);
|
||||
|
||||
namespace mesh {
|
||||
|
||||
#define MAX_RX_DELAY_MILLIS 32000 /* upper bound for score-based RX delay */
|
||||
#define MIN_TX_BUDGET_AIRTIME_DIV 2 /* require at least 1/N MTU airtime as budget before TX */
|
||||
|
||||
Dispatcher::Dispatcher(Radio &radio, MillisecondClock &ms, PacketManager &mgr)
|
||||
@@ -105,22 +104,6 @@ bool Dispatcher::isAdminPacket(const Packet *pkt)
|
||||
t == PAYLOAD_TYPE_ANON_REQ || t == PAYLOAD_TYPE_CONTROL;
|
||||
}
|
||||
|
||||
int Dispatcher::calcRxDelay(float score, uint32_t air_time) const
|
||||
{
|
||||
/* LUT: 10^(0.85 - i*0.1) - 1, i=0..10; replaces powf() (~1.9KB saved) */
|
||||
static const float lut[11] = {
|
||||
6.0793f, 4.6236f, 3.4674f, 2.5489f, 1.8184f, 1.2389f,
|
||||
0.7783f, 0.4125f, 0.1220f, -0.1089f, -0.2921f
|
||||
};
|
||||
if (score <= 0.0f) return (int)(lut[0] * (float)air_time);
|
||||
if (score >= 1.0f) return (int)(lut[10] * (float)air_time);
|
||||
float idx = score * 10.0f;
|
||||
int i = (int)idx;
|
||||
float frac = idx - (float)i;
|
||||
float val = lut[i] + frac * (lut[i + 1] - lut[i]);
|
||||
return (int)(val * (float)air_time);
|
||||
}
|
||||
|
||||
uint32_t Dispatcher::getCADFailRetryDelay() const
|
||||
{
|
||||
/* 100-200ms jittered retry: tighter than one SF8 flood airtime so we
|
||||
|
||||
Reference in New Issue
Block a user