show list of channels

This commit is contained in:
Lewis Moten
2024-05-03 23:56:59 -04:00
parent 348ea8df7c
commit 8059de37b2
3 changed files with 27 additions and 4 deletions

View File

@@ -89,6 +89,10 @@
Effective Baud: <span id="effective-speed-bits-per-second">N/A</span><br> Effective Baud: <span id="effective-speed-bits-per-second">N/A</span><br>
Effective Bytes/s: <span id="effective-speed-bytes-per-second">N/A</span><br /> Effective Bytes/s: <span id="effective-speed-bytes-per-second">N/A</span><br />
</div> </div>
<div>
<h2>Channels</h2>
<ol id="channel-list" start="0"></ol>
</div>
</div> </div>
</body> </body>

View File

@@ -160,7 +160,8 @@ function updateFrequencyResolution() {
function showSpeed() { function showSpeed() {
const segmentsPerSecond = 1000 / FREQUENCY_DURATION; const segmentsPerSecond = 1000 / FREQUENCY_DURATION;
const bitsPerSegment = getChannels().length; const channels = getChannels();
const bitsPerSegment = channels.length;
const baud = bitsPerSegment * segmentsPerSecond; const baud = bitsPerSegment * segmentsPerSecond;
const bytes = baud / 8; const bytes = baud / 8;
document.getElementById('durations-per-second').innerText = segmentsPerSecond.toFixed(2); document.getElementById('durations-per-second').innerText = segmentsPerSecond.toFixed(2);
@@ -178,6 +179,14 @@ function showSpeed() {
document.getElementById('effective-speed-bits-per-second').innerText = effectiveBaud.toFixed(2); document.getElementById('effective-speed-bits-per-second').innerText = effectiveBaud.toFixed(2);
document.getElementById('effective-speed-bytes-per-second').innerText = effectiveBytes.toFixed(2); document.getElementById('effective-speed-bytes-per-second').innerText = effectiveBytes.toFixed(2);
} }
const channelList = document.getElementById('channel-list');
channelList.innerHTML = "";
channels.forEach(([low, high]) => {
const li = document.createElement('li');
li.textContent = `Low: ${low} Hz High: ${high} Hz`;
channelList.appendChild(li);
})
handleTextToSendInput(); handleTextToSendInput();
} }
function nibbleToHamming(nibble) { function nibbleToHamming(nibble) {
@@ -221,9 +230,9 @@ function getChannels() {
const frequencyResolution = sampleRate / fftSize; const frequencyResolution = sampleRate / fftSize;
const channels = []; const channels = [];
const pairStep = frequencyResolution * 2 * FREQUENCY_RESOLUTION_MULTIPLIER; const pairStep = frequencyResolution * 2 * FREQUENCY_RESOLUTION_MULTIPLIER;
for(let hz = MINIMUM_FREQUENCY; hz < MAXIMUM_FREQUENCY; hz+= pairStep * 2) { for(let hz = MINIMUM_FREQUENCY; hz < MAXIMUM_FREQUENCY; hz+= pairStep) {
const low = hz; const low = Math.floor(hz);
const high = hz + frequencyResolution * FREQUENCY_RESOLUTION_MULTIPLIER; const high = Math.floor(hz + frequencyResolution * FREQUENCY_RESOLUTION_MULTIPLIER);
if(low < MINIMUM_FREQUENCY) continue; if(low < MINIMUM_FREQUENCY) continue;
if(high > MAXIMUM_FREQUENCY) continue; if(high > MAXIMUM_FREQUENCY) continue;
channels.push([low, high]); channels.push([low, high]);

View File

@@ -37,4 +37,14 @@ textarea, .raw-data {
} }
.bit-unexpected { .bit-unexpected {
color: green; color: green;
}
ol {
overflow: auto;
height: 75px;
background-color: rgb(41, 59, 10);
color: rgb(75, 185, 75);
border: 1px solid grey;
font-size: x-small;
font-family: monospace;
width: 250px;
} }