|
|
|
@ -39,16 +39,16 @@ void Dispatcher::updateTxBudget() { |
|
|
|
|
|
|
|
float duty_cycle = 1.0f / (1.0f + getAirtimeBudgetFactor()); |
|
|
|
unsigned long max_budget = (unsigned long)(getDutyCycleWindowMs() * duty_cycle); |
|
|
|
|
|
|
|
unsigned long refill = (unsigned long)(elapsed * duty_cycle); |
|
|
|
tx_budget_ms += refill; |
|
|
|
|
|
|
|
if (refill > 0) { |
|
|
|
tx_budget_ms += refill; |
|
|
|
if (tx_budget_ms > max_budget) { |
|
|
|
tx_budget_ms = max_budget; |
|
|
|
} |
|
|
|
|
|
|
|
last_budget_update = now; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int Dispatcher::calcRxDelay(float score, uint32_t air_time) const { |
|
|
|
return (int) ((pow(10, 0.85f - score) - 1.0) * air_time); |
|
|
|
|