mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
implemented slot based busy state for performance testing
This commit is contained in:
parent
542c527554
commit
fbfc036f9f
|
@ -198,6 +198,7 @@ client.on("data", function (socketdata) {
|
||||||
dbfs_level: data["audio_dbfs"],
|
dbfs_level: data["audio_dbfs"],
|
||||||
fft: data["fft"],
|
fft: data["fft"],
|
||||||
channel_busy: data["channel_busy"],
|
channel_busy: data["channel_busy"],
|
||||||
|
channel_busy_slot: data["channel_busy_slot"],
|
||||||
scatter: data["scatter"],
|
scatter: data["scatter"],
|
||||||
info: data["info"],
|
info: data["info"],
|
||||||
rx_buffer_length: data["rx_buffer_length"],
|
rx_buffer_length: data["rx_buffer_length"],
|
||||||
|
|
23
tnc/modem.py
23
tnc/modem.py
|
@ -1219,14 +1219,26 @@ class RF:
|
||||||
# 2700Hz = 266
|
# 2700Hz = 266
|
||||||
# 3200Hz = 315
|
# 3200Hz = 315
|
||||||
|
|
||||||
# define the area, we are detecting busy state
|
# slot
|
||||||
dfft = dfft[120:176] if static.LOW_BANDWIDTH_MODE else dfft[65:231]
|
slot = 0
|
||||||
|
slot1 = [0, 65]
|
||||||
|
slot2 = [65,120]
|
||||||
|
slot3 = [120, 176]
|
||||||
|
slot4 = [176, 231]
|
||||||
|
slot5 = [231, len(dfftlist)]
|
||||||
|
for range in [slot1, slot2, slot3, slot4, slot5]:
|
||||||
|
|
||||||
|
range_start = range[0]
|
||||||
|
range_end = range[1]
|
||||||
|
# define the area, we are detecting busy state
|
||||||
|
#dfft = dfft[120:176] if static.LOW_BANDWIDTH_MODE else dfft[65:231]
|
||||||
|
dfft = dfft[range_start:range_end]
|
||||||
# Check for signals higher than average by checking for "100"
|
# Check for signals higher than average by checking for "100"
|
||||||
# If we have a signal, increment our channel_busy delay counter
|
# If we have a signal, increment our channel_busy delay counter
|
||||||
# so we have a smoother state toggle
|
# so we have a smoother state toggle
|
||||||
if np.sum(dfft[dfft > avg + 15]) >= 400 and not static.TRANSMITTING:
|
if np.sum(dfft[dfft > avg + 15]) >= 400 and not static.TRANSMITTING:
|
||||||
static.CHANNEL_BUSY = True
|
static.CHANNEL_BUSY = True
|
||||||
|
static.CHANNEL_BUSY_SLOT[slot] = True
|
||||||
# Limit delay counter to a maximum of 200. The higher this value,
|
# Limit delay counter to a maximum of 200. The higher this value,
|
||||||
# the longer we will wait until releasing state
|
# the longer we will wait until releasing state
|
||||||
channel_busy_delay = min(channel_busy_delay + 10, 200)
|
channel_busy_delay = min(channel_busy_delay + 10, 200)
|
||||||
|
@ -1236,6 +1248,13 @@ class RF:
|
||||||
# When our channel busy counter reaches 0, toggle state to False
|
# When our channel busy counter reaches 0, toggle state to False
|
||||||
if channel_busy_delay == 0:
|
if channel_busy_delay == 0:
|
||||||
static.CHANNEL_BUSY = False
|
static.CHANNEL_BUSY = False
|
||||||
|
static.CHANNEL_BUSY_SLOT[slot] = False
|
||||||
|
|
||||||
|
# increment slot
|
||||||
|
slot += 1
|
||||||
|
|
||||||
|
print(static.CHANNEL_BUSY_SLOT)
|
||||||
|
|
||||||
|
|
||||||
static.FFT = dfftlist[:315] # 315 --> bandwidth 3200
|
static.FFT = dfftlist[:315] # 315 --> bandwidth 3200
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
|
|
@ -996,7 +996,6 @@ def send_tnc_state():
|
||||||
send the tnc state to network
|
send the tnc state to network
|
||||||
"""
|
"""
|
||||||
encoding = "utf-8"
|
encoding = "utf-8"
|
||||||
|
|
||||||
output = {
|
output = {
|
||||||
"command": "tnc_state",
|
"command": "tnc_state",
|
||||||
"ptt_state": str(static.PTT_STATE),
|
"ptt_state": str(static.PTT_STATE),
|
||||||
|
@ -1017,6 +1016,7 @@ def send_tnc_state():
|
||||||
"bandwidth": str(static.HAMLIB_BANDWIDTH),
|
"bandwidth": str(static.HAMLIB_BANDWIDTH),
|
||||||
"fft": str(static.FFT),
|
"fft": str(static.FFT),
|
||||||
"channel_busy": str(static.CHANNEL_BUSY),
|
"channel_busy": str(static.CHANNEL_BUSY),
|
||||||
|
"channel_busy_slot": str(static.CHANNEL_BUSY_SLOT),
|
||||||
"is_codec2_traffic": str(static.IS_CODEC2_TRAFFIC),
|
"is_codec2_traffic": str(static.IS_CODEC2_TRAFFIC),
|
||||||
"scatter": static.SCATTER,
|
"scatter": static.SCATTER,
|
||||||
"rx_buffer_length": str(RX_BUFFER.qsize()),
|
"rx_buffer_length": str(RX_BUFFER.qsize()),
|
||||||
|
|
|
@ -10,6 +10,7 @@ Not nice, suggestions are appreciated :-)
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
CHANNEL_BUSY_SLOT = [False] * 5
|
||||||
|
|
||||||
VERSION = "0.9.0-alpha-exp.1"
|
VERSION = "0.9.0-alpha-exp.1"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue