fix(cat): choosing a radio switches CAT on, and the log stops lying

A Flex 6700 owner's log: no connection attempt of any kind, and six
saves each answered with

    cat: settings saved, link unchanged - staying connected

His settings were right — FlexRadio selected, 192.168.1.154, port 4992,
and the detector had found and named his radio back at him. What was off
was the master CAT switch, which sits above the radio dropdown.

Three things, because each of them failed him on its own.

The log line was false on both counts: a disabled CAT has the signature
"off", so every save took the unchanged branch and announced a link that
was staying connected when nothing was connected at all. It now says CAT
is switched off, which is the fact he needed and the only place it could
have reached him.

The panel says it too, where he was actually looking: a notice under the
switch while it is off, because everything below it can be perfectly
right and still connect to nothing.

And choosing a radio now ticks the switch. Picking a brand, typing an
address, running a detector and clicking the radio it found are all one
gesture — "connect to this" — and making the operator find a separate
master switch afterwards is a trap. Nothing here ever turns CAT off on
its own; they can still untick it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
2026-09-08 18:52:19 +02:00
co-authored by Claude Opus 5
parent d185b10559
commit 6f1c998a26
4 changed files with 39 additions and 8 deletions
+18 -2
View File
@@ -1871,13 +1871,21 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
// else writes the backend (loading a profile, an older settings file).
const catBrand = brandOfBackend(catCfg.backend, (catCfg as any).kenwood_link).brand;
const catLink = brandOfBackend(catCfg.backend, (catCfg as any).kenwood_link).link;
// Choosing a radio TURNS CAT ON.
//
// The master switch sits above this dropdown, and leaving it off while the
// operator picks their brand, types the IP and runs the detector — which found
// their radio and printed its name — is a trap: every one of those gestures
// means "connect to this". A Flex 6700 owner did exactly that, saved six
// times, and got no link and no error. They can still untick it; nothing here
// ever turns CAT off on its own.
const applyCatBrand = (id: string) => {
const b = CAT_BRANDS.find((x) => x.id === id);
if (!b) return;
// Keep the connection when the new brand offers it, otherwise take its
// first — picking Flex from Kenwood-over-USB has to land on something.
const link = b.links.includes(catLink) ? catLink : b.links[0];
setCatCfg((s) => ({ ...s, backend: b.backend(link), kenwood_link: link } as any));
setCatCfg((s) => ({ ...s, backend: b.backend(link), kenwood_link: link, enabled: true } as any));
};
const applyCatLink = (link: string) => {
const b = CAT_BRANDS.find((x) => x.id === catBrand);
@@ -3578,6 +3586,14 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
<Checkbox checked={catCfg.enabled} onCheckedChange={(c) => setCatCfg((s) => ({ ...s, enabled: !!c }))} />
{t('cat.enable')}
</label>
{/* Said where it is happening. Everything below this line can be filled
in perfectly the right radio, the right address, the detector
finding it by name and none of it connects while this is off. */}
{!catCfg.enabled && (
<div className="rounded-md border border-warning-border bg-warning-muted px-3 py-2 text-xs text-warning-muted-foreground">
{t('cat.disabledNotice')}
</div>
)}
{/* BRAND, then CONNECTION.
The backend list mixed the two: "Icom (USB)" and "Icom (network)"
@@ -3663,7 +3679,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
onChange={(n) => setCatCfg((s) => ({ ...s, flex_port: n }))} fallback={4992} />
</div>
<div className="col-span-2">
<FlexDiscover onPick={(ip, port) => setCatCfg((s) => ({ ...s, flex_host: ip, flex_port: port }))} />
<FlexDiscover onPick={(ip, port) => setCatCfg((s) => ({ ...s, flex_host: ip, flex_port: port, enabled: true }))} />
</div>
{/* What OpsLog DOES with a Flex panadapter spots, decode spots,
the DAX switch for voice messages moved to Settings