fix: a rig reporting LSB/USB left the mode selector empty
From a Kenwood trace: IF answered mode digit 1 on 7.160 MHz, the backend read LSB correctly, and the entry form showed no mode at all while the frequency tracked perfectly. Nothing was wrong in the backend. Radios report the SIDEBAND, and the station's mode list holds SSB — so the value pushed into the selector was not in its own list of options and nothing could match. Yaesu and Icom report the same way, so this was never Kenwood-specific; it only surfaced there. Normalising at the point where a rig-reported mode enters the form fixes every backend at once, rather than editing three mode tables and the next backend someone writes. It is also the ADIF-correct direction, which matters more than the selector: LSB and USB are SUBMODEs in ADIF, not modes. MODE=LSB is not a valid value and is what would have gone to LoTW and eQSL. An operator who has deliberately put LSB or USB in their own mode list keeps them — the list is their statement of what they log, not ours.
This commit is contained in:
+27
-4
@@ -392,6 +392,8 @@ export default function App() {
|
||||
// === Lists from settings (fallback for first paint) ===
|
||||
const [bands, setBands] = useState<string[]>(DEFAULT_BANDS);
|
||||
const [modes, setModes] = useState<string[]>(DEFAULT_MODES);
|
||||
const modesRef = useRef(modes);
|
||||
useEffect(() => { modesRef.current = modes; }, [modes]);
|
||||
const [modePresets, setModePresets] = useState<ModePreset[]>([]);
|
||||
|
||||
// === Entry ===
|
||||
@@ -2044,9 +2046,29 @@ export default function App() {
|
||||
// a 599 left from a CW QSO would stick when jumping to an SSB spot.
|
||||
function applyModeFromSpot(m: string) {
|
||||
if (!m) return;
|
||||
setMode(m);
|
||||
const logged = catModeToLoggedMode(m);
|
||||
setMode(logged);
|
||||
rstUserEditedRef.current = false;
|
||||
applyModePreset(m);
|
||||
applyModePreset(logged);
|
||||
}
|
||||
// catModeToLoggedMode maps what a radio reports onto a mode this station
|
||||
// actually logs.
|
||||
//
|
||||
// Radios report the SIDEBAND — a Kenwood or Yaesu on 40 m answers LSB, not
|
||||
// SSB. The mode list is SSB, so nothing matched and the selector sat empty
|
||||
// while the frequency tracked perfectly: "the mode is not recognised".
|
||||
//
|
||||
// It is also the ADIF-correct direction. LSB and USB are SUBMODEs there, not
|
||||
// modes; MODE=LSB is not a valid ADIF value and is what would be sent to LoTW
|
||||
// and eQSL. So this protects the upload as much as the selector.
|
||||
//
|
||||
// A station that has deliberately put LSB or USB in its own mode list keeps
|
||||
// them: the list is the operator's statement of what they log.
|
||||
function catModeToLoggedMode(m: string): string {
|
||||
const list = modesRef.current;
|
||||
if (!m || list.includes(m)) return m;
|
||||
if ((m === 'LSB' || m === 'USB') && list.includes('SSB')) return 'SSB';
|
||||
return m;
|
||||
}
|
||||
function applyModePreset(m: string) {
|
||||
if (rstUserEditedRef.current) return;
|
||||
@@ -2213,8 +2235,9 @@ export default function App() {
|
||||
else if (s.mode) nextMode = s.mode;
|
||||
}
|
||||
if (nextMode) {
|
||||
setMode(nextMode);
|
||||
applyModePreset(nextMode); // flip 599↔59 on mode change (respects edits)
|
||||
const logged = catModeToLoggedMode(nextMode);
|
||||
setMode(logged);
|
||||
applyModePreset(logged); // flip 599↔59 on mode change (respects edits)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user