From 4c18a843fc4c790042d81e959f404aafad37212d Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Fri, 18 Nov 2022 13:32:04 +0100 Subject: [PATCH] busy state fine tuning --- tnc/modem.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tnc/modem.py b/tnc/modem.py index 07f11305..3db2cda9 100644 --- a/tnc/modem.py +++ b/tnc/modem.py @@ -912,12 +912,15 @@ class RF: # Check for signals higher than average by checking for "100" # If we have a signal, increment our channel_busy delay counter # so we have a smoother state toggle - if np.sum(dfft[dfft > avg + 10]) >= 300 and not static.TRANSMITTING: + if np.sum(dfft[dfft > avg + 10]) >= 400 and not static.TRANSMITTING: static.CHANNEL_BUSY = True - # Limit delay counter to a maximum of 50. The higher this value, + # Limit delay counter to a maximum of 250. The higher this value, # the longer we will wait until releasing state - channel_busy_delay = min(channel_busy_delay + 5, 250) + channel_busy_delay = min(channel_busy_delay + 10, 250) else: + # if transmitting set busy delay to 0 for avoiding too much false positives + if static.TRANSMITTING: + channel_busy_delay = 0 # Decrement channel busy counter if no signal has been detected. channel_busy_delay = max(channel_busy_delay - 1, 0) # When our channel busy counter reaches 0, toggle state to False