mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
parent
8f8ed0f67c
commit
02dce8d056
11 changed files with 8 additions and 58 deletions
|
@ -221,7 +221,7 @@ exports.getDaemonState = function() {
|
||||||
// START TNC
|
// START TNC
|
||||||
// ` `== multi line string
|
// ` `== 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({
|
var json_command = JSON.stringify({
|
||||||
type: 'set',
|
type: 'set',
|
||||||
command: 'start_tnc',
|
command: 'start_tnc',
|
||||||
|
@ -250,8 +250,7 @@ exports.startTNC = function(mycall, mygrid, rx_audio, tx_audio, radiocontrol, de
|
||||||
tx_audio_level : tx_audio_level,
|
tx_audio_level : tx_audio_level,
|
||||||
respond_to_cq : respond_to_cq,
|
respond_to_cq : respond_to_cq,
|
||||||
rx_buffer_size : rx_buffer_size,
|
rx_buffer_size : rx_buffer_size,
|
||||||
enable_explorer : enable_explorer,
|
enable_explorer : enable_explorer
|
||||||
tx_delay : tx_delay,
|
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,7 @@ const configDefaultSettings = '{\
|
||||||
"respond_to_cq" : "True",\
|
"respond_to_cq" : "True",\
|
||||||
"rx_buffer_size" : "16", \
|
"rx_buffer_size" : "16", \
|
||||||
"enable_explorer" : "False", \
|
"enable_explorer" : "False", \
|
||||||
"wftheme": 2, \
|
"wftheme": 2 \
|
||||||
"tx_delay": 50 \
|
|
||||||
}';
|
}';
|
||||||
|
|
||||||
if (!fs.existsSync(configPath)) {
|
if (!fs.existsSync(configPath)) {
|
||||||
|
|
|
@ -165,9 +165,6 @@ document.getElementById('openReceivedFilesFolder').addEventListener('click', ()
|
||||||
document.getElementById("tnc_adress").value = config.tnc_host;
|
document.getElementById("tnc_adress").value = config.tnc_host;
|
||||||
document.getElementById("tnc_port").value = config.tnc_port;
|
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_and_ssid = config.mycall.split("-");
|
||||||
callsign = callsign_and_ssid[0];
|
callsign = callsign_and_ssid[0];
|
||||||
ssid = callsign_and_ssid[1];
|
ssid = callsign_and_ssid[1];
|
||||||
|
@ -1141,17 +1138,6 @@ document.getElementById('hamlib_rigctld_stop').addEventListener('click', () => {
|
||||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
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
|
// Update channel selector changed
|
||||||
document.getElementById("update_channel_selector").addEventListener("change", () => {
|
document.getElementById("update_channel_selector").addEventListener("change", () => {
|
||||||
config.update_channel = document.getElementById("update_channel_selector").value;
|
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 tx_audio_level = document.getElementById("audioLevelTX").value;
|
||||||
var rx_buffer_size = document.getElementById("rx_buffer_size").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;
|
config.radiocontrol = radiocontrol;
|
||||||
|
@ -1315,7 +1298,7 @@ document.getElementById('hamlib_rigctld_stop').addEventListener('click', () => {
|
||||||
config.respond_to_cq = respond_to_cq;
|
config.respond_to_cq = respond_to_cq;
|
||||||
config.rx_buffer_size = rx_buffer_size;
|
config.rx_buffer_size = rx_buffer_size;
|
||||||
config.enable_explorer = enable_explorer;
|
config.enable_explorer = enable_explorer;
|
||||||
config.tx_delay = tx_delay;
|
|
||||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
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);
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -1315,12 +1315,6 @@
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,7 +19,6 @@ txaudiolevel = 120
|
||||||
radiocontrol = rigctld
|
radiocontrol = rigctld
|
||||||
rigctld_ip = 127.0.0.1
|
rigctld_ip = 127.0.0.1
|
||||||
rigctld_port = 4532
|
rigctld_port = 4532
|
||||||
tx_delay = 50
|
|
||||||
|
|
||||||
[TNC]
|
[TNC]
|
||||||
#tnc settings
|
#tnc settings
|
||||||
|
|
|
@ -158,7 +158,6 @@ class DAEMON:
|
||||||
# data[24] rx_buffer_size
|
# data[24] rx_buffer_size
|
||||||
# data[25] explorer
|
# data[25] explorer
|
||||||
# data[26] ssid_list
|
# data[26] ssid_list
|
||||||
# data[27] tx_delay
|
|
||||||
|
|
||||||
if data[0] == "STARTTNC":
|
if data[0] == "STARTTNC":
|
||||||
self.log.warning("[DMN] Starting TNC", rig=data[5], port=data[6])
|
self.log.warning("[DMN] Starting TNC", rig=data[5], port=data[6])
|
||||||
|
@ -260,9 +259,6 @@ class DAEMON:
|
||||||
options.append("--ssid")
|
options.append("--ssid")
|
||||||
options.append(ssid_list)
|
options.append(ssid_list)
|
||||||
|
|
||||||
options.append("--tx-delay")
|
|
||||||
options.append(data[27])
|
|
||||||
|
|
||||||
|
|
||||||
# safe data to config file
|
# safe data to config file
|
||||||
config.write_entire_config(data)
|
config.write_entire_config(data)
|
||||||
|
@ -373,7 +369,7 @@ class DAEMON:
|
||||||
rigctld_ip=rigctld_ip,
|
rigctld_ip=rigctld_ip,
|
||||||
rigctld_port=rigctld_port,
|
rigctld_port=rigctld_port,
|
||||||
)
|
)
|
||||||
hamlib.set_tx_delay(static.TX_DELAY)
|
|
||||||
# hamlib_version = rig.hamlib_version
|
# hamlib_version = rig.hamlib_version
|
||||||
|
|
||||||
hamlib.set_ptt(True)
|
hamlib.set_ptt(True)
|
||||||
|
|
|
@ -277,13 +277,6 @@ if __name__ == "__main__":
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Enable sending tnc data to https://explorer.freedata.app",
|
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()
|
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
|
||||||
|
@ -340,7 +333,6 @@ if __name__ == "__main__":
|
||||||
static.RESPOND_TO_CQ = ARGS.enable_respond_to_cq
|
static.RESPOND_TO_CQ = ARGS.enable_respond_to_cq
|
||||||
static.RX_BUFFER_SIZE = ARGS.rx_buffer_size
|
static.RX_BUFFER_SIZE = ARGS.rx_buffer_size
|
||||||
static.ENABLE_EXPLORER = ARGS.enable_explorer
|
static.ENABLE_EXPLORER = ARGS.enable_explorer
|
||||||
static.TX_DELAY = ARGS.tx_delay_ms
|
|
||||||
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)
|
||||||
|
|
||||||
|
@ -394,7 +386,6 @@ if __name__ == "__main__":
|
||||||
static.RESPOND_TO_CQ = config['TNC']['qrv'] in ["True", "true", True]
|
static.RESPOND_TO_CQ = config['TNC']['qrv'] in ["True", "true", True]
|
||||||
static.RX_BUFFER_SIZE = int(config['TNC']['rxbuffersize'])
|
static.RX_BUFFER_SIZE = int(config['TNC']['rxbuffersize'])
|
||||||
static.ENABLE_EXPLORER = config['TNC']['explorer'] in ["True", "true", True]
|
static.ENABLE_EXPLORER = config['TNC']['explorer'] in ["True", "true", True]
|
||||||
static.TX_DELAY = int(config['RADIO']['tx_delay'])
|
|
||||||
|
|
||||||
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))
|
||||||
|
|
|
@ -236,7 +236,6 @@ class RF:
|
||||||
rigctld_ip=static.HAMLIB_RIGCTLD_IP,
|
rigctld_ip=static.HAMLIB_RIGCTLD_IP,
|
||||||
rigctld_port=static.HAMLIB_RIGCTLD_PORT,
|
rigctld_port=static.HAMLIB_RIGCTLD_PORT,
|
||||||
)
|
)
|
||||||
self.hamlib.set_tx_delay(static.TX_DELAY)
|
|
||||||
|
|
||||||
# --------------------------------------------START DECODER THREAD
|
# --------------------------------------------START DECODER THREAD
|
||||||
if static.ENABLE_FFT:
|
if static.ENABLE_FFT:
|
||||||
|
|
|
@ -12,7 +12,7 @@ import threading
|
||||||
|
|
||||||
# set global hamlib version
|
# set global hamlib version
|
||||||
hamlib_version = 0
|
hamlib_version = 0
|
||||||
tx_delay = 50
|
|
||||||
|
|
||||||
class radio:
|
class radio:
|
||||||
"""rigctld (hamlib) communication class"""
|
"""rigctld (hamlib) communication class"""
|
||||||
|
@ -89,10 +89,6 @@ class radio:
|
||||||
)
|
)
|
||||||
return False
|
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):
|
def ptt_connect(self):
|
||||||
"""Connect to rigctld instance"""
|
"""Connect to rigctld instance"""
|
||||||
while True:
|
while True:
|
||||||
|
@ -267,9 +263,7 @@ class radio:
|
||||||
try:
|
try:
|
||||||
if state:
|
if state:
|
||||||
self.send_ptt_command(b"T 1", False)
|
self.send_ptt_command(b"T 1", False)
|
||||||
time.sleep(tx_delay/1000)
|
|
||||||
else:
|
else:
|
||||||
#time.sleep(tx_delay/2000)
|
|
||||||
self.send_ptt_command(b"T 0", False)
|
self.send_ptt_command(b"T 0", False)
|
||||||
return state
|
return state
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -665,7 +665,6 @@ def send_tnc_state():
|
||||||
"hamlib_status": static.HAMLIB_STATUS,
|
"hamlib_status": static.HAMLIB_STATUS,
|
||||||
"listen": str(static.LISTEN),
|
"listen": str(static.LISTEN),
|
||||||
"audio_recording": str(static.AUDIO_RECORD),
|
"audio_recording": str(static.AUDIO_RECORD),
|
||||||
"tx_delay": str(static.TX_DELAY),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# add heard stations to heard stations object
|
# 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"])
|
respond_to_cq = str(received_json["parameter"][0]["respond_to_cq"])
|
||||||
rx_buffer_size = str(received_json["parameter"][0]["rx_buffer_size"])
|
rx_buffer_size = str(received_json["parameter"][0]["rx_buffer_size"])
|
||||||
enable_explorer = str(received_json["parameter"][0]["enable_explorer"])
|
enable_explorer = str(received_json["parameter"][0]["enable_explorer"])
|
||||||
tx_delay = str(received_json["parameter"][0]["tx_delay"])
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# convert ssid list to python list
|
# convert ssid list to python list
|
||||||
|
@ -823,7 +821,6 @@ def process_daemon_commands(data):
|
||||||
rx_buffer_size,
|
rx_buffer_size,
|
||||||
enable_explorer,
|
enable_explorer,
|
||||||
ssid_list,
|
ssid_list,
|
||||||
tx_delay,
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
command_response("start_tnc", True)
|
command_response("start_tnc", True)
|
||||||
|
|
|
@ -85,7 +85,6 @@ AUDIO_OUTPUT_DEVICE: int = -2
|
||||||
AUDIO_RECORD: bool = False
|
AUDIO_RECORD: bool = False
|
||||||
AUDIO_RECORD_FILE = ''
|
AUDIO_RECORD_FILE = ''
|
||||||
BUFFER_OVERFLOW_COUNTER: list = [0, 0, 0, 0, 0]
|
BUFFER_OVERFLOW_COUNTER: list = [0, 0, 0, 0, 0]
|
||||||
TX_DELAY: int = 100
|
|
||||||
|
|
||||||
AUDIO_DBFS: int = 0
|
AUDIO_DBFS: int = 0
|
||||||
FFT: list = [0]
|
FFT: list = [0]
|
||||||
|
|
Loading…
Reference in a new issue