Revert "Add adjustable Tx delay"

This reverts commit ad129bd11a.
This commit is contained in:
Mashintime 2023-01-23 18:23:28 -05:00
parent 8f8ed0f67c
commit 02dce8d056
11 changed files with 8 additions and 58 deletions

View file

@ -221,7 +221,7 @@ exports.getDaemonState = function() {
// START TNC
// ` `== multi line string
exports.startTNC = function(mycall, mygrid, rx_audio, tx_audio, radiocontrol, devicename, deviceport, pttprotocol, pttport, serialspeed, data_bits, stop_bits, handshake, rigctld_ip, rigctld_port, enable_fft, enable_scatter, low_bandwidth_mode, tuning_range_fmin, tuning_range_fmax, enable_fsk, tx_audio_level, respond_to_cq, rx_buffer_size, enable_explorer, tx_delay) {
exports.startTNC = function(mycall, mygrid, rx_audio, tx_audio, radiocontrol, devicename, deviceport, pttprotocol, pttport, serialspeed, data_bits, stop_bits, handshake, rigctld_ip, rigctld_port, enable_fft, enable_scatter, low_bandwidth_mode, tuning_range_fmin, tuning_range_fmax, enable_fsk, tx_audio_level, respond_to_cq, rx_buffer_size, enable_explorer) {
var json_command = JSON.stringify({
type: 'set',
command: 'start_tnc',
@ -250,8 +250,7 @@ exports.startTNC = function(mycall, mygrid, rx_audio, tx_audio, radiocontrol, de
tx_audio_level : tx_audio_level,
respond_to_cq : respond_to_cq,
rx_buffer_size : rx_buffer_size,
enable_explorer : enable_explorer,
tx_delay : tx_delay,
enable_explorer : enable_explorer
}]
})

View file

@ -93,8 +93,7 @@ const configDefaultSettings = '{\
"respond_to_cq" : "True",\
"rx_buffer_size" : "16", \
"enable_explorer" : "False", \
"wftheme": 2, \
"tx_delay": 50 \
"wftheme": 2 \
}';
if (!fs.existsSync(configPath)) {

View file

@ -165,9 +165,6 @@ document.getElementById('openReceivedFilesFolder').addEventListener('click', ()
document.getElementById("tnc_adress").value = config.tnc_host;
document.getElementById("tnc_port").value = config.tnc_port;
//Set tx_delay
document.getElementById("tx_delay").value = config.tx_delay;
callsign_and_ssid = config.mycall.split("-");
callsign = callsign_and_ssid[0];
ssid = callsign_and_ssid[1];
@ -1141,17 +1138,6 @@ document.getElementById('hamlib_rigctld_stop').addEventListener('click', () => {
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
});
document.getElementById("tx_delay").addEventListener("change", () => {
var tx_delay = document.getElementById("tx_delay").value;
if (tx_delay == undefined || isNaN(tx_delay)) {
tx_delay=50;
document.getElementById("tx_delay").value=50;
//console.log("tx_delay is nan");
}
config.tx_delay = tx_delay;
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
});
// Update channel selector changed
document.getElementById("update_channel_selector").addEventListener("change", () => {
config.update_channel = document.getElementById("update_channel_selector").value;
@ -1282,10 +1268,7 @@ document.getElementById('hamlib_rigctld_stop').addEventListener('click', () => {
var tx_audio_level = document.getElementById("audioLevelTX").value;
var rx_buffer_size = document.getElementById("rx_buffer_size").value;
var tx_delay = document.getElementById("tx_delay").value;
if (isNaN(tx_delay))
tx_delay=0;
config.radiocontrol = radiocontrol;
@ -1315,7 +1298,7 @@ document.getElementById('hamlib_rigctld_stop').addEventListener('click', () => {
config.respond_to_cq = respond_to_cq;
config.rx_buffer_size = rx_buffer_size;
config.enable_explorer = enable_explorer;
config.tx_delay = tx_delay;
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
@ -1333,7 +1316,7 @@ document.getElementById('hamlib_rigctld_stop').addEventListener('click', () => {
*/
daemon.startTNC(callsign_ssid, mygrid, rx_audio, tx_audio, radiocontrol, deviceid, deviceport, pttprotocol, pttport, serialspeed, data_bits, stop_bits, handshake, rigctld_ip, rigctld_port, enable_fft, enable_scatter, low_bandwidth_mode, tuning_range_fmin, tuning_range_fmax, enable_fsk, tx_audio_level, respond_to_cq, rx_buffer_size, enable_explorer,tx_delay);
daemon.startTNC(callsign_ssid, mygrid, rx_audio, tx_audio, radiocontrol, deviceid, deviceport, pttprotocol, pttport, serialspeed, data_bits, stop_bits, handshake, rigctld_ip, rigctld_port, enable_fft, enable_scatter, low_bandwidth_mode, tuning_range_fmin, tuning_range_fmax, enable_fsk, tx_audio_level, respond_to_cq, rx_buffer_size, enable_explorer);
})

View file

@ -1315,12 +1315,6 @@
</select>
</label>
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">TX delay</label>
<label class="input-group-text bg-white w-50">
<input type="text" class="form-control form-control-sm" id="tx_delay" placeholder="in ms">
</label>
</div>
</div>
</div>
</div>

View file

@ -19,7 +19,6 @@ txaudiolevel = 120
radiocontrol = rigctld
rigctld_ip = 127.0.0.1
rigctld_port = 4532
tx_delay = 50
[TNC]
#tnc settings

View file

@ -158,7 +158,6 @@ class DAEMON:
# data[24] rx_buffer_size
# data[25] explorer
# data[26] ssid_list
# data[27] tx_delay
if data[0] == "STARTTNC":
self.log.warning("[DMN] Starting TNC", rig=data[5], port=data[6])
@ -260,9 +259,6 @@ class DAEMON:
options.append("--ssid")
options.append(ssid_list)
options.append("--tx-delay")
options.append(data[27])
# safe data to config file
config.write_entire_config(data)
@ -373,7 +369,7 @@ class DAEMON:
rigctld_ip=rigctld_ip,
rigctld_port=rigctld_port,
)
hamlib.set_tx_delay(static.TX_DELAY)
# hamlib_version = rig.hamlib_version
hamlib.set_ptt(True)

View file

@ -277,13 +277,6 @@ if __name__ == "__main__":
action="store_true",
help="Enable sending tnc data to https://explorer.freedata.app",
)
PARSER.add_argument(
"--tx-delay",
dest="tx_delay_ms",
default=50,
help="Set the amount of time (ms) to wait after activating PTT to send audio",
type=int,
)
ARGS = PARSER.parse_args()
# set save to folder state for allowing downloading files to local file system
@ -340,7 +333,6 @@ if __name__ == "__main__":
static.RESPOND_TO_CQ = ARGS.enable_respond_to_cq
static.RX_BUFFER_SIZE = ARGS.rx_buffer_size
static.ENABLE_EXPLORER = ARGS.enable_explorer
static.TX_DELAY = ARGS.tx_delay_ms
except Exception as e:
log.error("[DMN] Error reading config file", exception=e)
@ -394,7 +386,6 @@ if __name__ == "__main__":
static.RESPOND_TO_CQ = config['TNC']['qrv'] in ["True", "true", True]
static.RX_BUFFER_SIZE = int(config['TNC']['rxbuffersize'])
static.ENABLE_EXPLORER = config['TNC']['explorer'] in ["True", "true", True]
static.TX_DELAY = int(config['RADIO']['tx_delay'])
except KeyError as e:
log.warning("[CFG] Error reading config file near", key=str(e))

View file

@ -236,8 +236,7 @@ class RF:
rigctld_ip=static.HAMLIB_RIGCTLD_IP,
rigctld_port=static.HAMLIB_RIGCTLD_PORT,
)
self.hamlib.set_tx_delay(static.TX_DELAY)
# --------------------------------------------START DECODER THREAD
if static.ENABLE_FFT:
fft_thread = threading.Thread(

View file

@ -12,7 +12,7 @@ import threading
# set global hamlib version
hamlib_version = 0
tx_delay = 50
class radio:
"""rigctld (hamlib) communication class"""
@ -89,10 +89,6 @@ class radio:
)
return False
def set_tx_delay(self,ms):
self.tx_delay=ms
self.log.debug("Set tx delay to (ms) " + str(ms))
def ptt_connect(self):
"""Connect to rigctld instance"""
while True:
@ -267,9 +263,7 @@ class radio:
try:
if state:
self.send_ptt_command(b"T 1", False)
time.sleep(tx_delay/1000)
else:
#time.sleep(tx_delay/2000)
self.send_ptt_command(b"T 0", False)
return state
except Exception:

View file

@ -665,7 +665,6 @@ def send_tnc_state():
"hamlib_status": static.HAMLIB_STATUS,
"listen": str(static.LISTEN),
"audio_recording": str(static.AUDIO_RECORD),
"tx_delay": str(static.TX_DELAY),
}
# add heard stations to heard stations object
@ -775,7 +774,6 @@ def process_daemon_commands(data):
respond_to_cq = str(received_json["parameter"][0]["respond_to_cq"])
rx_buffer_size = str(received_json["parameter"][0]["rx_buffer_size"])
enable_explorer = str(received_json["parameter"][0]["enable_explorer"])
tx_delay = str(received_json["parameter"][0]["tx_delay"])
try:
# convert ssid list to python list
@ -823,7 +821,6 @@ def process_daemon_commands(data):
rx_buffer_size,
enable_explorer,
ssid_list,
tx_delay,
]
)
command_response("start_tnc", True)

View file

@ -85,7 +85,6 @@ AUDIO_OUTPUT_DEVICE: int = -2
AUDIO_RECORD: bool = False
AUDIO_RECORD_FILE = ''
BUFFER_OVERFLOW_COUNTER: list = [0, 0, 0, 0, 0]
TX_DELAY: int = 100
AUDIO_DBFS: int = 0
FFT: list = [0]