diff --git a/gui/main.js b/gui/main.js index c5f9bfd7..21e6edce 100644 --- a/gui/main.js +++ b/gui/main.js @@ -95,7 +95,8 @@ const configDefaultSettings = "shared_folder_path" : ".", \ "enable_request_profile" : "True", \ "enable_request_shared_folder" : "False", \ - "tx_delay" : 0 \ + "tx_delay" : 0, \ + "auto_start": 0 \ }'; if (!fs.existsSync(configPath)) { @@ -950,6 +951,7 @@ ipcMain.on("request-check-rigctld", (event, data) => { rigctld_connection_state = true; Data["state"] = "connection possible - (" + data.ip + ":" + data.port + ")"; + Data["active"] = true; if (win !== null && win !== "" && typeof win != "undefined") { // try catch for being sure we have a clean app close try { @@ -963,6 +965,7 @@ ipcMain.on("request-check-rigctld", (event, data) => { rigctld_connection.on("error", function () { rigctld_connection_state = false; Data["state"] = "unknown/stopped - (" + data.ip + ":" + data.port + ")"; + Data["active"] = false; if (win !== null && win !== "" && typeof win != "undefined") { // try catch for being sure we have a clean app close try { diff --git a/gui/preload-main.js b/gui/preload-main.js index fbc99209..4c20ece2 100644 --- a/gui/preload-main.js +++ b/gui/preload-main.js @@ -336,6 +336,13 @@ window.addEventListener("DOMContentLoaded", () => { } else { document.getElementById("autoTuneSwitch").checked = false; } + + if (config.auto_start == 1) { + document.getElementById("AutoStartSwitch").checked = true; + } else { + document.getElementById("AutoStartSwitch").checked = false; + } + // theme selector changeGuiDesign(config.theme); @@ -1064,6 +1071,8 @@ window.addEventListener("DOMContentLoaded", () => { //fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); FD.saveConfig(config, configPath); }); + + //Handle change of fancy graphics document.getElementById("GraphicsSwitch").addEventListener("click", () => { if (document.getElementById("GraphicsSwitch").checked == true) { config.high_graphics = "True"; @@ -1075,6 +1084,17 @@ window.addEventListener("DOMContentLoaded", () => { set_CPU_mode(); }); +//Handle change of Auto-start settings +document.getElementById("AutoStartSwitch").addEventListener("click", () => { + if (document.getElementById("AutoStartSwitch").checked == true) { + config.auto_start = "1"; + } else { + config.auto_start = "0"; + } + //fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); + FD.saveConfig(config, configPath); +}); + // enable fsk Switch clicked document.getElementById("fskModeSwitch").addEventListener("click", () => { if (document.getElementById("fskModeSwitch").checked == true) { @@ -3164,6 +3184,7 @@ function set_setting_switch(setting_switch, enable_object, state) { enable_setting(setting_switch, enable_object); } +var rigctlActive = false; setInterval(checkRigctld, 500); function checkRigctld() { var rigctld_ip = document.getElementById("hamlib_rigctld_ip").value; @@ -3182,6 +3203,7 @@ function checkRigctld() { ipcRenderer.on("action-check-rigctld", (event, data) => { document.getElementById("hamlib_rigctld_status").value = data["state"]; + rigctlActive=data["active"]; }); ipcRenderer.on("action-set-app-version", (event, data) => { @@ -3421,4 +3443,21 @@ function changeGuiDesign(design) { //update path to css file document.getElementById("bootstrap_theme").href = escape(theme_path); + + function autostart() + { + //Auto start stuff if option is enabled + if (config.auto_start == 1) { + //Start rigctld if radiocontrol is in correct mode and is not active + if (config.radiocontrol == "rigctld" && rigctlActive == false){ + //console.log("Autostarting rigctld"); + document.getElementById("hamlib_rigctld_start").click(); + } + //Now start TNC + document.getElementById("startTNC").click(); + } + } + setTimeout(() => { + autostart() + }, 1250); } diff --git a/gui/src/index.html b/gui/src/index.html index a6650cad..54bf5478 100644 --- a/gui/src/index.html +++ b/gui/src/index.html @@ -1781,8 +1781,25 @@ +
+ + +
- +
- These options may - not work and are for experienced users only! + These options are experimental and may + not work as expected.