mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Add option to autostart rigctld/tnc. Issue #385
This commit is contained in:
parent
5a4dfa69ec
commit
3b4be83119
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1781,8 +1781,25 @@
|
|||
<option value="alpha">alpha</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group input-group-sm mb-1">
|
||||
<label class="input-group-text w-50"
|
||||
>Auto-start TNC/rigctld</label
|
||||
>
|
||||
<label class="input-group-text w-50">
|
||||
<div class="form-check form-switch form-check-inline">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
id="AutoStartSwitch"
|
||||
/>
|
||||
<label class="form-check-label" for="AutoStartSwitch"
|
||||
>Start on launch</label
|
||||
>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Chat tab contents -->
|
||||
<div
|
||||
class="tab-pane"
|
||||
id="chat"
|
||||
|
@ -2605,8 +2622,8 @@
|
|||
</div>
|
||||
<div class="center">
|
||||
<div class="badge text-bg-danger">
|
||||
<i class="bi bi-shield-exclamation"></i> These options may
|
||||
not work and are for experienced users only!
|
||||
<i class="bi bi-shield-exclamation"></i> These options are experimental and may
|
||||
not work as expected.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue