[feat](trx-frontend-http): draw virtual channel markers on spectrum + OOB error
- Draw sky-blue dashed/solid lines on spectrum overlay for each vchan - Active virtual channel gets a solid line; inactive ones are dashed - Validate freq against SDR capture window in vchanSetChannelFreq and show a showHint error when tuning out of bandwidth Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -962,6 +962,28 @@ function drawSignalOverlay() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Virtual channel markers (sky-blue dashed lines, active one is solid).
|
||||||
|
if (typeof vchanChannels !== "undefined" && Array.isArray(vchanChannels)) {
|
||||||
|
vchanChannels.forEach(ch => {
|
||||||
|
if (!Number.isFinite(ch.freq_hz) || ch.freq_hz <= 0) return;
|
||||||
|
const xc = hzToX(ch.freq_hz);
|
||||||
|
if (xc < 0 || xc > W) return;
|
||||||
|
const isActive = ch.id === vchanActiveId;
|
||||||
|
const color = cssColorToRgba("#38bdf8");
|
||||||
|
if (isActive) {
|
||||||
|
signalOverlayGl.drawSegments([xc, 0, xc, H], color, Math.max(1.5, dpr * 1.5));
|
||||||
|
} else {
|
||||||
|
signalOverlayGl.drawDashedVerticalLine(
|
||||||
|
xc, 0, H,
|
||||||
|
Math.max(2, Math.round(4 * dpr)),
|
||||||
|
Math.max(3, Math.round(6 * dpr)),
|
||||||
|
color,
|
||||||
|
Math.max(1, dpr),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (lastFreqHz != null) {
|
if (lastFreqHz != null) {
|
||||||
const xf = hzToX(lastFreqHz);
|
const xf = hzToX(lastFreqHz);
|
||||||
if (xf >= 0 && xf <= W) {
|
if (xf >= 0 && xf <= W) {
|
||||||
|
|||||||
@@ -217,6 +217,21 @@ let _origRefreshFreqDisplay = null;
|
|||||||
|
|
||||||
async function vchanSetChannelFreq(freqHz) {
|
async function vchanSetChannelFreq(freqHz) {
|
||||||
if (!vchanRigId || !vchanActiveId) return;
|
if (!vchanRigId || !vchanActiveId) return;
|
||||||
|
// Validate against current SDR capture window.
|
||||||
|
if (typeof lastSpectrumData !== "undefined" && lastSpectrumData &&
|
||||||
|
lastSpectrumData.sample_rate > 0) {
|
||||||
|
const halfSpan = Number(lastSpectrumData.sample_rate) / 2;
|
||||||
|
const center = Number(lastSpectrumData.center_hz);
|
||||||
|
if (Math.abs(freqHz - center) > halfSpan) {
|
||||||
|
if (typeof showHint === "function") {
|
||||||
|
showHint(
|
||||||
|
`Out of SDR bandwidth (center ${(center / 1e6).toFixed(3)} MHz ±${(halfSpan / 1e3).toFixed(0)} kHz)`,
|
||||||
|
3000
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(
|
const resp = await fetch(
|
||||||
`/channels/${encodeURIComponent(vchanRigId)}/${encodeURIComponent(vchanActiveId)}/freq`,
|
`/channels/${encodeURIComponent(vchanRigId)}/${encodeURIComponent(vchanActiveId)}/freq`,
|
||||||
|
|||||||
Reference in New Issue
Block a user