first working fft

This commit is contained in:
DJ2LS 2021-09-05 11:26:09 +02:00 committed by GitHub
parent 64500f6304
commit ad018e9a31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 5 deletions

View file

@ -48,14 +48,13 @@ var daemonProcess = null;
function createWindow() {
win = new BrowserWindow({
width: 1220,
height: 830,
height: 920,
autoHideMenuBar: true,
icon: __dirname + '/src/app-icon.png',
webPreferences: {
//preload: path.join(__dirname, 'preload-main.js'),
preload: require.resolve('./preload-main.js'),
nodeIntegration: true,
nativeWindowOpen: true,
contextIsolation: false,
enableRemoteModule: false, //https://stackoverflow.com/questions/53390798/opening-new-window-electron/53393655 https://github.com/electron/remote
}

View file

@ -24,14 +24,17 @@ setInterval(sock.getTncState, 250)
setInterval(sock.getRxBuffer, 1000)
// UPDATE FFT DEMO
/*
updateFFT = function(fft) {
var fft = Array.from({
length: 2048
}, () => Math.floor(Math.random() * 10));
spectrum.addData(fft);
console.log(fft)
}
setInterval(updateFFT, 250)
*/
// WINDOW LISTENER
window.addEventListener('DOMContentLoaded', () => {
@ -279,6 +282,26 @@ window.addEventListener('DOMContentLoaded', () => {
ipcRenderer.on('action-update-tnc-state', (event, arg) => {
/*
var fft = Array.from({
length: 2048
}, () => Math.floor(Math.random() * 10));
spectrum.addData(fft);
*/
// update FFT
if (typeof(arg.fft) !== 'undefined') {
//console.log(arg.fft)
console.log(typeof(arg.fft))
var array = JSON.parse("[" + arg.fft + "]");
console.log(typeof(array))
console.log(array[0])
spectrum.addData(array[0]);
}
// TOE TIME OF EXECUTION --> How many time needs a command to be executed until data arrives
if (typeof(arg.toe) == 'undefined') {
var toe = 0
@ -749,4 +772,4 @@ ipcRenderer.on('run-tnc-command', (event, arg) => {
if (arg.command == 'sendMessage') {
sock.sendMessage(arg.dxcallsign, arg.mode, arg.frames, arg.data, arg.checksum)
}
});
});

View file

@ -134,6 +134,7 @@ client.on('data', function(data) {
mode: data['MODE'],
bandwith: data['BANDWITH'],
rms_level: (data['AUDIO_RMS'] / 1000) * 100,
fft: data['FFT'],
scatter: data['SCATTER'],
rx_buffer_length: data['RX_BUFFER_LENGTH'],
tx_n_max_retries: data['TX_N_MAX_RETRIES'],
@ -237,4 +238,4 @@ exports.getRxBuffer = function() {
if (rxBufferLengthGui != rxBufferLengthTnc) {
writeTncCommand(command)
}
}
}