You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
Merge branch 'main' into Bkram/enhance-mousewheel-tuning
This commit is contained in:
@@ -342,10 +342,10 @@ function checkKey(e) {
|
|||||||
socket.send("T" + (currentFreq.toFixed(1) * 1000));
|
socket.send("T" + (currentFreq.toFixed(1) * 1000));
|
||||||
break;
|
break;
|
||||||
case 38:
|
case 38:
|
||||||
socket.send("T" + ((currentFreq + 0.01).toFixed(2) * 1000));
|
socket.send("T" + (Math.round(currentFreq*1000) + ((currentFreq > 30) ? 10 : 1)));
|
||||||
break;
|
break;
|
||||||
case 40:
|
case 40:
|
||||||
socket.send("T" + ((currentFreq - 0.01).toFixed(2) * 1000));
|
socket.send("T" + (Math.round(currentFreq*1000) - ((currentFreq > 30) ? 10 : 1)));
|
||||||
break;
|
break;
|
||||||
case 37:
|
case 37:
|
||||||
tuneDown();
|
tuneDown();
|
||||||
@@ -365,18 +365,18 @@ function tuneUp() {
|
|||||||
getCurrentFreq();
|
getCurrentFreq();
|
||||||
let addVal = 0;
|
let addVal = 0;
|
||||||
if (currentFreq < 0.52) {
|
if (currentFreq < 0.52) {
|
||||||
addVal = 9 - ((currentFreq * 1000) % 9);
|
addVal = 9 - (Math.round(currentFreq*1000) % 9);
|
||||||
} else if (currentFreq < 1.71) {
|
} else if (currentFreq < 1.71) {
|
||||||
// TODO: Rework to replace 9 with 9 or 10 based on regionalisation setting
|
// TODO: Rework to replace 9 with 9 or 10 based on regionalisation setting
|
||||||
addVal = 9 - ((currentFreq * 1000) % 9);
|
addVal = 9 - (Math.round(currentFreq*1000) % 9);
|
||||||
} else if (currentFreq < 29.6) {
|
} else if (currentFreq < 29.6) {
|
||||||
addVal = 5 - ((currentFreq * 1000) % 5);
|
addVal = 5 - (Math.round(currentFreq*1000) % 5);
|
||||||
} else if (currentFreq >= 65.9 && currentFreq < 74) {
|
} else if (currentFreq >= 65.9 && currentFreq < 74) {
|
||||||
addVal = ((currentFreq * 1000) % 30 == 20) ? 30 : (20 - ((currentFreq * 1000) % 30));
|
addVal = 30 - ((Math.round(currentFreq*1000) - 65900) % 30);
|
||||||
} else {
|
} else {
|
||||||
addVal = 100 - ((currentFreq * 1000) % 100);
|
addVal = 100 - (Math.round(currentFreq*1000) % 100);
|
||||||
}
|
}
|
||||||
socket.send("T" + ((currentFreq * 1000) + addVal));
|
socket.send("T" + (Math.round(currentFreq*1000) + addVal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,18 +385,18 @@ function tuneDown() {
|
|||||||
getCurrentFreq();
|
getCurrentFreq();
|
||||||
let subVal = 0;
|
let subVal = 0;
|
||||||
if (currentFreq < 0.52) {
|
if (currentFreq < 0.52) {
|
||||||
subVal = ((currentFreq * 1000) % 9 == 0) ? 9 : ((currentFreq * 1000) % 9);
|
subVal = (Math.round(currentFreq*1000) % 9 == 0) ? 9 : (Math.round(currentFreq*1000) % 9);
|
||||||
} else if (currentFreq < 1.71) {
|
} else if (currentFreq < 1.71) {
|
||||||
// TODO: Rework to replace 9 with 9 or 10 based on regionalisation setting
|
// TODO: Rework to replace 9 with 9 or 10 based on regionalisation setting
|
||||||
subVal = ((currentFreq * 1000) % 9 == 0) ? 9 : ((currentFreq * 1000) % 9);
|
subVal = (Math.round(currentFreq*1000) % 9 == 0) ? 9 : (Math.round(currentFreq*1000) % 9);
|
||||||
} else if (currentFreq < 29.6) {
|
} else if (currentFreq < 29.6) {
|
||||||
subVal = ((currentFreq * 1000) % 5 == 0) ? 5 : ((currentFreq * 1000) % 5);
|
subVal = (Math.round(currentFreq*1000) % 5 == 0) ? 5 : (Math.round(currentFreq*1000) % 5);
|
||||||
} else if (currentFreq >= 65.9 && currentFreq < 74) {
|
} else if (currentFreq > 65.9 && currentFreq <= 74) {
|
||||||
subVal = ((currentFreq * 1000) % 30 == 20) ? 30 : (10 + ((currentFreq * 1000) % 30));
|
subVal = ((Math.round(currentFreq*1000) - 65900) % 30 == 0) ? 30 : ((Math.round(currentFreq*1000) - 65900) % 30);
|
||||||
} else {
|
} else {
|
||||||
subVal = ((currentFreq * 1000) % 100 == 0) ? 100 : ((currentFreq * 1000) % 100);
|
subVal = (Math.round(currentFreq*1000) % 100 == 0) ? 100 : (Math.round(currentFreq*1000) % 100);
|
||||||
}
|
}
|
||||||
socket.send("T" + ((currentFreq * 1000) - subVal));
|
socket.send("T" + (Math.round(currentFreq*1000) - subVal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,11 +509,11 @@ function updateSignalUnits(parsedData) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const integerPart = Math.floor(signalValue);
|
const formatted = (Math.round(signalValue * 10) / 10).toFixed(1);
|
||||||
const decimalPart = (signalValue - integerPart).toFixed(1).slice(1);
|
const [integerPart, decimalPart] = formatted.split('.');
|
||||||
|
|
||||||
$('#data-signal').text(integerPart);
|
$('#data-signal').text(integerPart);
|
||||||
$('#data-signal-decimal').text(decimalPart);
|
$('#data-signal-decimal').text('.' + decimalPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDataElements(parsedData) {
|
function updateDataElements(parsedData) {
|
||||||
|
|||||||
Reference in New Issue
Block a user