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
11 changed files with 90 additions and 21 deletions
|
@ -224,7 +224,8 @@ exports.startTNC = function (
|
||||||
rx_buffer_size,
|
rx_buffer_size,
|
||||||
enable_explorer,
|
enable_explorer,
|
||||||
explorer_stats,
|
explorer_stats,
|
||||||
auto_tune
|
auto_tune,
|
||||||
|
tx_delay
|
||||||
) {
|
) {
|
||||||
var json_command = JSON.stringify({
|
var json_command = JSON.stringify({
|
||||||
type: "set",
|
type: "set",
|
||||||
|
@ -258,6 +259,7 @@ exports.startTNC = function (
|
||||||
enable_explorer: enable_explorer,
|
enable_explorer: enable_explorer,
|
||||||
enable_stats: explorer_stats,
|
enable_stats: explorer_stats,
|
||||||
enable_auto_tune: auto_tune,
|
enable_auto_tune: auto_tune,
|
||||||
|
tx_delay: tx_delay,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -94,7 +94,8 @@ const configDefaultSettings =
|
||||||
"enable_is_writing" : "True", \
|
"enable_is_writing" : "True", \
|
||||||
"shared_folder_path" : ".", \
|
"shared_folder_path" : ".", \
|
||||||
"enable_request_profile" : "True", \
|
"enable_request_profile" : "True", \
|
||||||
"enable_request_shared_folder" : "False" \
|
"enable_request_shared_folder" : "False", \
|
||||||
|
"tx_delay" : 0 \
|
||||||
}';
|
}';
|
||||||
|
|
||||||
if (!fs.existsSync(configPath)) {
|
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_fmin").value = config.tuning_range_fmin;
|
||||||
document.getElementById("tuning_range_fmax").value = config.tuning_range_fmax;
|
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
|
// Update TX Audio Level
|
||||||
document.getElementById("audioLevelTXvalue").innerHTML = parseInt(
|
document.getElementById("audioLevelTXvalue").innerHTML = parseInt(
|
||||||
config.tx_audio_level
|
config.tx_audio_level
|
||||||
|
@ -1151,6 +1154,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
FD.saveConfig(config, configPath);
|
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
|
// Theme selector clicked
|
||||||
document.getElementById("theme_selector").addEventListener("change", () => {
|
document.getElementById("theme_selector").addEventListener("change", () => {
|
||||||
var theme = document.getElementById("theme_selector").value;
|
var theme = document.getElementById("theme_selector").value;
|
||||||
|
@ -1268,6 +1278,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
var data_bits = document.getElementById("hamlib_data_bits").value;
|
var data_bits = document.getElementById("hamlib_data_bits").value;
|
||||||
var stop_bits = document.getElementById("hamlib_stop_bits").value;
|
var stop_bits = document.getElementById("hamlib_stop_bits").value;
|
||||||
var handshake = document.getElementById("hamlib_handshake").value;
|
var handshake = document.getElementById("hamlib_handshake").value;
|
||||||
|
var tx_delay = document.getElementById("tx_delay").value;
|
||||||
|
|
||||||
if (document.getElementById("scatterSwitch").checked == true) {
|
if (document.getElementById("scatterSwitch").checked == true) {
|
||||||
var enable_scatter = "True";
|
var enable_scatter = "True";
|
||||||
|
@ -1378,6 +1389,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
config.enable_explorer = enable_explorer;
|
config.enable_explorer = enable_explorer;
|
||||||
config.explorer_stats = explorer_stats;
|
config.explorer_stats = explorer_stats;
|
||||||
config.auto_tune = auto_tune;
|
config.auto_tune = auto_tune;
|
||||||
|
config.tx_delay = tx_delay;
|
||||||
|
|
||||||
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||||
FD.saveConfig(config, configPath);
|
FD.saveConfig(config, configPath);
|
||||||
|
@ -1409,7 +1421,8 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
rx_buffer_size,
|
rx_buffer_size,
|
||||||
enable_explorer,
|
enable_explorer,
|
||||||
explorer_stats,
|
explorer_stats,
|
||||||
auto_tune
|
auto_tune,
|
||||||
|
tx_delay
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2406,6 +2406,38 @@
|
||||||
aria-labelledby="tnc-tab"
|
aria-labelledby="tnc-tab"
|
||||||
tabindex="0"
|
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">
|
<div class="input-group input-group-sm mb-1">
|
||||||
<label class="input-group-text w-25">Tuning range</label>
|
<label class="input-group-text w-25">Tuning range</label>
|
||||||
<label class="input-group-text">fmin</label>
|
<label class="input-group-text">fmin</label>
|
||||||
|
|
|
@ -4,20 +4,20 @@ tncport = 3000
|
||||||
|
|
||||||
[STATION]
|
[STATION]
|
||||||
#station settings
|
#station settings
|
||||||
mycall = DJ2LS-9
|
mycall = DN2LS-0
|
||||||
mygrid = JN12AA
|
mygrid = JN48cs
|
||||||
ssid_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
ssid_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
|
|
||||||
[AUDIO]
|
[AUDIO]
|
||||||
#audio settings
|
#audio settings
|
||||||
rx = 1
|
rx = 6
|
||||||
tx = 2
|
tx = 6
|
||||||
txaudiolevel = 78
|
txaudiolevel = 20
|
||||||
auto_tune = False
|
auto_tune = False
|
||||||
|
|
||||||
[RADIO]
|
[RADIO]
|
||||||
#radio settings
|
#radio settings
|
||||||
radiocontrol = disabled
|
radiocontrol = rigctld
|
||||||
rigctld_ip = 127.0.0.1
|
rigctld_ip = 127.0.0.1
|
||||||
rigctld_port = 4532
|
rigctld_port = 4532
|
||||||
|
|
||||||
|
@ -26,11 +26,12 @@ rigctld_port = 4532
|
||||||
scatter = True
|
scatter = True
|
||||||
fft = True
|
fft = True
|
||||||
narrowband = False
|
narrowband = False
|
||||||
fmin = -250.0
|
fmin = -150.0
|
||||||
fmax = 250.0
|
fmax = 150.0
|
||||||
qrv = True
|
qrv = True
|
||||||
rxbuffersize = 16
|
rxbuffersize = 16
|
||||||
explorer = False
|
explorer = False
|
||||||
stats = False
|
stats = False
|
||||||
fsk = True
|
fsk = False
|
||||||
|
tx_delay = 0
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ class CONFIG:
|
||||||
'rxbuffersize': data[16],
|
'rxbuffersize': data[16],
|
||||||
'explorer': data[17],
|
'explorer': data[17],
|
||||||
'stats': data[19],
|
'stats': data[19],
|
||||||
'fsk': data[13]
|
'fsk': data[13],
|
||||||
|
'tx_delay': data[21]
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
with open(self.config_name, 'w') as configfile:
|
with open(self.config_name, 'w') as configfile:
|
||||||
|
|
|
@ -151,6 +151,7 @@ class DAEMON:
|
||||||
# data[18] ssid_list
|
# data[18] ssid_list
|
||||||
# data[19] auto_tune
|
# data[19] auto_tune
|
||||||
# data[20] stats
|
# data[20] stats
|
||||||
|
# data[21] tx_delay
|
||||||
|
|
||||||
if data[0] == "STARTTNC":
|
if data[0] == "STARTTNC":
|
||||||
self.start_tnc(data)
|
self.start_tnc(data)
|
||||||
|
@ -268,6 +269,10 @@ class DAEMON:
|
||||||
if data[13] == "True":
|
if data[13] == "True":
|
||||||
options.append("--fsk")
|
options.append("--fsk")
|
||||||
|
|
||||||
|
options.append("--tx-delay")
|
||||||
|
options.append(data[21])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# safe data to config file
|
# safe data to config file
|
||||||
config.write_entire_config(data)
|
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",
|
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()
|
ARGS = PARSER.parse_args()
|
||||||
|
|
||||||
# set save to folder state for allowing downloading files to local file system
|
# 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.AUDIO_ENABLE_TCI = ARGS.audio_enable_tci
|
||||||
static.TCI_IP = ARGS.tci_ip
|
static.TCI_IP = ARGS.tci_ip
|
||||||
static.TCI_PORT = ARGS.tci_port
|
static.TCI_PORT = ARGS.tci_port
|
||||||
|
static.TX_DELAY = ARGS.tx_delay
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("[DMN] Error reading config file", exception=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.AUDIO_ENABLE_TCI = conf.get('AUDIO', 'enable_tci', 'False')
|
||||||
static.TCI_IP = str(conf.get('AUDIO', 'tci_ip', 'localhost'))
|
static.TCI_IP = str(conf.get('AUDIO', 'tci_ip', 'localhost'))
|
||||||
static.TCI_PORT = int(conf.get('AUDIO', 'tci_port', '50001'))
|
static.TCI_PORT = int(conf.get('AUDIO', 'tci_port', '50001'))
|
||||||
|
static.TX_DELAY = int(conf.get('TNC', 'tx_delay', '0'))
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
log.warning("[CFG] Error reading config file near", key=str(e))
|
log.warning("[CFG] Error reading config file near", key=str(e))
|
||||||
except Exception as 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
|
# Add empty data to handle ptt toggle time
|
||||||
# data_delay_mseconds = 0 # milliseconds
|
if static.TX_DELAY > 0:
|
||||||
# data_delay = int(self.MODEM_SAMPLE_RATE * (data_delay_mseconds / 1000)) # type: ignore
|
data_delay = int(self.MODEM_SAMPLE_RATE * (static.TX_DELAY / 1000)) # type: ignore
|
||||||
# mod_out_silence = ctypes.create_string_buffer(data_delay * 2)
|
mod_out_silence = ctypes.create_string_buffer(data_delay * 2)
|
||||||
# txbuffer = bytes(mod_out_silence)
|
txbuffer = bytes(mod_out_silence)
|
||||||
# TODO: Disabled this one for testing
|
else:
|
||||||
txbuffer = bytes()
|
txbuffer = bytes()
|
||||||
|
|
||||||
self.log.debug(
|
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):
|
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_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_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"))
|
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:
|
try:
|
||||||
# convert ssid list to python list
|
# 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"))
|
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,
|
enable_explorer,
|
||||||
ssid_list,
|
ssid_list,
|
||||||
enable_auto_tune,
|
enable_auto_tune,
|
||||||
enable_stats
|
enable_stats,
|
||||||
|
tx_delay
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
command_response("start_tnc", True)
|
command_response("start_tnc", True)
|
||||||
|
|
|
@ -69,6 +69,7 @@ ENABLE_SCATTER: bool = False
|
||||||
ENABLE_FSK: bool = False
|
ENABLE_FSK: bool = False
|
||||||
RESPOND_TO_CQ: bool = False
|
RESPOND_TO_CQ: bool = False
|
||||||
RESPOND_TO_CALL: bool = True # respond to cq, ping, connection request, file request if not in session
|
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
|
# Audio Defaults
|
||||||
|
|
Loading…
Reference in a new issue