fix(wireless): keep the 2.4 GHz channel map inside its card (v0.23.13-beta)

The 2.4 GHz row of the Channel Usage panel painted over the edge of the card.

The cause is the band table, not the layout. A 40 MHz channel 1 occupies
2392-2432 MHz, but the drawn 2.4 GHz band started at 2400, so that carrier
resolved to `left: -8%` and an absolutely positioned bar at a negative offset
renders outside its container. 2.4 GHz is the only band where this can happen:
channel 1 is the lowest channel in the plan and the only one whose 40 MHz form
reaches below the round number the axis started on.

The band now starts at 2390, which is also more honest — the radio really does
reach below 2400, and clamping alone would have drawn it as though it did not.

Geometry moves to utils/spectrumGeometry.ts with tests, and keeps a clamp even
though the range now covers channel 1: band ranges are static assumptions, and
region-specific channels and widths they do not anticipate will keep appearing.
No bar can leave the card again regardless of what the backend reports.

An earlier attempt at this fixed a real but different bug in the same row: ticks
at 2400 and 2480 fall outside the channel plan, so an axis labelled by channel
fell back to printing raw frequencies, and the 2400 label sat at exactly 0% with
a centring transform and hung half its width outside the card. That fix stands;
it simply was not the whole of what the user was seeing. The verification script
used at the time filtered radios to those starting inside their band, which
silently discarded the very row that was overflowing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2GT-Rich
2026-08-23 13:35:22 -07:00
co-authored by Claude Opus 5
parent 2625fea8de
commit ec873ab8bd
9 changed files with 127 additions and 11 deletions
@@ -187,7 +187,8 @@ describe('freeSpans', () => {
});
it('returns the whole band when nothing is deployed', () => {
expect(freeSpans([], '2.4')).toEqual([{ startMhz: 2400, endMhz: 2500 }]);
// The band starts below 2400 so a 40 MHz channel 1 (2392–2432) fits inside it.
expect(freeSpans([], '2.4')).toEqual([{ startMhz: 2390, endMhz: 2500 }]);
});
});
+10 -2
View File
@@ -31,9 +31,17 @@ export interface BandRange {
endMhz: number;
}
/** Spectrum drawn for each band. Wide enough to contain every legal channel. */
/**
* Spectrum drawn for each band. Wide enough to contain every legal channel —
* including the ones that spill past the round numbers.
*
* 2.4 GHz starts at 2390 rather than 2400 because a 40 MHz channel centred on
* channel 1 occupies 2392–2432. Starting the axis at 2400 puts that carrier at a
* negative offset, which is not merely a cosmetic problem: it renders outside the
* chart and misstates how far the radio actually reaches below the band.
*/
export const BAND_RANGES: BandRange[] = [
{ band: '2.4', label: '2.4 GHz', startMhz: 2400, endMhz: 2500 },
{ band: '2.4', label: '2.4 GHz', startMhz: 2390, endMhz: 2500 },
{ band: '5', label: '5 GHz', startMhz: 5150, endMhz: 5895 },
{ band: '6', label: '6 GHz', startMhz: 5925, endMhz: 7125 },
];