Reuse beacon retirement timestamp to retain OTA flash budget

This commit is contained in:
mikecarper committed 2026-10-16 03:48:07 -07:00
1 parent 1a099c4ed8
commit 9bb63527ce
2 files changed
+5 -4

No files matched your search

+4 -3
View File
@@ -43,16 +43,17 @@ bool Dispatcher::queueBeaconRadioFrame(const uint8_t* bytes, size_t length,
}
void Dispatcher::accountBeaconAirtime() {
const uint32_t elapsed = uint32_t(_ms->getMillis()) - beacon_tx->start;
const uint32_t now = _ms->getMillis();
const uint32_t elapsed = now - beacon_tx->start;
total_air_time += elapsed;
// Match ordinary TX retirement without postponing adaptive maintenance.
agc_reset.noteTransmit(_ms->getMillis());
agc_reset.noteTransmit(now);
updateTxBudget();
tx_budget_ms = elapsed >= tx_budget_ms ? 0 : tx_budget_ms - elapsed;
if (tx_budget_ms < 100) {
const float duty = 1.0f / (1.0f + getAirtimeBudgetFactor());
next_tx_time = futureMillis((unsigned long)((100 - tx_budget_ms) / duty));
} else next_tx_time = _ms->getMillis();
} else next_tx_time = now;
}
void Dispatcher::cancelBeaconRadioFrame() {
+1 -1
View File
@@ -607,7 +607,7 @@ class BeaconDispatcherTest(unittest.TestCase):
def test_missing_beacon_agc_retirement_negative_control(self):
source = (ROOT / "src/DispatcherBeacon.cpp").read_text(encoding="ascii")
notify = " agc_reset.noteTransmit(_ms->getMillis());\n"
notify = " agc_reset.noteTransmit(now);\n"
self.assertEqual(source.count(notify), 1)
broken = self.work / "old-beacon-agc.cpp"
broken.write_text(source.replace(notify, ""), encoding="ascii")