From 1bd5148a11583d0c3b4210ee98d19e88e5edc59d Mon Sep 17 00:00:00 2001 From: Adam Wisher <37659188+mrwish7@users.noreply.github.com> Date: Sat, 12 Oct 2024 08:03:30 +0100 Subject: [PATCH] Fix direct frequency entry rounding errors Add rounding to frequency multiplication to fix frequency rounding errors on direct entry --- web/js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/js/main.js b/web/js/main.js index a008dc8..3cc0eeb 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -88,7 +88,7 @@ $(document).ready(function () { const inputValue = Number(textInput.val()); // Check if the user agent contains 'iPhone' if (/iPhone/i.test(navigator.userAgent)) { - socket.send("T" + (inputValue * 1000)); + socket.send("T" + (Math.round(inputValue * 1000))); // Clear the input field if needed textInput.val(''); } @@ -118,7 +118,7 @@ $(document).ready(function () { if (event.key === 'Enter') { const inputValue = textInput.val(); if (socket.readyState === WebSocket.OPEN) { - socket.send("T" + (inputValue * 1000)); + socket.send("T" + (Math.round(inputValue * 1000))); } textInput.val(''); } @@ -1129,4 +1129,4 @@ function fillPresets() { tuneTo(Number(presetText)); }); } -} \ No newline at end of file +}