mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
added tx delay function
This commit is contained in:
parent
d9ef0e6208
commit
1624eb110c
|
@ -224,7 +224,8 @@ exports.startTNC = function (
|
|||
rx_buffer_size,
|
||||
enable_explorer,
|
||||
explorer_stats,
|
||||
auto_tune
|
||||
auto_tune,
|
||||
tx_delay
|
||||
) {
|
||||
var json_command = JSON.stringify({
|
||||
type: "set",
|
||||
|
@ -258,6 +259,7 @@ exports.startTNC = function (
|
|||
enable_explorer: enable_explorer,
|
||||
enable_stats: explorer_stats,
|
||||
enable_auto_tune: auto_tune,
|
||||
tx_delay: tx_delay,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
@ -94,7 +94,8 @@ const configDefaultSettings =
|
|||
"enable_is_writing" : "True", \
|
||||
"shared_folder_path" : ".", \
|
||||
"enable_request_profile" : "True", \
|
||||
"enable_request_shared_folder" : "False" \
|
||||
"enable_request_shared_folder" : "False", \
|
||||
"tx_delay" : 0 \
|
||||
}';
|
||||
|
||||
if (!fs.existsSync(configPath)) {
|
||||
|
|
|
@ -360,6 +360,9 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
document.getElementById("tuning_range_fmin").value = config.tuning_range_fmin;
|
||||
document.getElementById("tuning_range_fmax").value = config.tuning_range_fmax;
|
||||
|
||||
//Update TX delay
|
||||
document.getElementById("tx_delay").value = config.tx_delay;
|
||||
|
||||
// Update TX Audio Level
|
||||
document.getElementById("audioLevelTXvalue").innerHTML = parseInt(
|
||||
config.tx_audio_level
|
||||
|
@ -1151,6 +1154,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
FD.saveConfig(config, configPath);
|
||||
});
|
||||
|
||||
document.getElementById("tx_delay").addEventListener("click", () => {
|
||||
var tx_delay = document.getElementById("tx_delay").value;
|
||||
config.tx_delay = tx_delay;
|
||||
FD.saveConfig(config, configPath);
|
||||
});
|
||||
|
||||
|
||||
// Theme selector clicked
|
||||
document.getElementById("theme_selector").addEventListener("change", () => {
|
||||
var theme = document.getElementById("theme_selector").value;
|
||||
|
@ -1268,6 +1278,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
var data_bits = document.getElementById("hamlib_data_bits").value;
|
||||
var stop_bits = document.getElementById("hamlib_stop_bits").value;
|
||||
var handshake = document.getElementById("hamlib_handshake").value;
|
||||
var tx_delay = document.getElementById("tx_delay").value;
|
||||
|
||||
if (document.getElementById("scatterSwitch").checked == true) {
|
||||
var enable_scatter = "True";
|
||||
|
@ -1378,6 +1389,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
config.enable_explorer = enable_explorer;
|
||||
config.explorer_stats = explorer_stats;
|
||||
config.auto_tune = auto_tune;
|
||||
config.tx_delay = tx_delay;
|
||||
|
||||
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||
FD.saveConfig(config, configPath);
|
||||
|
@ -1409,7 +1421,8 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
rx_buffer_size,
|
||||
enable_explorer,
|
||||
explorer_stats,
|
||||
auto_tune
|
||||
auto_tune,
|
||||
tx_delay
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -2406,6 +2406,38 @@
|
|||
aria-labelledby="tnc-tab"
|
||||
tabindex="0"
|
||||
>
|
||||
|
||||
<div class="input-group input-group-sm mb-1">
|
||||
<label class="input-group-text w-50">TX delay in ms</label>
|
||||
<select
|
||||
class="form-select form-select-sm"
|
||||
id="tx_delay"
|
||||
>
|
||||
<option value="0">0</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
<option value="150">150</option>
|
||||
<option value="200">200</option>
|
||||
<option value="250">250</option>
|
||||
<option value="300">300</option>
|
||||
<option value="350">350</option>
|
||||
<option value="400">400</option>
|
||||
<option value="450">450</option>
|
||||
<option value="500">500</option>
|
||||
<option value="550">550</option>
|
||||
<option value="600">600</option>
|
||||
<option value="650">650</option>
|
||||
<option value="700">700</option>
|
||||
<option value="750">750</option>
|
||||
<option value="800">800</option>
|
||||
<option value="850">850</option>
|
||||
<option value="900">900</option>
|
||||
<option value="950">950</option>
|
||||
<option value="1000">1000</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="input-group input-group-sm mb-1">
|
||||
<label class="input-group-text w-25">Tuning range</label>
|
||||
<label class="input-group-text">fmin</label>
|
||||
|
|
|
@ -4,20 +4,20 @@ tncport = 3000
|
|||
|
||||
[STATION]
|
||||
#station settings
|
||||
mycall = DJ2LS-9
|
||||
mygrid = JN12AA
|
||||
mycall = DN2LS-0
|
||||
mygrid = JN48cs
|
||||
ssid_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
||||
[AUDIO]
|
||||
#audio settings
|
||||
rx = 1
|
||||
tx = 2
|
||||
txaudiolevel = 78
|
||||
rx = 6
|
||||
tx = 6
|
||||
txaudiolevel = 20
|
||||
auto_tune = False
|
||||
|
||||
[RADIO]
|
||||
#radio settings
|
||||
radiocontrol = disabled
|
||||
radiocontrol = rigctld
|
||||
rigctld_ip = 127.0.0.1
|
||||
rigctld_port = 4532
|
||||
|
||||
|
@ -26,11 +26,12 @@ rigctld_port = 4532
|
|||
scatter = True
|
||||
fft = True
|
||||
narrowband = False
|
||||
fmin = -250.0
|
||||
fmax = 250.0
|
||||
fmin = -150.0
|
||||
fmax = 150.0
|
||||
qrv = True
|
||||
rxbuffersize = 16
|
||||
explorer = False
|
||||
stats = False
|
||||
fsk = True
|
||||
fsk = False
|
||||
tx_delay = 0
|
||||
|
||||
|
|
|
@ -76,7 +76,8 @@ class CONFIG:
|
|||
'rxbuffersize': data[16],
|
||||
'explorer': data[17],
|
||||
'stats': data[19],
|
||||
'fsk': data[13]
|
||||
'fsk': data[13],
|
||||
'tx_delay': data[21]
|
||||
}
|
||||
try:
|
||||
with open(self.config_name, 'w') as configfile:
|
||||
|
|
|
@ -151,6 +151,7 @@ class DAEMON:
|
|||
# data[18] ssid_list
|
||||
# data[19] auto_tune
|
||||
# data[20] stats
|
||||
# data[21] tx_delay
|
||||
|
||||
if data[0] == "STARTTNC":
|
||||
self.start_tnc(data)
|
||||
|
@ -268,6 +269,10 @@ class DAEMON:
|
|||
if data[13] == "True":
|
||||
options.append("--fsk")
|
||||
|
||||
options.append("--tx-delay")
|
||||
options.append(data[21])
|
||||
|
||||
|
||||
|
||||
# safe data to config file
|
||||
config.write_entire_config(data)
|
||||
|
|
10
tnc/main.py
10
tnc/main.py
|
@ -244,6 +244,14 @@ if __name__ == "__main__":
|
|||
help="Set tci destination port",
|
||||
)
|
||||
|
||||
PARSER.add_argument(
|
||||
"--tx-delay",
|
||||
dest="tx_delay",
|
||||
default=0,
|
||||
help="delay in ms before modulation is pushed to audio device",
|
||||
type=int,
|
||||
)
|
||||
|
||||
ARGS = PARSER.parse_args()
|
||||
|
||||
# set save to folder state for allowing downloading files to local file system
|
||||
|
@ -297,6 +305,7 @@ if __name__ == "__main__":
|
|||
static.AUDIO_ENABLE_TCI = ARGS.audio_enable_tci
|
||||
static.TCI_IP = ARGS.tci_ip
|
||||
static.TCI_PORT = ARGS.tci_port
|
||||
static.TX_DELAY = ARGS.tx_delay
|
||||
|
||||
except Exception as e:
|
||||
log.error("[DMN] Error reading config file", exception=e)
|
||||
|
@ -347,6 +356,7 @@ if __name__ == "__main__":
|
|||
static.AUDIO_ENABLE_TCI = conf.get('AUDIO', 'enable_tci', 'False')
|
||||
static.TCI_IP = str(conf.get('AUDIO', 'tci_ip', 'localhost'))
|
||||
static.TCI_PORT = int(conf.get('AUDIO', 'tci_port', '50001'))
|
||||
static.TX_DELAY = int(conf.get('TNC', 'tx_delay', '0'))
|
||||
except KeyError as e:
|
||||
log.warning("[CFG] Error reading config file near", key=str(e))
|
||||
except Exception as e:
|
||||
|
|
15
tnc/modem.py
15
tnc/modem.py
|
@ -559,14 +559,15 @@ class RF:
|
|||
)
|
||||
|
||||
# Add empty data to handle ptt toggle time
|
||||
# data_delay_mseconds = 0 # milliseconds
|
||||
# data_delay = int(self.MODEM_SAMPLE_RATE * (data_delay_mseconds / 1000)) # type: ignore
|
||||
# mod_out_silence = ctypes.create_string_buffer(data_delay * 2)
|
||||
# txbuffer = bytes(mod_out_silence)
|
||||
# TODO: Disabled this one for testing
|
||||
txbuffer = bytes()
|
||||
if static.TX_DELAY > 0:
|
||||
data_delay = int(self.MODEM_SAMPLE_RATE * (static.TX_DELAY / 1000)) # type: ignore
|
||||
mod_out_silence = ctypes.create_string_buffer(data_delay * 2)
|
||||
txbuffer = bytes(mod_out_silence)
|
||||
else:
|
||||
txbuffer = bytes()
|
||||
|
||||
self.log.debug(
|
||||
"[MDM] TRANSMIT", mode=self.MODE, payload=payload_bytes_per_frame
|
||||
"[MDM] TRANSMIT", mode=self.MODE, payload=payload_bytes_per_frame, delay=static.TX_DELAY
|
||||
)
|
||||
|
||||
for _ in range(repeats):
|
||||
|
|
|
@ -876,6 +876,7 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
|
|||
enable_explorer = str(helpers.return_key_from_object("False", startparam, "enable_explorer"))
|
||||
enable_auto_tune = str(helpers.return_key_from_object("False", startparam, "enable_auto_tune"))
|
||||
enable_stats = str(helpers.return_key_from_object("False", startparam, "enable_stats"))
|
||||
tx_delay = str(helpers.return_key_from_object("0", startparam, "tx_delay"))
|
||||
try:
|
||||
# convert ssid list to python list
|
||||
ssid_list = str(helpers.return_key_from_object("0, 1, 2, 3, 4, 5, 6, 7, 8, 9", startparam, "ssid_list"))
|
||||
|
@ -915,7 +916,8 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
|
|||
enable_explorer,
|
||||
ssid_list,
|
||||
enable_auto_tune,
|
||||
enable_stats
|
||||
enable_stats,
|
||||
tx_delay
|
||||
]
|
||||
)
|
||||
command_response("start_tnc", True)
|
||||
|
|
|
@ -69,6 +69,7 @@ ENABLE_SCATTER: bool = False
|
|||
ENABLE_FSK: bool = False
|
||||
RESPOND_TO_CQ: bool = False
|
||||
RESPOND_TO_CALL: bool = True # respond to cq, ping, connection request, file request if not in session
|
||||
TX_DELAY: int = 0 # delay in ms before sending modulation for triggering VOX for example or slow PTT radios
|
||||
# ---------------------------------
|
||||
|
||||
# Audio Defaults
|
||||
|
|
Loading…
Reference in a new issue