1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-27 14:33:52 +01:00

Fix direct frequency entry rounding errors

Add rounding to frequency multiplication to fix frequency rounding errors on direct entry
This commit is contained in:
Adam Wisher
2024-10-12 08:03:30 +01:00
committed by GitHub
parent 6c4b654e2d
commit 1bd5148a11

View File

@@ -88,7 +88,7 @@ $(document).ready(function () {
const inputValue = Number(textInput.val()); const inputValue = Number(textInput.val());
// Check if the user agent contains 'iPhone' // Check if the user agent contains 'iPhone'
if (/iPhone/i.test(navigator.userAgent)) { if (/iPhone/i.test(navigator.userAgent)) {
socket.send("T" + (inputValue * 1000)); socket.send("T" + (Math.round(inputValue * 1000)));
// Clear the input field if needed // Clear the input field if needed
textInput.val(''); textInput.val('');
} }
@@ -118,7 +118,7 @@ $(document).ready(function () {
if (event.key === 'Enter') { if (event.key === 'Enter') {
const inputValue = textInput.val(); const inputValue = textInput.val();
if (socket.readyState === WebSocket.OPEN) { if (socket.readyState === WebSocket.OPEN) {
socket.send("T" + (inputValue * 1000)); socket.send("T" + (Math.round(inputValue * 1000)));
} }
textInput.val(''); textInput.val('');
} }
@@ -1129,4 +1129,4 @@ function fillPresets() {
tuneTo(Number(presetText)); tuneTo(Number(presetText));
}); });
} }
} }