feat: type freq in RX freq will send the radio for Icom and Flex

This commit is contained in:
2026-07-15 13:07:51 +02:00
parent 3cd80ead81
commit d354709939
2 changed files with 18 additions and 2 deletions
+16
View File
@@ -2997,6 +2997,18 @@ export default function App() {
</div>
);
// CQ/ITU zones moved to the Info (F2) tab (DetailsPanel).
// Type a frequency, press Enter → tune the radio there. Only when a rig is
// actually connected (these same fields are the manual-log entry when it isn't),
// and only on a plausible HF/VHF value so a half-typed "14." doesn't QSY the rig
// to 14 kHz. noteManualEdit() holds off the incoming poll so the field doesn't
// snap back before the radio's echo confirms the move.
const tuneRadioTo = (mhzStr: string) => {
if (!(catState.enabled && catState.connected)) return;
const mhz = parseFloat(mhzStr);
if (!Number.isFinite(mhz) || mhz < 0.1 || mhz > 3000) return;
noteManualEdit();
SetCATFrequency(Math.round(mhz * 1_000_000)).catch(() => {});
};
const freqBlock = (
<div className="flex flex-col w-32">
<Label className="mb-1 h-3.5 flex items-center gap-1">{t('field.txFreq')} <LockBtn k="freq" title="frequency" /></Label>
@@ -3005,8 +3017,10 @@ export default function App() {
className="font-mono"
value={freqFocused ? freqMhz : (freqMhz ? fmtFreqDots(freqMhz) : '')}
placeholder="14.250"
title={catState.connected ? t('field.freqTuneHint') : undefined}
onFocus={() => setFreqFocused(true)}
onBlur={() => setFreqFocused(false)}
onKeyDown={(e) => { if (e.key === 'Enter') tuneRadioTo(freqMhz); }}
onChange={(e) => { setFreqMhz(e.target.value); noteManualEdit(); const b = bandForMHz(parseFloat(e.target.value)); if (b) setBand(b); }}
/>
</div>
@@ -3018,8 +3032,10 @@ export default function App() {
tabIndex={-1}
value={freqFocused ? rxFreqMhz : (rxFreqMhz ? fmtFreqDots(rxFreqMhz) : '')}
placeholder="14.255"
title={catState.connected ? t('field.freqTuneHint') : undefined}
onFocus={() => setFreqFocused(true)}
onBlur={() => setFreqFocused(false)}
onKeyDown={(e) => { if (e.key === 'Enter') tuneRadioTo(rxFreqMhz); }}
onChange={(e) => { setRxFreqMhz(e.target.value); noteManualEdit(); const rb = bandForMHz(parseFloat(e.target.value)); if (rb) setBandRx(rb); }}
className={cn('font-mono', catState.split && 'bg-danger-muted/40 border-danger-border focus:bg-card')}
/>