"""Minimum idle gap between RF/KISS frame sends (host-side pacing).""" from __future__ import annotations import threading import time MIN_TX_GAP_SEC = 1.5 _lock = threading.Lock() _last_tx = 0.0 def tx_pace_before_send() -> None: """Sleep until at least MIN_TX_GAP_SEC since the previous send.""" global _last_tx with _lock: now = time.monotonic() wait = MIN_TX_GAP_SEC - (now - _last_tx) if wait > 0: time.sleep(wait) _last_tx = time.monotonic()