Small tweaks, cleanup

This commit is contained in:
Mashintime 2023-02-04 00:28:28 -05:00
parent 877f8f468c
commit cf5d25a8e7

View file

@ -1484,14 +1484,6 @@ document.getElementById('hamlib_rigctld_stop').addEventListener('click', () => {
}; };
ipcRenderer.send('request-show-chat-window', Data); ipcRenderer.send('request-show-chat-window', Data);
}) })
}) })
//Listen for events caused by tnc 'tnc-message's //Listen for events caused by tnc 'tnc-message's
@ -1563,9 +1555,7 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
// DATA STATE // DATA STATE
global.rxBufferLengthTnc = arg.rx_buffer_length global.rxBufferLengthTnc = arg.rx_buffer_length
// START OF SCATTER CHART // START OF SCATTER CHART
const scatterConfig = { const scatterConfig = {
plugins: { plugins: {
legend: { legend: {
@ -1574,7 +1564,6 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
tooltip: { tooltip: {
enabled: false enabled: false
}, },
annotation: { annotation: {
annotations: { annotations: {
line1: { line1: {
@ -1593,9 +1582,6 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
} }
} }
}, },
}, },
animations: false, animations: false,
scales: { scales: {
@ -1610,7 +1596,6 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
} }
}, },
y: { y: {
display: true, display: true,
min: -80, min: -80,
max: 80, max: 80,
@ -1654,7 +1639,6 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
// END OF SCATTER CHART // END OF SCATTER CHART
// START OF SPEED CHART // START OF SPEED CHART
var speedDataTime = [] var speedDataTime = []
if (typeof(arg.speed_list) == 'undefined') { if (typeof(arg.speed_list) == 'undefined') {
@ -1683,7 +1667,6 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
speedDataSnr.push(arg.speed_list[i].snr) speedDataSnr.push(arg.speed_list[i].snr)
} }
var speedChartConfig = { var speedChartConfig = {
type: 'line', type: 'line',
}; };
@ -1710,7 +1693,6 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
yAxisID: 'SPEED', yAxisID: 'SPEED',
} }
], ],
}; };
var speedChartOptions = { var speedChartOptions = {
@ -1748,19 +1730,9 @@ var speedChartOptions = {
global.speedChart.update(); global.speedChart.update();
} }
} }
// END OF SPEED CHART // END OF SPEED CHART
// PTT STATE // PTT STATE
/*
if (arg.ptt_state == 'True') {
document.getElementById("ptt_state").className = "btn btn-sm btn-danger";
} else if (arg.ptt_state == 'False') {
document.getElementById("ptt_state").className = "btn btn-sm btn-success";
} else {
document.getElementById("ptt_state").className = "btn btn-sm btn-secondary";
}
*/
switch (arg.ptt_state){ switch (arg.ptt_state){
case 'True': case 'True':
document.getElementById("ptt_state").className = "btn btn-sm btn-danger"; document.getElementById("ptt_state").className = "btn btn-sm btn-danger";
@ -1771,33 +1743,16 @@ var speedChartOptions = {
default: default:
document.getElementById("ptt_state").className = "btn btn-sm btn-secondary"; document.getElementById("ptt_state").className = "btn btn-sm btn-secondary";
break; break;
} }
// AUDIO RECORDING // AUDIO RECORDING
if (arg.audio_recording == 'True') { if (arg.audio_recording == 'True') {
document.getElementById("startStopRecording").className = "btn btn-sm btn-danger";
document.getElementById("startStopRecording").textContent = "Stop Rec" document.getElementById("startStopRecording").textContent = "Stop Rec"
} else if (arg.ptt_state == 'False') {
document.getElementById("startStopRecording").className = "btn btn-sm btn-danger";
document.getElementById("startStopRecording").textContent = "Start Rec"
} else { } else {
document.getElementById("startStopRecording").className = "btn btn-sm btn-danger";
document.getElementById("startStopRecording").textContent = "Start Rec" document.getElementById("startStopRecording").textContent = "Start Rec"
} }
// CHANNEL BUSY STATE // CHANNEL BUSY STATE
/*
if (arg.channel_busy == 'True') {
document.getElementById("channel_busy").className = "btn btn-sm btn-danger";
} else if (arg.channel_busy == 'False') {
document.getElementById("channel_busy").className = "btn btn-sm btn-success";
} else {
document.getElementById("channel_busy").className = "btn btn-sm btn-secondary";
}
*/
switch (arg.channel_busy){ switch (arg.channel_busy){
case 'True': case 'True':
document.getElementById("channel_busy").className = "btn btn-sm btn-danger"; document.getElementById("channel_busy").className = "btn btn-sm btn-danger";
@ -1811,19 +1766,6 @@ var speedChartOptions = {
} }
// BUSY STATE // BUSY STATE
/*
if (arg.busy_state == 'BUSY') {
document.getElementById("busy_state").className = "btn btn-sm btn-danger";
document.getElementById("startTransmission").disabled = true;
//document.getElementById("stopTransmission").disabled = false;
} else if (arg.busy_state == 'IDLE') {
document.getElementById("busy_state").className = "btn btn-sm btn-success";
} else {
document.getElementById("busy_state").className = "btn btn-sm btn-secondary";
document.getElementById("startTransmission").disabled = true;
//document.getElementById("stopTransmission").disabled = false;
}
*/
switch(arg.busy_state){ switch(arg.busy_state){
case 'BUSY': case 'BUSY':
document.getElementById("busy_state").className = "btn btn-sm btn-danger"; document.getElementById("busy_state").className = "btn btn-sm btn-danger";
@ -1839,57 +1781,22 @@ var speedChartOptions = {
} }
// ARQ STATE // ARQ STATE
/*
if (arg.arq_state == 'True') {
document.getElementById("arq_state").className = "btn btn-sm btn-warning";
//document.getElementById("startTransmission").disabled = true;
document.getElementById("startTransmission").disabled = false;
//document.getElementById("stopTransmission").disabled = false;
} else if (arg.arq_state == 'False') {
document.getElementById("arq_state").className = "btn btn-sm btn-secondary";
document.getElementById("startTransmission").disabled = false;
//document.getElementById("stopTransmission").disabled = true;
} else {
document.getElementById("arq_state").className = "btn btn-sm btn-secondary";
//document.getElementById("startTransmission").disabled = true;
document.getElementById("startTransmission").disabled = false;
//document.getElementById("stopTransmission").disabled = false;
}
*/
switch (arg.arq_state){ switch (arg.arq_state){
case 'True': case 'True':
document.getElementById("arq_state").className = "btn btn-sm btn-warning"; document.getElementById("arq_state").className = "btn btn-sm btn-warning";
document.getElementById("startTransmission").disabled = false; document.getElementById("startTransmission").disabled = false;
break; break;
case 'False':
document.getElementById("arq_state").className = "btn btn-sm btn-secondary";
document.getElementById("startTransmission").disabled = false;
break;
default: default:
document.getElementById("arq_state").className = "btn btn-sm btn-secondary"; document.getElementById("arq_state").className = "btn btn-sm btn-secondary";
document.getElementById("startTransmission").disabled = false; document.getElementById("startTransmission").disabled = false;
break; break;
} }
// ARQ SESSION
/*
if (arg.arq_session == 'True') {
document.getElementById("arq_session").className = "btn btn-sm btn-warning";
} else if (arg.arq_session == 'False') { // ARQ SESSION
document.getElementById("arq_session").className = "btn btn-sm btn-secondary";
} else {
document.getElementById("arq_session").className = "btn btn-sm btn-secondary";
}
*/
switch (arg.arq_session){ switch (arg.arq_session){
case 'True': case 'True':
document.getElementById("arq_session").className = "btn btn-sm btn-warning"; document.getElementById("arq_session").className = "btn btn-sm btn-warning";
break; break;
case 'False':
document.getElementById("arq_session").className = "btn btn-sm btn-secondary";
break;
default: default:
document.getElementById("arq_session").className = "btn btn-sm btn-secondary"; document.getElementById("arq_session").className = "btn btn-sm btn-secondary";
break; break;
@ -1902,12 +1809,13 @@ var speedChartOptions = {
document.getElementById("rigctld_state").className = "btn btn-secondary btn-sm"; document.getElementById("rigctld_state").className = "btn btn-secondary btn-sm";
} }
let bcn = document.getElementById("startBeacon"); // BEACON
let bcn = document.getElementById("startBeacon");
switch (arg.beacon_state){ switch (arg.beacon_state){
case 'True': case 'True':
if (config.high_graphics.toUpperCase() == "TRUE") { if (config.high_graphics.toUpperCase() == "TRUE") {
bcn.className = "btn btn-sm btn-success spinner-grow force-gpu"; bcn.className = "btn btn-sm btn-success spinner-grow force-gpu";
document.getElementById("txtBeacon").setAttribute("class","input-group-text p-1"); document.getElementById("txtBeacon").setAttribute("class","input-group-text p-1");
} else { } else {
bcn.className = "btn btn-sm btn-success"; bcn.className = "btn btn-sm btn-success";
@ -1950,23 +1858,6 @@ var speedChartOptions = {
document.getElementById("bandwidth").textContent = arg.bandwidth; document.getElementById("bandwidth").textContent = arg.bandwidth;
// SET SPEED LEVEL // SET SPEED LEVEL
/*
if(arg.speed_level >= 0) {
document.getElementById("speed_level").className = "bi bi-reception-1";
}
if(arg.speed_level >= 1) {
document.getElementById("speed_level").className = "bi bi-reception-2";
}
if(arg.speed_level >= 2) {
document.getElementById("speed_level").className = "bi bi-reception-3";
}
if(arg.speed_level >= 3) {
document.getElementById("speed_level").className = "bi bi-reception-4";
}
if(arg.speed_level >= 4) {
document.getElementById("speed_level").className = "bi bi-reception-4";
}
*/
switch (arg.speed_level){ switch (arg.speed_level){
case '0': case '0':
document.getElementById("speed_level").className = "bi bi-reception-1"; document.getElementById("speed_level").className = "bi bi-reception-1";
@ -1982,8 +1873,6 @@ var speedChartOptions = {
break; break;
} }
// SET TOTAL BYTES // SET TOTAL BYTES
if (typeof(arg.total_bytes) == 'undefined') { if (typeof(arg.total_bytes) == 'undefined') {
var total_bytes = 0; var total_bytes = 0;
@ -2022,13 +1911,10 @@ var speedChartOptions = {
var myGrid = document.getElementById("myGrid").value; var myGrid = document.getElementById("myGrid").value;
try { try {
var dist = parseInt(distance(myGrid, dxGrid)) + ' km'; var dist = parseInt(distance(myGrid, dxGrid)) + ' km';
//document.getElementById("pingDistance").innerHTML = dist;
document.getElementById("dataModalPingDistance").textContent = dist; document.getElementById("dataModalPingDistance").textContent = dist;
} catch { } catch {
//document.getElementById("pingDistance").innerHTML = '---';
document.getElementById("dataModalPingDistance").textContent = '---'; document.getElementById("dataModalPingDistance").textContent = '---';
} }
//document.getElementById("pingDB").innerHTML = arg.stations[i]['snr'];
document.getElementById("dataModalPingDB").textContent = arg.stations[i]['snr']; document.getElementById("dataModalPingDB").textContent = arg.stations[i]['snr'];
} }
@ -2082,17 +1968,7 @@ var speedChartOptions = {
var dataTypeText = document.createElement('span'); var dataTypeText = document.createElement('span');
dataTypeText.innerText = arg.stations[i]['datatype']; dataTypeText.innerText = arg.stations[i]['datatype'];
dataType.appendChild(dataTypeText); dataType.appendChild(dataTypeText);
/*
if(arg.stations[i]['datatype'] == 'DATA-CHANNEL'){
dataTypeText.innerText = 'DATA-C';
dataType.appendChild(dataTypeText);
}
if(arg.stations[i]['datatype'] == 'SESSION-HB'){
dataTypeText.innerHTML = '<i class="bi bi-heart-pulse-fill"></i>';
dataType.appendChild(dataTypeText);
}
*/
switch (arg.stations[i]['datatype']){ switch (arg.stations[i]['datatype']){
case 'DATA-CHANNEL': case 'DATA-CHANNEL':
dataTypeText.innerText = 'DATA-C'; dataTypeText.innerText = 'DATA-C';
@ -2103,28 +1979,7 @@ var speedChartOptions = {
dataType.appendChild(dataTypeText); dataType.appendChild(dataTypeText);
break; break;
} }
/*
if (dataTypeText.innerText == 'CQ CQ CQ') {
row.classList.add("table-success");
}
if (dataTypeText.innerText == 'DATA-C') {
dataTypeText.innerHTML = '<i class="bi bi-file-earmark-binary-fill"></i>';
row.classList.add("table-warning");
}
if (dataTypeText.innerText == 'BEACON') {
row.classList.add("table-light");
}
if (dataTypeText.innerText == 'PING') {
row.classList.add("table-info");
}
if (dataTypeText.innerText == 'PING-ACK') {
row.classList.add("table-primary");
}
*/
switch (dataTypeText.innerText){ switch (dataTypeText.innerText){
case 'CQ CQ CQ': case 'CQ CQ CQ':
row.classList.add("table-success"); row.classList.add("table-success");