From 703b08b1b7e171bff4564d510ca89ba7a54a7f50 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sun, 10 May 2026 11:35:59 +0200 Subject: [PATCH] agc in scope --- modules/web/fm95.html | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/web/fm95.html b/modules/web/fm95.html index 1504931..a8034f0 100644 --- a/modules/web/fm95.html +++ b/modules/web/fm95.html @@ -133,6 +133,7 @@
Input Level Audio Level + AGC
@@ -168,10 +169,10 @@ const FIELD_CFG = { agc_gain: { unit:'x', fmt: v=>v.toFixed(4), bar: v=>Math.max(0,Math.min(100,v*10)), warn: v=>v>3 }, }; -// --- Oscilloscope state --- const MAX_PTS = 400; -let histInput = new Array(MAX_PTS).fill(null); -let histAudio = new Array(MAX_PTS).fill(null); +let histInput = new Array(MAX_PTS).fill(null); +let histAudio = new Array(MAX_PTS).fill(null); +let histAgc = new Array(MAX_PTS).fill(null); const canvas = document.getElementById('scope'); const ctx = canvas.getContext('2d'); @@ -208,7 +209,7 @@ function drawScope() { let yMin = -1, yMax = 1; if (yscale === '2') { yMin = -2; yMax = 2; } else if (yscale === 'auto') { - const vals = [...histInput, ...histAudio].filter(v => v !== null); + const vals = [...histInput, ...histAudio, ...histAgc].filter(v => v !== null); if (vals.length) { yMin = Math.min(...vals); yMax = Math.max(...vals); @@ -271,6 +272,7 @@ function drawScope() { drawLine(histInput, '#f472b6'); drawLine(histAudio, '#38bdf8'); + drawLine(histAgc, '#fb923c'); } function decode(b64) { @@ -296,10 +298,9 @@ function updateUI(values) { }); // push to oscilloscope history - const inputVal = values[3]; - const audioVal = values[4]; - histInput.push(inputVal); if (histInput.length > MAX_PTS) histInput.shift(); - histAudio.push(audioVal); if (histAudio.length > MAX_PTS) histAudio.shift(); + histAgc.push(values[2]); if (histAgc.length > MAX_PTS) histAgc.shift(); + histInput.push(values[3]); if (histInput.length > MAX_PTS) histInput.shift(); + histAudio.push(values[4]); if (histAudio.length > MAX_PTS) histAudio.shift(); drawScope(); document.getElementById('last-update').textContent = `Last update: ${new Date().toLocaleTimeString()}`;