From 30d6588792bd334cf7f9dc23b0a7ff9d1e8b9244 Mon Sep 17 00:00:00 2001 From: ViezeVingertjes Date: Sat, 7 Feb 2026 18:26:39 +0100 Subject: [PATCH] Update logic in Dispatcher to ensure refill is only applied when greater than zero. --- src/Dispatcher.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Dispatcher.cpp b/src/Dispatcher.cpp index 9cf7ab93..4417178a 100644 --- a/src/Dispatcher.cpp +++ b/src/Dispatcher.cpp @@ -39,15 +39,15 @@ 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 (tx_budget_ms > max_budget) { - tx_budget_ms = max_budget; + + if (refill > 0) { + tx_budget_ms += refill; + if (tx_budget_ms > max_budget) { + tx_budget_ms = max_budget; + } + last_budget_update = now; } - - last_budget_update = now; } int Dispatcher::calcRxDelay(float score, uint32_t air_time) const {