mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
adjusted enable/disable mesh setting
This commit is contained in:
parent
023221408f
commit
9728f847ec
7 changed files with 74 additions and 77 deletions
|
@ -28,7 +28,8 @@ var appDataFolder =
|
||||||
var configFolder = path.join(appDataFolder, "FreeDATA");
|
var configFolder = path.join(appDataFolder, "FreeDATA");
|
||||||
var configPath = path.join(configFolder, "config.json");
|
var configPath = path.join(configFolder, "config.json");
|
||||||
var config = require(configPath);
|
var config = require(configPath);
|
||||||
config.enable_mesh_features = FD.enable_mesh();
|
|
||||||
|
//config.enable_mesh_features = FD.enable_mesh();
|
||||||
const contrib = [
|
const contrib = [
|
||||||
"DK5SM",
|
"DK5SM",
|
||||||
"DL4IAZ",
|
"DL4IAZ",
|
||||||
|
@ -397,6 +398,21 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
document.getElementById("NotificationSwitch").checked = false;
|
document.getElementById("NotificationSwitch").checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config.enable_mesh_features.toLowerCase() == "true"){
|
||||||
|
document.getElementById("liMeshTable").style.visibility = "visible";
|
||||||
|
document.getElementById("liMeshTable").style.display = "block";
|
||||||
|
document.getElementById("enableMeshSwitch").checked = true;
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
document.getElementById("liMeshTable").style.visibility = "hidden";
|
||||||
|
document.getElementById("liMeshTable").style.display = "none";
|
||||||
|
document.getElementById("enableMeshSwitch").checked = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// theme selector
|
// theme selector
|
||||||
changeGuiDesign(config.theme);
|
changeGuiDesign(config.theme);
|
||||||
|
|
||||||
|
@ -1244,6 +1260,22 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
FD.saveConfig(config, configPath);
|
FD.saveConfig(config, configPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// enable MESH Switch clicked
|
||||||
|
document.getElementById("enableMeshSwitch").addEventListener("click", () => {
|
||||||
|
if (document.getElementById("enableMeshSwitch").checked == true) {
|
||||||
|
config.enable_mesh_features = "True";
|
||||||
|
document.getElementById("liMeshTable").style.visibility = "visible";
|
||||||
|
document.getElementById("liMeshTable").style.display = "block";
|
||||||
|
} else {
|
||||||
|
config.enable_mesh_features = "False";
|
||||||
|
document.getElementById("liMeshTable").style.visibility = "hidden";
|
||||||
|
document.getElementById("liMeshTable").style.display = "none";
|
||||||
|
}
|
||||||
|
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||||
|
FD.saveConfig(config, configPath);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// enable is writing switch clicked
|
// enable is writing switch clicked
|
||||||
document.getElementById("enable_is_writing").addEventListener("click", () => {
|
document.getElementById("enable_is_writing").addEventListener("click", () => {
|
||||||
if (document.getElementById("enable_is_writing").checked == true) {
|
if (document.getElementById("enable_is_writing").checked == true) {
|
||||||
|
@ -1430,10 +1462,17 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
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;
|
var tx_delay = document.getElementById("tx_delay").value;
|
||||||
var enable_mesh = "False"
|
|
||||||
if (config.enable_mesh_features == true) {
|
if (document.getElementById("enableMeshSwitch").checked == true) {
|
||||||
enable_mesh = "True";
|
var enable_mesh_features = "True"
|
||||||
|
document.getElementById("liMeshTable").style.visibility = "visible";
|
||||||
|
document.getElementById("liMeshTable").style.display = "block";
|
||||||
|
} else {
|
||||||
|
var enable_mesh_features = "False"
|
||||||
|
document.getElementById("liMeshTable").style.visibility = "hidden";
|
||||||
|
document.getElementById("liMeshTable").style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.getElementById("scatterSwitch").checked == true) {
|
if (document.getElementById("scatterSwitch").checked == true) {
|
||||||
var enable_scatter = "True";
|
var enable_scatter = "True";
|
||||||
} else {
|
} else {
|
||||||
|
@ -1548,6 +1587,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
config.tx_delay = tx_delay;
|
config.tx_delay = tx_delay;
|
||||||
config.tci_ip = tci_ip;
|
config.tci_ip = tci_ip;
|
||||||
config.tci_port = tci_port;
|
config.tci_port = tci_port;
|
||||||
|
config.enable_mesh_features = enable_mesh_features;
|
||||||
|
|
||||||
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
//fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||||
FD.saveConfig(config, configPath);
|
FD.saveConfig(config, configPath);
|
||||||
|
@ -1598,7 +1638,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
tx_delay,
|
tx_delay,
|
||||||
tci_ip,
|
tci_ip,
|
||||||
tci_port,
|
tci_port,
|
||||||
enable_mesh
|
enable_mesh_features
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1764,12 +1804,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
resetSortIcon();
|
resetSortIcon();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
autostart_rigctld();
|
autostart_rigctld();
|
||||||
|
|
||||||
if (! config.enable_mesh_features == 1) {
|
|
||||||
document.getElementById("liMeshTable").style.visibility = "hidden";
|
|
||||||
document.getElementById("liMeshTable").style.display = "none";
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
//End of domcontentloaded
|
//End of domcontentloaded
|
||||||
|
|
||||||
|
@ -2954,14 +2995,6 @@ ipcRenderer.on("action-update-unread-messages-main", (event, data) => {
|
||||||
|
|
||||||
ipcRenderer.on("run-tnc-command", (event, arg) => {
|
ipcRenderer.on("run-tnc-command", (event, arg) => {
|
||||||
|
|
||||||
if (arg.command == "enable_mesh") {
|
|
||||||
sock.enable_mesh();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arg.command == "disable_mesh") {
|
|
||||||
sock.disable_mesh();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arg.command == "save_my_call") {
|
if (arg.command == "save_my_call") {
|
||||||
sock.saveMyCall(arg.callsign);
|
sock.saveMyCall(arg.callsign);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,30 +28,6 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
document
|
|
||||||
.getElementById("enable_mesh")
|
|
||||||
.addEventListener("click", () => {
|
|
||||||
if (document.getElementById("enable_mesh").checked) {
|
|
||||||
|
|
||||||
|
|
||||||
let Data = {
|
|
||||||
type: "set",
|
|
||||||
command: "enable_mesh",
|
|
||||||
};
|
|
||||||
ipcRenderer.send("run-tnc-command", Data);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
let Data = {
|
|
||||||
type: "set",
|
|
||||||
command: "disable_mesh",
|
|
||||||
};
|
|
||||||
ipcRenderer.send("run-tnc-command", Data);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
13
gui/sock.js
13
gui/sock.js
|
@ -862,19 +862,6 @@ exports.sendFecIsWriting = function (mycallsign) {
|
||||||
writeTncCommand(command);
|
writeTncCommand(command);
|
||||||
};
|
};
|
||||||
|
|
||||||
// ENABLE MESH
|
|
||||||
exports.enable_mesh = function () {
|
|
||||||
command =
|
|
||||||
'{"type" : "set", "command" : "enable_mesh"}';
|
|
||||||
writeTncCommand(command);
|
|
||||||
};
|
|
||||||
|
|
||||||
// DISABLE MESH
|
|
||||||
exports.disable_mesh = function () {
|
|
||||||
command =
|
|
||||||
'{"type" : "set", "command" : "disable_mesh"}';
|
|
||||||
writeTncCommand(command);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// SEND FEC TO BROADCASTCHANNEL
|
// SEND FEC TO BROADCASTCHANNEL
|
||||||
|
|
|
@ -3804,6 +3804,21 @@
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-group input-group-sm mb-1">
|
||||||
|
<label class="input-group-text w-50">Enable MESH protocol</label>
|
||||||
|
<label class="input-group-text w-50">
|
||||||
|
<div class="form-check form-switch form-check-inline ms-2">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
id="enableMeshSwitch"
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="enableMeshSwitch"
|
||||||
|
>experimental! REALLY!</label
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</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-50"
|
<label class="input-group-text w-50"
|
||||||
>Database maintenance</label
|
>Database maintenance</label
|
||||||
|
|
|
@ -19,18 +19,8 @@
|
||||||
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
<!-- chart.js -->
|
<!-- chart.js -->
|
||||||
|
|
||||||
<nav class="navbar fixed-top bg-light">
|
<nav class="navbar fixed-top bg-light ms-2 me-2">
|
||||||
<div class="container-fluid">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
class="btn-check"
|
|
||||||
id="enable_mesh"
|
|
||||||
autocomplete="off"
|
|
||||||
checked="true"
|
|
||||||
/>
|
|
||||||
<label class="btn btn-outline-info" for="enable_mesh"
|
|
||||||
>Enable / Disable Mesh</label
|
|
||||||
>
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
|
|
|
@ -404,6 +404,8 @@ if __name__ == "__main__":
|
||||||
# start modem
|
# start modem
|
||||||
modem = modem.RF()
|
modem = modem.RF()
|
||||||
|
|
||||||
|
# start mesh protocol only if enabled
|
||||||
|
if MeshParam.enable_protocol:
|
||||||
# start mesh module
|
# start mesh module
|
||||||
mesh = mesh.MeshRouter()
|
mesh = mesh.MeshRouter()
|
||||||
|
|
||||||
|
|
|
@ -395,13 +395,7 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
|
||||||
if received_json["type"] == "get" and received_json["command"] == "routing_table":
|
if received_json["type"] == "get" and received_json["command"] == "routing_table":
|
||||||
self.tnc_get_mesh_routing_table(received_json)
|
self.tnc_get_mesh_routing_table(received_json)
|
||||||
|
|
||||||
# ENABLE MESH
|
|
||||||
if received_json["type"] == "set" and received_json["command"] == "enable_mesh":
|
|
||||||
MeshParam.enable_protocol = True
|
|
||||||
|
|
||||||
# DISABLE MESH
|
|
||||||
if received_json["type"] == "set" and received_json["command"] == "disable_mesh":
|
|
||||||
MeshParam.enable_protocol = False
|
|
||||||
# -------------- MESH ---------------- #
|
# -------------- MESH ---------------- #
|
||||||
# MESH PING
|
# MESH PING
|
||||||
if received_json["type"] == "mesh" and received_json["command"] == "ping":
|
if received_json["type"] == "mesh" and received_json["command"] == "ping":
|
||||||
|
|
Loading…
Reference in a new issue