fix: bug where scope is now showing on IC7300
This commit is contained in:
@@ -761,6 +761,20 @@ function FlexBandAntennasPanel({ bands }: { bands: string[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
// Known Icom models paired with their FACTORY default CI-V address. Picking a
|
||||
// model sets icom_addr so the backend identifies it (civ.ModelName) and the UI
|
||||
// adapts (e.g. the attenuator steps differ by model). Keep in lockstep with
|
||||
// civ.ModelName in internal/cat/civ/civ.go. `addr` is decimal.
|
||||
const ICOM_MODELS: { name: string; addr: number }[] = [
|
||||
{ name: 'IC-705', addr: 0xA4 },
|
||||
{ name: 'IC-7300', addr: 0x94 },
|
||||
{ name: 'IC-7610', addr: 0x98 },
|
||||
{ name: 'IC-7700', addr: 0x88 },
|
||||
{ name: 'IC-7800', addr: 0x80 },
|
||||
{ name: 'IC-9100', addr: 0x7C },
|
||||
{ name: 'IC-9700', addr: 0xA2 },
|
||||
];
|
||||
|
||||
export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChanged, flexAvailable, icomAvailable }: Props) {
|
||||
const { t } = useI18n();
|
||||
const [selected, setSelected] = useState<SectionId>((initialSection as SectionId) || 'station');
|
||||
@@ -2054,12 +2068,24 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-1 col-span-2">
|
||||
<div className="space-y-1">
|
||||
<Label>{t('cat.icomModel')}</Label>
|
||||
<Select
|
||||
value={ICOM_MODELS.find((m) => m.addr === (catCfg.icom_addr ?? 0x98))?.name ?? '_custom'}
|
||||
onValueChange={(v) => { const m = ICOM_MODELS.find((x) => x.name === v); if (m) setCatCfg((s) => ({ ...s, icom_addr: m.addr })); }}>
|
||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
{ICOM_MODELS.map((m) => <SelectItem key={m.name} value={m.name}>{m.name}</SelectItem>)}
|
||||
<SelectItem value="_custom">{t('cat.icomModelOther')}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label>{t('cat.civAddr')}</Label>
|
||||
<Input value={(catCfg.icom_addr ?? 0x98).toString(16).toUpperCase().padStart(2, '0')}
|
||||
onChange={(e) => { const n = parseInt(e.target.value.replace(/[^0-9a-fA-F]/g, ''), 16); setCatCfg((s) => ({ ...s, icom_addr: (n >= 0 && n <= 0xFF) ? n : s.icom_addr })); }} />
|
||||
<p className="text-xs text-muted-foreground">{t('cat.civHint')}</p>
|
||||
</div>
|
||||
<p className="col-span-2 text-xs text-muted-foreground">{t('cat.civHint')}</p>
|
||||
</>
|
||||
)}
|
||||
{catCfg.backend === 'icom-net' && (
|
||||
@@ -2069,6 +2095,18 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
<Input placeholder="192.168.1.60" value={catCfg.icom_net_host ?? ''}
|
||||
onChange={(e) => setCatCfg((s) => ({ ...s, icom_net_host: e.target.value }))} />
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label>{t('cat.icomModel')}</Label>
|
||||
<Select
|
||||
value={ICOM_MODELS.find((m) => m.addr === (catCfg.icom_addr ?? 0x98))?.name ?? '_custom'}
|
||||
onValueChange={(v) => { const m = ICOM_MODELS.find((x) => x.name === v); if (m) setCatCfg((s) => ({ ...s, icom_addr: m.addr })); }}>
|
||||
<SelectTrigger><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
{ICOM_MODELS.map((m) => <SelectItem key={m.name} value={m.name}>{m.name}</SelectItem>)}
|
||||
<SelectItem value="_custom">{t('cat.icomModelOther')}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label>{t('cat.civAddr')}</Label>
|
||||
<Input value={(catCfg.icom_addr ?? 0x98).toString(16).toUpperCase().padStart(2, '0')}
|
||||
|
||||
Reference in New Issue
Block a user