mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
even more linting
This commit is contained in:
parent
d373660502
commit
bb9d29d3b4
3 changed files with 14 additions and 21 deletions
|
@ -194,7 +194,7 @@ function syncWithModem() {
|
||||||
class="btn btn-outline-secondary"
|
class="btn btn-outline-secondary"
|
||||||
@click="syncWithModem()"
|
@click="syncWithModem()"
|
||||||
>
|
>
|
||||||
Modem Sync
|
Modem Sync {{state.rx_buffer_length}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
var net = require("net");
|
var net = require("net");
|
||||||
const path = require("path");
|
|
||||||
//const FD = require("./src/js/freedata.js");
|
|
||||||
import { atob_FD, btoa_FD } from "./freedata";
|
import { atob_FD, btoa_FD } from "./freedata";
|
||||||
//import FD from './freedata.js';
|
|
||||||
|
|
||||||
import { addDataToWaterfall } from "../js/waterfallHandler.js";
|
import { addDataToWaterfall } from "../js/waterfallHandler.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -32,11 +28,6 @@ var socketchunk = ""; // Current message, per connection.
|
||||||
//const split_char = "\0;\1;";
|
//const split_char = "\0;\1;";
|
||||||
const split_char = "0;1;";
|
const split_char = "0;1;";
|
||||||
|
|
||||||
// globals for getting new data only if available so we are saving bandwidth
|
|
||||||
var rxBufferLengthTnc = 0;
|
|
||||||
var rxBufferLengthGui = 0;
|
|
||||||
//var rxMsgBufferLengthTnc = 0;
|
|
||||||
//var rxMsgBufferLengthGui = 0;
|
|
||||||
|
|
||||||
// global to keep track of Modem connection error emissions
|
// global to keep track of Modem connection error emissions
|
||||||
var modemShowConnectStateError = 1;
|
var modemShowConnectStateError = 1;
|
||||||
|
@ -144,14 +135,14 @@ client.on("data", function (socketdata) {
|
||||||
//data = JSON.parse(socketchunk[0])
|
//data = JSON.parse(socketchunk[0])
|
||||||
|
|
||||||
// search for empty entries in socketchunk and remove them
|
// search for empty entries in socketchunk and remove them
|
||||||
for (var i = 0; i < socketchunk.length; i++) {
|
for (let i = 0; i < socketchunk.length; i++) {
|
||||||
if (socketchunk[i] === "") {
|
if (socketchunk[i] === "") {
|
||||||
socketchunk.splice(i, 1);
|
socketchunk.splice(i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//iterate through socketchunks array to execute multiple commands in row
|
//iterate through socketchunks array to execute multiple commands in row
|
||||||
for (var i = 0; i < socketchunk.length; i++) {
|
for (let i = 0; i < socketchunk.length; i++) {
|
||||||
//check if data is not empty
|
//check if data is not empty
|
||||||
if (socketchunk[i].length > 0) {
|
if (socketchunk[i].length > 0) {
|
||||||
//try to parse JSON
|
//try to parse JSON
|
||||||
|
@ -169,10 +160,8 @@ client.on("data", function (socketdata) {
|
||||||
//console.log(data)
|
//console.log(data)
|
||||||
if (data["command"] == "modem_state") {
|
if (data["command"] == "modem_state") {
|
||||||
//console.log(data)
|
//console.log(data)
|
||||||
// set length of RX Buffer to global variable
|
|
||||||
rxBufferLengthTnc = data["rx_buffer_length"];
|
|
||||||
//rxMsgBufferLengthTnc = data["rx_msg_buffer_length"];
|
|
||||||
|
|
||||||
|
stateStore.rx_buffer_length = data["rx_buffer_length"];
|
||||||
stateStore.frequency = data["frequency"];
|
stateStore.frequency = data["frequency"];
|
||||||
stateStore.busy_state = data["modem_state"];
|
stateStore.busy_state = data["modem_state"];
|
||||||
stateStore.arq_state = data["arq_state"];
|
stateStore.arq_state = data["arq_state"];
|
||||||
|
@ -234,13 +223,13 @@ client.on("data", function (socketdata) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove ported objects
|
// TODO: Remove ported objects
|
||||||
|
/*
|
||||||
let Data = {
|
let Data = {
|
||||||
mycallsign: data["mycallsign"],
|
mycallsign: data["mycallsign"],
|
||||||
mygrid: data["mygrid"],
|
mygrid: data["mygrid"],
|
||||||
//channel_state: data['CHANNEL_STATE'],
|
//channel_state: data['CHANNEL_STATE'],
|
||||||
|
|
||||||
info: data["info"],
|
info: data["info"],
|
||||||
rx_buffer_length: data["rx_buffer_length"],
|
|
||||||
rx_msg_buffer_length: data["rx_msg_buffer_length"],
|
rx_msg_buffer_length: data["rx_msg_buffer_length"],
|
||||||
tx_n_max_retries: data["tx_n_max_retries"],
|
tx_n_max_retries: data["tx_n_max_retries"],
|
||||||
arq_tx_n_frames_per_burst: data["arq_tx_n_frames_per_burst"],
|
arq_tx_n_frames_per_burst: data["arq_tx_n_frames_per_burst"],
|
||||||
|
@ -258,7 +247,7 @@ client.on("data", function (socketdata) {
|
||||||
listen: data["listen"],
|
listen: data["listen"],
|
||||||
//speed_table: [{"bpm" : 5200, "snr": -3, "timestamp":1673555399},{"bpm" : 2315, "snr": 12, "timestamp":1673555500}],
|
//speed_table: [{"bpm" : 5200, "snr": -3, "timestamp":1673555399},{"bpm" : 2315, "snr": 12, "timestamp":1673555500}],
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
//continue to next for loop iteration, nothing else needs to be done here
|
//continue to next for loop iteration, nothing else needs to be done here
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -842,7 +831,7 @@ export function set_rf_level(rf_level) {
|
||||||
//console.log(crc32('abc'));
|
//console.log(crc32('abc'));
|
||||||
//console.log(crc32('abc').toString(16).toUpperCase()); // hex
|
//console.log(crc32('abc').toString(16).toUpperCase()); // hex
|
||||||
|
|
||||||
var crc32 = function (r) {
|
function crc32(r) {
|
||||||
for (var a, o = [], c = 0; c < 256; c++) {
|
for (var a, o = [], c = 0; c < 256; c++) {
|
||||||
a = c;
|
a = c;
|
||||||
for (var f = 0; f < 8; f++) a = 1 & a ? 3988292384 ^ (a >>> 1) : a >>> 1;
|
for (var f = 0; f < 8; f++) a = 1 & a ? 3988292384 ^ (a >>> 1) : a >>> 1;
|
||||||
|
@ -858,10 +847,11 @@ function prepareStatsDataForStore(data) {
|
||||||
// dummy data
|
// dummy data
|
||||||
//state.arq_speed_list = [{"snr":0.0,"bpm":104,"timestamp":1696189769},{"snr":0.0,"bpm":80,"timestamp":1696189778},{"snr":0.0,"bpm":70,"timestamp":1696189783},{"snr":0.0,"bpm":58,"timestamp":1696189792},{"snr":0.0,"bpm":52,"timestamp":1696189797},{"snr":"NaN","bpm":42,"timestamp":1696189811},{"snr":0.0,"bpm":22,"timestamp":1696189875},{"snr":0.0,"bpm":21,"timestamp":1696189881},{"snr":0.0,"bpm":17,"timestamp":1696189913},{"snr":0.0,"bpm":15,"timestamp":1696189932},{"snr":0.0,"bpm":15,"timestamp":1696189937},{"snr":0.0,"bpm":14,"timestamp":1696189946},{"snr":-6.1,"bpm":14,"timestamp":1696189954},{"snr":-6.1,"bpm":14,"timestamp":1696189955},{"snr":-5.5,"bpm":28,"timestamp":1696189963},{"snr":-5.5,"bpm":27,"timestamp":1696189963}]
|
//state.arq_speed_list = [{"snr":0.0,"bpm":104,"timestamp":1696189769},{"snr":0.0,"bpm":80,"timestamp":1696189778},{"snr":0.0,"bpm":70,"timestamp":1696189783},{"snr":0.0,"bpm":58,"timestamp":1696189792},{"snr":0.0,"bpm":52,"timestamp":1696189797},{"snr":"NaN","bpm":42,"timestamp":1696189811},{"snr":0.0,"bpm":22,"timestamp":1696189875},{"snr":0.0,"bpm":21,"timestamp":1696189881},{"snr":0.0,"bpm":17,"timestamp":1696189913},{"snr":0.0,"bpm":15,"timestamp":1696189932},{"snr":0.0,"bpm":15,"timestamp":1696189937},{"snr":0.0,"bpm":14,"timestamp":1696189946},{"snr":-6.1,"bpm":14,"timestamp":1696189954},{"snr":-6.1,"bpm":14,"timestamp":1696189955},{"snr":-5.5,"bpm":28,"timestamp":1696189963},{"snr":-5.5,"bpm":27,"timestamp":1696189963}]
|
||||||
|
|
||||||
if (typeof data == "undefined") {
|
|
||||||
var speed_listSize = 0;
|
var speed_listSize = 0;
|
||||||
|
if (typeof data == "undefined") {
|
||||||
|
speed_listSize = 0;
|
||||||
} else {
|
} else {
|
||||||
var speed_listSize = data.length;
|
speed_listSize = data.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
var speed_list_bpm = [];
|
var speed_list_bpm = [];
|
||||||
|
|
|
@ -59,6 +59,8 @@ export const useStateStore = defineStore("stateStore", () => {
|
||||||
var python_version = ref();
|
var python_version = ref();
|
||||||
var modem_version = ref();
|
var modem_version = ref();
|
||||||
|
|
||||||
|
var rx_buffer_length = ref();
|
||||||
|
|
||||||
function getChannelBusySlotState(slot) {
|
function getChannelBusySlotState(slot) {
|
||||||
const slot_state = channel_busy_slot.value;
|
const slot_state = channel_busy_slot.value;
|
||||||
|
|
||||||
|
@ -176,5 +178,6 @@ export const useStateStore = defineStore("stateStore", () => {
|
||||||
rigctld_process,
|
rigctld_process,
|
||||||
python_version,
|
python_version,
|
||||||
modem_version,
|
modem_version,
|
||||||
|
rx_buffer_length,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue