Compare commits

..
8 Commits
Author SHA1 Message Date
rouggy e6ca7a8bdd chore: release v0.20.11 2026-07-23 19:02:30 +02:00
rouggy 9be3f9147b chore: regenerate wails bindings (serial CW keyer config fields) 2026-07-23 19:02:24 +02:00
rouggy f7f801cdb7 fix: OmniRig spot-click didn't QSY Yaesu/Kenwood rigs (FT-891)
Confirmed from an FT-891 CAT log: OpsLog tuned via OmniRig's SetSimplexMode,
which returned OK on every spot click but never moved the VFO (readback stayed
put), while SetMode on the same .ini worked — so the CAT link was healthy and
only the frequency write was a no-op. SetSimplexMode was chosen because Icoms
accept direct FreqA writes but don't move; Yaesu/Kenwood are the opposite.

Now, for non-Icom rigs (or if SetSimplexMode errors), also write the VFO
frequency property (FreqA/Freq) directly, which does move them. Icom keeps the
SetSimplexMode-only path so the Main/Sub VFO isn't nudged by a direct write.
2026-07-23 18:59:44 +02:00
rouggy 43f15f1a2c feat: serial CW keyer — add invert (active-LOW) polarity option
Some CW interfaces key on the opposite line level (transmit at rest / key
backwards). New "Invert keying (active-LOW)" toggle flips the asserted level for
both the CW and PTT lines, and the idle state drives both lines to their
inactive level accordingly so an active-low rig isn't left keyed at rest.
Default off = N1MM convention (line HIGH = active).
2026-07-23 18:50:01 +02:00
rouggy 2c5416500f feat: serial-line CW keyer (DTR=CW / RTS=PTT) — SCU-17 / N1MM style
Adds a 4th CW keyer engine alongside K1EL WinKeyer, Icom CI-V and Flex CWX:
OpsLog bit-bangs the Morse itself on a serial control line (DTR keys CW, RTS
keys PTT — swappable), the hardware-keying method N1MM/WSJT use with a Yaesu
SCU-17 and generic interfaces. No WinKeyer chip needed.

- internal/winkeyer/serialcw.go: serialKeyer — worker goroutine, morse table,
  WPM + Farnsworth timing (live speed changes), abortable, PTT lead-in/tail/hang.
- winkeyer.Config gains Type ("k1el"|"serial") + CWKeyLine ("dtr"|"rts");
  Manager routes Connect/Send/Stop/SetSpeed/Backspace/Disconnect to it.
- app.go: keyWKCWLine setting; WinkeyerConnect sets Type from the engine.
- Settings -> CW Keyer: new "Serial port (DTR=CW/RTS=PTT)" engine with COM port,
  key-line selector, speed/Farnsworth/lead-in/tail/PTT. Macros, auto-CQ and
  <LOGQSO> reuse the WinKeyer path unchanged.

UNTESTED on hardware (no SCU-17 to hand): polarity assumes N1MM convention
(line HIGH = active). Weight not yet honoured; Farnsworth is.
2026-07-23 17:56:11 +02:00
rouggy fcdc5809e6 fix: IC-7300 spectrum scope never rendered — wrong frame framing
The rig's 0x27 waveform frames carry the same leading main-scope selector byte
as the dual-scope IC-7610/9700 (`27 00 00 <seq> <total> …`), but the code keyed
the layout off the CI-V address and treated the 7300 as selector-less, reading
the sequence from Data[1] (always 0x00) so every frame hit the `seq == 0`
guard and was dropped — blank scope. The waveform parser now detects the
leading selector byte from the frame itself (address-independent), and the
scope config/set commands (mode, span, edges) include the selector the 7300
requires. The IC-7610/9700 path is byte-for-byte unchanged (main → idx 2, sub
frames skipped). Confirmed against a real IC-7300 CI-V capture.
2026-07-23 15:20:56 +02:00
rouggy 7254950162 docs: move the scope display-off fix to changelog 0.20.11
0.20.10 was released before the "closing OpsLog switches off the radio's own
scope" fix landed, so its entry is reattributed to 0.20.11 (the fix code is
already committed in 1668455).
2026-07-23 14:48:45 +02:00
rouggy 1668455ff4 fix: closing OpsLog no longer switches off the Icom's own scope display
SetScope(false) sent both 0x27 0x10 00 (scope DISPLAY off) and 0x27 0x11 00
(CI-V data output off), so quitting OpsLog blanked a local IC-7300's own scope
screen. Only the display-on (0x27 0x10 01) is now sent, and only on enable;
disable stops the CI-V stream alone and never touches the radio's display.
2026-07-23 14:37:39 +02:00
11 changed files with 541 additions and 30 deletions
+17 -3
View File
@@ -214,9 +214,11 @@ const (
keyWKUsePTT = "winkeyer.use_ptt" keyWKUsePTT = "winkeyer.use_ptt"
keyWKSerialEcho = "winkeyer.serial_echo" keyWKSerialEcho = "winkeyer.serial_echo"
keyWKMacros = "winkeyer.macros" // JSON array of {label,text} keyWKMacros = "winkeyer.macros" // JSON array of {label,text}
keyWKEngine = "winkeyer.engine" // "winkeyer" | "icom" | "tci" keyWKEngine = "winkeyer.engine" // "winkeyer" | "serial" | "icom" | "flex" | "tci"
keyWKEscClears = "winkeyer.esc_clears_call" // ESC also clears the callsign keyWKEscClears = "winkeyer.esc_clears_call" // ESC also clears the callsign
keyWKSendOnType = "winkeyer.send_on_type" // key characters live as typed keyWKSendOnType = "winkeyer.send_on_type" // key characters live as typed
keyWKCWLine = "winkeyer.cw_key_line" // serial engine: "dtr" (CW) / "rts" (PTT) or swapped
keyWKCWInvert = "winkeyer.cw_invert" // serial engine: invert line polarity (active-LOW)
keyClusterAutoConnect = "cluster.auto_connect" // open every enabled server at app start keyClusterAutoConnect = "cluster.auto_connect" // open every enabled server at app start
@@ -13052,13 +13054,17 @@ func (a *App) GetWinkeyerSettings() (WinkeyerSettings, error) {
keyWKEnabled, keyWKPort, keyWKBaud, keyWKWPM, keyWKWeight, keyWKLeadIn, keyWKEnabled, keyWKPort, keyWKBaud, keyWKWPM, keyWKWeight, keyWKLeadIn,
keyWKTail, keyWKRatio, keyWKFarnsworth, keyWKSidetone, keyWKMode, keyWKTail, keyWKRatio, keyWKFarnsworth, keyWKSidetone, keyWKMode,
keyWKSwap, keyWKAutoSpace, keyWKUsePTT, keyWKSerialEcho, keyWKMacros, keyWKSwap, keyWKAutoSpace, keyWKUsePTT, keyWKSerialEcho, keyWKMacros,
keyWKEngine, keyWKEscClears, keyWKSendOnType) keyWKEngine, keyWKEscClears, keyWKSendOnType, keyWKCWLine, keyWKCWInvert)
if err != nil { if err != nil {
return out, err return out, err
} }
if v := m[keyWKEngine]; v != "" { if v := m[keyWKEngine]; v != "" {
out.Engine = v out.Engine = v
} }
if v := m[keyWKCWLine]; v != "" {
out.CWKeyLine = v
}
out.CWInvert = m[keyWKCWInvert] == "1"
if v := m[keyWKEscClears]; v != "" { if v := m[keyWKEscClears]; v != "" {
out.EscClearsCall = v == "1" out.EscClearsCall = v == "1"
} }
@@ -13125,6 +13131,8 @@ func (a *App) SaveWinkeyerSettings(s WinkeyerSettings) error {
keyWKEngine: strings.TrimSpace(s.Engine), keyWKEngine: strings.TrimSpace(s.Engine),
keyWKEscClears: boolStr(s.EscClearsCall), keyWKEscClears: boolStr(s.EscClearsCall),
keyWKSendOnType: boolStr(s.SendOnType), keyWKSendOnType: boolStr(s.SendOnType),
keyWKCWLine: strings.TrimSpace(s.CWKeyLine),
keyWKCWInvert: boolStr(s.CWInvert),
} { } {
if err := a.settings.Set(a.ctx, k, v); err != nil { if err := a.settings.Set(a.ctx, k, v); err != nil {
return err return err
@@ -13142,7 +13150,13 @@ func (a *App) WinkeyerConnect() error {
if err != nil { if err != nil {
return err return err
} }
return a.winkeyer.Connect(s.Config) cfg := s.Config
// The "serial" engine keys CW on the port's DTR/RTS lines (SCU-17 style)
// instead of talking the K1EL WinKeyer protocol — flag it for the manager.
if s.Engine == "serial" {
cfg.Type = "serial"
}
return a.winkeyer.Connect(cfg)
} }
// WinkeyerDisconnect closes the serial link. // WinkeyerDisconnect closes the serial link.
+18
View File
@@ -1,4 +1,22 @@
[ [
{
"version": "0.20.11",
"date": "2026-07-23",
"en": [
"Fixed clicking a spot / band-map entry not moving the radio on Yaesu (and other non-Icom) rigs controlled through OmniRig — e.g. the FT-891. OpsLog tuned via OmniRig's SetSimplexMode, which on these rigs returns success but silently doesn't move the VFO (mode changes worked, so it looked like a puzzle). It now also writes the VFO frequency property directly, which does move them. Icom rigs are unchanged (there SetSimplexMode is the reliable path).",
"New CW keyer engine: 'Serial port (DTR=CW / RTS=PTT)'. OpsLog can now key CW by toggling a serial control line itself — the hardware-keying method N1MM/WSJT use with a Yaesu SCU-17 and generic keying interfaces — without a K1EL WinKeyer. Settings → CW Keyer → Keyer engine: pick 'Serial port', choose the keying COM port and whether CW is on DTR (PTT on RTS) or swapped. Speed, Farnsworth, lead-in/tail and PTT keying all apply; macros, auto-CQ and <LOGQSO> work exactly as with the WinKeyer. An 'Invert keying (active-LOW)' option is there for interfaces that key backwards / transmit at rest.",
"Fixed the spectrum scope never displaying on the IC-7300: its CI-V waveform frames actually carry the same leading main-scope selector byte as the dual-scope IC-7610/9700, but OpsLog assumed the 7300 omitted it — so it read the frame sequence number from the wrong byte (always 0), discarded every frame, and drew nothing. The frame layout is now detected from the data itself, so the 7300 (and other single-scope Icoms) render correctly, in both center and fixed modes. The IC-7610/9700 are unaffected.",
"IC-7300 scope: the center/fixed mode and edge-frequency commands now include the selector byte the rig requires, so switching the scope between center-on-VFO and fixed span from OpsLog is accepted instead of being rejected.",
"Closing OpsLog no longer switches off the scope display on the radio itself: turning the scope off used to send both 'stop CI-V data' and 'display off', so quitting blanked a local IC-7300's own scope screen. It now only stops the CI-V data stream on disable and never touches the radio's display (the display-on command is sent solely when enabling)."
],
"fr": [
"Correction : cliquer un spot / une entrée de band-map ne changeait pas la fréquence sur les Yaesu (et autres radios non-Icom) pilotées via OmniRig — p. ex. le FT-891. OpsLog accordait via SetSimplexMode d'OmniRig, qui sur ces radios renvoie « OK » mais ne bouge pas le VFO (le changement de mode marchait, d'où l'énigme). Il écrit maintenant aussi directement la propriété fréquence du VFO, ce qui les fait bien QSY. Les Icom sont inchangés (là, SetSimplexMode reste la bonne méthode).",
"Nouveau moteur de keyer CW : « Port série (DTR=CW / RTS=PTT) ». OpsLog peut désormais manipuler la CW en basculant lui-même une ligne de contrôle série — la méthode de keying matériel qu'utilisent N1MM/WSJT avec un Yaesu SCU-17 et les interfaces génériques — sans WinKeyer K1EL. Réglages → Keyer CW → Moteur : choisis « Port série », le port COM de keying et si la CW est sur DTR (PTT sur RTS) ou l'inverse. Vitesse, Farnsworth, lead-in/tail et PTT s'appliquent ; les macros, l'auto-CQ et <LOGQSO> fonctionnent exactement comme avec le WinKeyer. Une option « Inverser le keying (actif-BAS) » est prévue pour les interfaces qui manipulent à l'envers / émettent au repos.",
"Correction du scope spectral qui ne s'affichait jamais sur l'IC-7300 : ses trames de forme d'onde CI-V portent en réalité le même octet sélecteur de scope en tête que les IC-7610/9700 (dual-scope), mais OpsLog supposait que le 7300 ne l'envoyait pas — il lisait donc le numéro de séquence de la trame sur le mauvais octet (toujours 0), jetait toutes les trames et ne dessinait rien. La disposition des trames est maintenant détectée à partir des données elles-mêmes, donc le 7300 (et les autres Icom mono-scope) s'affichent correctement, en mode centre comme en fixe. Les IC-7610/9700 ne sont pas affectés.",
"Scope IC-7300 : les commandes de mode centre/fixe et de fréquences de bords incluent maintenant l'octet sélecteur requis par la radio, donc basculer le scope entre centre-sur-VFO et span fixe depuis OpsLog est accepté au lieu d'être rejeté.",
"Fermer OpsLog n'éteint plus le scope sur la radio elle-même : couper le scope envoyait à la fois « stop données CI-V » et « affichage OFF », donc quitter éteignait l'écran scope d'un IC-7300 local. Désormais seule la diffusion des données CI-V est coupée à la désactivation, l'affichage de la radio n'est jamais touché (la commande d'allumage n'est envoyée qu'à l'activation)."
]
},
{ {
"version": "0.20.10", "version": "0.20.10",
"date": "2026-07-23", "date": "2026-07-23",
+1 -1
View File
@@ -2130,7 +2130,7 @@ export default function App() {
setWkMacros((s.macros ?? []) as WKMacro[]); setWkMacros((s.macros ?? []) as WKMacro[]);
setWkEscClears(s.esc_clears_call !== false); setWkEscClears(s.esc_clears_call !== false);
setWkSendOnType(!!s.send_on_type); setWkSendOnType(!!s.send_on_type);
setWkEngine(s.engine === 'icom' ? 'icom' : s.engine === 'flex' ? 'flex' : 'winkeyer'); setWkEngine(s.engine === 'icom' ? 'icom' : s.engine === 'flex' ? 'flex' : s.engine === 'serial' ? 'serial' : 'winkeyer');
} catch { /* keyer not configured */ } } catch { /* keyer not configured */ }
}, []); }, []);
+63 -3
View File
@@ -1074,13 +1074,13 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
port: string; baud: number; wpm: number; weight: number; port: string; baud: number; wpm: number; weight: number;
lead_in_ms: number; tail_ms: number; ratio: number; farnsworth: number; lead_in_ms: number; tail_ms: number; ratio: number; farnsworth: number;
sidetone_hz: number; mode: string; swap: boolean; autospace: boolean; sidetone_hz: number; mode: string; swap: boolean; autospace: boolean;
use_ptt: boolean; serial_echo: boolean; macros: WKMac[]; use_ptt: boolean; serial_echo: boolean; cw_key_line: string; cw_invert: boolean; macros: WKMac[];
}; };
const [wk, setWk] = useState<WKSettings>({ const [wk, setWk] = useState<WKSettings>({
enabled: false, engine: 'winkeyer', esc_clears_call: true, enabled: false, engine: 'winkeyer', esc_clears_call: true,
port: '', baud: 1200, wpm: 25, weight: 50, lead_in_ms: 10, port: '', baud: 1200, wpm: 25, weight: 50, lead_in_ms: 10,
tail_ms: 50, ratio: 50, farnsworth: 0, sidetone_hz: 600, mode: 'iambic_b', tail_ms: 50, ratio: 50, farnsworth: 0, sidetone_hz: 600, mode: 'iambic_b',
swap: false, autospace: true, use_ptt: false, serial_echo: true, macros: [], swap: false, autospace: true, use_ptt: false, serial_echo: true, cw_key_line: 'dtr', cw_invert: false, macros: [],
}); });
const [wkPorts, setWkPorts] = useState<string[]>([]); const [wkPorts, setWkPorts] = useState<string[]>([]);
const setWkField = (patch: Partial<WKSettings>) => setWk((s) => ({ ...s, ...patch })); const setWkField = (patch: Partial<WKSettings>) => setWk((s) => ({ ...s, ...patch }));
@@ -3023,7 +3023,8 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
<Select value={wk.engine} onValueChange={(v) => setWkField({ engine: v })}> <Select value={wk.engine} onValueChange={(v) => setWkField({ engine: v })}>
<SelectTrigger className="h-8"><SelectValue /></SelectTrigger> <SelectTrigger className="h-8"><SelectValue /></SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value="winkeyer">WinKeyer (serial)</SelectItem> <SelectItem value="winkeyer">WinKeyer (K1EL, serial)</SelectItem>
<SelectItem value="serial">Serial port (DTR=CW / RTS=PTT)</SelectItem>
<SelectItem value="icom">Icom CI-V (rig keyer)</SelectItem> <SelectItem value="icom">Icom CI-V (rig keyer)</SelectItem>
<SelectItem value="flex">FlexRadio (CWX)</SelectItem> <SelectItem value="flex">FlexRadio (CWX)</SelectItem>
<SelectItem value="tci" disabled>TCI (coming soon)</SelectItem> <SelectItem value="tci" disabled>TCI (coming soon)</SelectItem>
@@ -3076,6 +3077,65 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
</div> </div>
</div> </div>
</> </>
) : wk.engine === 'serial' ? (
<>
<p className="text-xs text-muted-foreground -mt-2">
OpsLog keys the Morse itself by toggling a serial control line — the "hardware CW keying" a Yaesu <strong>SCU-17</strong> and generic interfaces use (like N1MM: DTR = CW, RTS = PTT). No WinKeyer chip. Put the rig in CW mode and pick the interface's <strong>keying COM port</strong> below (this is the CW/PTT port, <em>not</em> the CAT port). Speed, Farnsworth, lead-in/tail and PTT apply; paddle mode, ratio and sidetone are WinKeyer-only.
</p>
<div className="grid grid-cols-4 gap-3">
<div className="space-y-1 col-span-2">
<Label>Keying COM port</Label>
<div className="flex items-center gap-2">
<Select value={wk.port || '_'} onValueChange={(v) => setWkField({ port: v === '_' ? '' : v })}>
<SelectTrigger className="h-8 flex-1"><SelectValue placeholder="— COM port —" /></SelectTrigger>
<SelectContent>
{wkPorts.length === 0 && <SelectItem value="_" disabled>No ports found</SelectItem>}
{wkPorts.map((p) => <SelectItem key={p} value={p}>{p}</SelectItem>)}
</SelectContent>
</Select>
<Button variant="ghost" size="sm" className="h-8 px-2" title="Reload ports"
onClick={() => ListSerialPorts().then((p) => setWkPorts((p ?? []) as string[])).catch(() => {})}>
<ArrowDown className="size-3.5 rotate-90" />
</Button>
</div>
</div>
<div className="space-y-1">
<Label>CW key line</Label>
<Select value={wk.cw_key_line === 'rts' ? 'rts' : 'dtr'} onValueChange={(v) => setWkField({ cw_key_line: v })}>
<SelectTrigger className="h-8"><SelectValue /></SelectTrigger>
<SelectContent>
<SelectItem value="dtr">DTR = CW, RTS = PTT</SelectItem>
<SelectItem value="rts">RTS = CW, DTR = PTT</SelectItem>
</SelectContent>
</Select>
</div>
<div className="space-y-1">
<Label>Speed (WPM)</Label>
<Input type="number" min={5} max={99} value={wk.wpm} onChange={(e) => setWkField({ wpm: num(e.target.value, 25) })} className="font-mono" />
</div>
</div>
<div className="grid grid-cols-4 gap-3">
<div className="space-y-1">
<Label>Farnsworth</Label>
<Input type="number" min={0} max={99} value={wk.farnsworth} onChange={(e) => setWkField({ farnsworth: num(e.target.value, 0) })} className="font-mono" />
</div>
<div className="space-y-1">
<Label>Lead-in (ms)</Label>
<Input type="number" min={0} value={wk.lead_in_ms} onChange={(e) => setWkField({ lead_in_ms: num(e.target.value, 10) })} className="font-mono" />
</div>
<div className="space-y-1">
<Label>Tail (ms)</Label>
<Input type="number" min={0} value={wk.tail_ms} onChange={(e) => setWkField({ tail_ms: num(e.target.value, 50) })} className="font-mono" />
</div>
<label className="flex items-center gap-2 text-sm cursor-pointer pb-1.5 self-end">
<Checkbox checked={wk.use_ptt} onCheckedChange={(c) => setWkField({ use_ptt: !!c })} /> Key PTT line
</label>
</div>
<label className="flex items-center gap-2 text-sm cursor-pointer">
<Checkbox checked={wk.cw_invert} onCheckedChange={(c) => setWkField({ cw_invert: !!c })} />
Invert keying (active-LOW) tick this only if the rig transmits at rest / keys backwards
</label>
</>
) : ( ) : (
<> <>
<div className="grid grid-cols-4 gap-3"> <div className="grid grid-cols-4 gap-3">
+1 -1
View File
@@ -1,6 +1,6 @@
// Single source of truth for the app version shown in the UI (header + About). // Single source of truth for the app version shown in the UI (header + About).
// Bump this on a release (the release script updates it alongside telemetry.go). // Bump this on a release (the release script updates it alongside telemetry.go).
export const APP_VERSION = '0.20.10'; export const APP_VERSION = '0.20.11';
// Author / credits, shown in Help -> About. // Author / credits, shown in Help -> About.
export const APP_AUTHOR = 'F4BPO'; export const APP_AUTHOR = 'F4BPO';
+6
View File
@@ -3035,6 +3035,9 @@ export namespace main {
autospace: boolean; autospace: boolean;
use_ptt: boolean; use_ptt: boolean;
serial_echo: boolean; serial_echo: boolean;
type: string;
cw_key_line: string;
cw_invert: boolean;
engine: string; engine: string;
esc_clears_call: boolean; esc_clears_call: boolean;
send_on_type: boolean; send_on_type: boolean;
@@ -3061,6 +3064,9 @@ export namespace main {
this.autospace = source["autospace"]; this.autospace = source["autospace"];
this.use_ptt = source["use_ptt"]; this.use_ptt = source["use_ptt"];
this.serial_echo = source["serial_echo"]; this.serial_echo = source["serial_echo"];
this.type = source["type"];
this.cw_key_line = source["cw_key_line"];
this.cw_invert = source["cw_invert"];
this.engine = source["engine"]; this.engine = source["engine"];
this.esc_clears_call = source["esc_clears_call"]; this.esc_clears_call = source["esc_clears_call"];
this.send_on_type = source["send_on_type"]; this.send_on_type = source["send_on_type"];
+33 -15
View File
@@ -224,11 +224,14 @@ func (b *IcomSerial) Connect() error {
idAddr = f.Data[1] idAddr = f.Data[1]
} }
} }
// Dual-scope rigs (IC-7610/9700) prefix each waveform frame with a main/sub // Whether the rig's scope protocol carries a leading main/sub SELECTOR byte on
// selector byte; single-scope rigs (IC-7300…) do not. Decide from the // every 0x27 frame and command. The IC-7610/9700 (dual scope) do — and the logs
// IDENTIFIED model, NOT the configured address: an IC-7300 run at 0x98 must // prove the IC-7300 does too (frames arrive as `27 00 00 <seq> <total> …` and a
// still parse single-scope frames (this was the "scope blank on the 7300" bug). // mode read answers `27 14 00 <mode>`), even though it has a single scope. The
b.dualScope = idAddr == 0x98 || idAddr == 0xA2 // waveform parser auto-detects this per-frame regardless, so a 7300 at a
// non-default address still RENDERS; this flag only drives the SET/read commands
// (mode, span, edges), which need the 0x00 selector to be accepted on the 7300.
b.dualScope = idAddr == 0x98 || idAddr == 0xA2 || idAddr == 0x94
// Defer the DSP snapshot until the rig actually answers CI-V. Over the network // Defer the DSP snapshot until the rig actually answers CI-V. Over the network
// the rig may still be booting (or off) at Connect, so an immediate readDSP // the rig may still be booting (or off) at Connect, so an immediate readDSP
// would time out and leave every control at 0 / off with no retry. ReadState // would time out and leave every control at 0 / off with no retry. ReadState
@@ -603,12 +606,20 @@ func (b *IcomSerial) scopeLoop(spec chan civ.Decoded, done chan struct{}) {
rawN++ rawN++
applog.Printf("icom scope raw #%d: len=%d data=[% X]", rawN, len(f.Data), f.Data) applog.Printf("icom scope raw #%d: len=%d data=[% X]", rawN, len(f.Data), f.Data)
} }
// Frame layout after the 0x00 sub-command byte is one of:
// [selector][seq][total][data…] (IC-7610/9700 AND, as the logs prove,
// the IC-7300 — selector 0x00 = main)
// [seq][total][data…] (a rig with no selector byte)
// The sequence starts at 1, so a 0x00 at Data[1] can only be the main-scope
// selector — never a valid sequence. Keying this off the rig ADDRESS was the
// long-standing "blank scope on the IC-7300" bug: the 7300 DOES send the
// selector, so idx stayed 1, seq was read as 0x00, and every frame was
// dropped. Detect it from the byte itself instead — address-independent.
idx := 1 idx := 1
if b.dualScope { if len(f.Data) >= 2 && f.Data[1] == 0x00 {
if len(f.Data) < 2 || f.Data[1] != 0x00 { idx = 2 // leading main-scope selector byte present
continue // only the MAIN scope } else if b.dualScope {
} continue // dual-scope rig SUB frame (selector != 0x00) — main only
idx = 2
} }
if len(f.Data) < idx+2 { if len(f.Data) < idx+2 {
continue continue
@@ -725,12 +736,19 @@ func (b *IcomSerial) SetScope(on bool) error {
// but nothing shows, compare its `icom scope raw` frames against this. // but nothing shows, compare its `icom scope raw` frames against this.
applog.Printf("icom scope: enable on rig=%q addr=0x%02X dualScope=%v (expect %s frame layout)", applog.Printf("icom scope: enable on rig=%q addr=0x%02X dualScope=%v (expect %s frame layout)",
b.model, b.rigAddr, b.dualScope, map[bool]string{true: "27 00 [MS] [seq] [total] …", false: "27 00 [seq] [total] …"}[b.dualScope]) b.model, b.rigAddr, b.dualScope, map[bool]string{true: "27 00 [MS] [seq] [total] …", false: "27 00 [seq] [total] …"}[b.dualScope])
// Turn the scope DISPLAY on — needed so the rig actually streams (esp. when
// remote and we can't touch the front panel). ONLY on enable: we must never
// switch the display OFF, because that is the operator's own scope on the
// radio, and closing OpsLog (SetScope(false)) blanking a local IC-7300's
// screen is exactly the regression this avoids. Some firmwares don't ack a
// 0x27 set; a timeout isn't fatal, so log and continue.
if err := b.exec(civ.CmdScope, civ.SubScopeOnOff, 0x01); err != nil {
applog.Printf("icom scope: display on ack: %v", err)
}
} }
// Some firmwares don't ack 0x27 sets; a timeout here isn't fatal, so log and // Waveform data OUTPUT over CI-V: enabled with the scope, and — crucially —
// continue rather than abort the second command. // the ONLY thing we switch off on disable, so the radio's own scope display is
if err := b.exec(civ.CmdScope, civ.SubScopeOnOff, boolByte(on)); err != nil { // left exactly as the operator had it.
applog.Printf("icom scope: display on=%v ack: %v", on, err)
}
if err := b.exec(civ.CmdScope, civ.SubScopeOn, boolByte(on)); err != nil { if err := b.exec(civ.CmdScope, civ.SubScopeOn, boolByte(on)); err != nil {
applog.Printf("icom scope: output on=%v ack: %v", on, err) applog.Printf("icom scope: output on=%v ack: %v", on, err)
} }
+15 -4
View File
@@ -267,12 +267,23 @@ func (o *OmniRig) SetFrequency(hz int64) error {
// method (RX=TX=freq, simplex). It works on rigs — notably Icom (IC-9100) — // method (RX=TX=freq, simplex). It works on rigs — notably Icom (IC-9100) —
// where direct FreqA/FreqB writes are accepted but never move the radio. // where direct FreqA/FreqB writes are accepted but never move the radio.
// Clearing split is the right thing when tuning to a spot anyway. // Clearing split is the right thing when tuning to a spot anyway.
simplexOK := false
if _, err := oleutil.CallMethod(o.rig, "SetSimplexMode", int32(hz32)); err == nil { if _, err := oleutil.CallMethod(o.rig, "SetSimplexMode", int32(hz32)); err == nil {
simplexOK = true
debugLog.Printf("OmniRig.SetFrequency: SetSimplexMode(%d) OK", hz32) debugLog.Printf("OmniRig.SetFrequency: SetSimplexMode(%d) OK", hz32)
} else { } else {
debugLog.Printf("OmniRig.SetFrequency: SetSimplexMode unavailable (%v) — using property writes", err) debugLog.Printf("OmniRig.SetFrequency: SetSimplexMode unavailable (%v)", err)
// Fallback: write the active VFO's property AND the generic Freq }
// (always — some .ini honour only one, and split here is often misread).
// On Yaesu / Kenwood (and anything non-Icom), SetSimplexMode frequently returns
// OK but is a SILENT NO-OP — the rig never moves. Confirmed on an FT-891 over
// OmniRig: every spot click logged "SetSimplexMode OK" yet FreqA stayed put,
// while SetMode on the same .ini worked fine (so the CAT link is healthy).
// Writing the VFO frequency PROPERTY directly DOES move them, so also do that
// here. It is skipped on Icom, where the direct write is the unreliable one and
// could nudge the wrong Main/Sub VFO — there SetSimplexMode is authoritative.
isIcom := strings.HasPrefix(strings.ToUpper(strings.TrimSpace(rigType)), "IC")
if !isIcom || !simplexOK {
prop := "FreqA" prop := "FreqA"
switch vfo { switch vfo {
case "B", "BB", "BA": case "B", "BB", "BA":
@@ -287,7 +298,7 @@ func (o *OmniRig) SetFrequency(hz int64) error {
okAny = true okAny = true
} }
} }
if !okAny { if !simplexOK && !okAny {
return fmt.Errorf("OmniRig: no writable frequency property for this rig") return fmt.Errorf("OmniRig: no writable frequency property for this rig")
} }
} }
+288
View File
@@ -0,0 +1,288 @@
package winkeyer
// serialcw.go — CW keying by toggling a serial control line, the "hardware CW
// keying" method N1MM / WSJT / fldigi use with a Yaesu SCU-17 and similar
// interfaces (DTR = CW key, RTS = PTT). No K1EL WinKeyer chip involved: the PC
// bit-bangs the Morse itself on the DTR (or RTS) line at the configured WPM.
//
// A single worker goroutine consumes queued text and keys it element by element,
// so Send returns immediately (like the WinKeyer's buffered send) and Stop can
// abort mid-message. Speed changes apply live between characters. PTT (when
// enabled) is asserted on the OTHER line for the whole transmission plus a
// lead-in / tail, and held through a short hang so send-on-type doesn't chatter.
import (
"strings"
"sync"
"time"
"go.bug.st/serial"
)
// morseTable maps a keyable character to its Morse element string (. = dit,
// - = dah). Mirrors winkeyer.allowedCW.
var morseTable = map[rune]string{
'A': ".-", 'B': "-...", 'C': "-.-.", 'D': "-..", 'E': ".", 'F': "..-.",
'G': "--.", 'H': "....", 'I': "..", 'J': ".---", 'K': "-.-", 'L': ".-..",
'M': "--", 'N': "-.", 'O': "---", 'P': ".--.", 'Q': "--.-", 'R': ".-.",
'S': "...", 'T': "-", 'U': "..-", 'V': "...-", 'W': ".--", 'X': "-..-",
'Y': "-.--", 'Z': "--..",
'0': "-----", '1': ".----", '2': "..---", '3': "...--", '4': "....-",
'5': ".....", '6': "-....", '7': "--...", '8': "---..", '9': "----.",
'.': ".-.-.-", ',': "--..--", '?': "..--..", '/': "-..-.", '=': "-...-",
'+': ".-.-.", '-': "-....-", ':': "---...", '(': "-.--.", ')': "-.--.-",
';': "-.-.-.", '"': ".-..-.", '\'': ".----.", '@': ".--.-.",
}
// serialKeyer bit-bangs CW on a serial control line. Owned by a winkeyer.Manager
// while Type == "serial"; all keying happens in run().
type serialKeyer struct {
port serial.Port
keyDTR bool // true: CW on DTR, PTT on RTS (N1MM default). false: swapped.
invert bool // true: active-LOW — asserting a line means driving it LOW
usePTT bool
leadMs int
tailMs int
onBusy func(bool)
mu sync.Mutex
wpm int
farns int
abort chan struct{} // recreated by Stop; keying aborts when it closes
in chan string
stop chan struct{}
done chan struct{}
}
func newSerialKeyer(port serial.Port, cfg Config, onBusy func(bool)) *serialKeyer {
k := &serialKeyer{
port: port,
keyDTR: !strings.EqualFold(strings.TrimSpace(cfg.CWKeyLine), "rts"), // default DTR=CW
invert: cfg.CWInvert,
usePTT: cfg.UsePTT,
leadMs: cfg.LeadInMs,
tailMs: cfg.TailMs,
onBusy: onBusy,
wpm: cfg.WPM,
farns: cfg.Farnsworth,
abort: make(chan struct{}),
in: make(chan string, 256),
stop: make(chan struct{}),
done: make(chan struct{}),
}
k.idle() // start inactive: key up, PTT off
go k.run()
return k
}
// level maps a logical "active" state to the physical line level, honouring the
// invert (active-LOW) option: normally active = HIGH, inverted active = LOW.
func (k *serialKeyer) level(active bool) bool { return active != k.invert }
// setKey raises/lowers the CW key line; setPTT the PTT line (only when enabled).
func (k *serialKeyer) setKey(down bool) {
if k.keyDTR {
_ = k.port.SetDTR(k.level(down))
} else {
_ = k.port.SetRTS(k.level(down))
}
}
func (k *serialKeyer) setPTT(on bool) {
if !k.usePTT {
return
}
if k.keyDTR {
_ = k.port.SetRTS(k.level(on))
} else {
_ = k.port.SetDTR(k.level(on))
}
}
// idle drives BOTH lines to their inactive level (key up, PTT off), respecting
// the invert option — so an active-LOW interface isn't left keyed at rest.
func (k *serialKeyer) idle() {
_ = k.port.SetDTR(k.level(false))
_ = k.port.SetRTS(k.level(false))
}
// SetSpeed / Send / Stop mirror the WinKeyer manager's control surface.
func (k *serialKeyer) SetSpeed(wpm int) {
k.mu.Lock()
k.wpm = wpm
k.mu.Unlock()
}
func (k *serialKeyer) Send(text string) {
select {
case k.in <- text:
default: // queue full (pathological) — drop rather than block the app binding
}
}
// Stop aborts the character being keyed and flushes anything queued.
func (k *serialKeyer) Stop() {
k.mu.Lock()
close(k.abort)
k.abort = make(chan struct{})
k.mu.Unlock()
for drained := false; !drained; {
select {
case <-k.in:
default:
drained = true
}
}
k.setKey(false)
}
func (k *serialKeyer) Close() {
close(k.stop)
<-k.done
}
func (k *serialKeyer) run() {
defer close(k.done)
defer k.idle()
for {
select {
case <-k.stop:
return
case s := <-k.in:
k.onBusy(true)
k.setPTT(true)
k.sleep(time.Duration(k.leadMs) * time.Millisecond)
k.keyText(s)
hang := time.Duration(k.tailMs) * time.Millisecond
if hang <= 0 {
hang = 5 * time.Millisecond
}
hold: // hold PTT briefly so back-to-back sends (send-on-type) don't chatter
for {
select {
case <-k.stop:
k.idle()
k.onBusy(false)
return
case s2 := <-k.in:
k.keyText(s2)
case <-time.After(hang):
break hold
}
}
k.setPTT(false)
k.onBusy(false)
}
}
}
// keyText keys one string. Element gaps use the character speed (WPM); the
// inter-character (3-unit) and inter-word (7-unit) gaps use the Farnsworth speed
// when one is set, so slow-copy CW keeps full-speed characters with wider spacing.
func (k *serialKeyer) keyText(s string) {
k.mu.Lock()
abort := k.abort
k.mu.Unlock()
for _, r := range strings.ToUpper(s) {
select {
case <-abort:
k.setKey(false)
return
case <-k.stop:
k.setKey(false)
return
default:
}
ditW, ditF := k.dits()
if r == ' ' {
// Word gap: 7 units total. A 3-unit inter-char gap was already emitted
// after the previous character, so add 4 more.
if !k.gap(4*ditF, abort) {
return
}
continue
}
code, ok := morseTable[r]
if !ok {
continue
}
for j, el := range code {
if el == '.' {
if !k.mark(ditW, abort) {
return
}
} else {
if !k.mark(3*ditW, abort) {
return
}
}
if j < len(code)-1 { // intra-character (element) gap: 1 unit
if !k.gap(ditW, abort) {
return
}
}
}
if !k.gap(3*ditF, abort) { // inter-character gap: 3 units
return
}
}
}
// mark holds the key down for d; gap holds it up for d. Both abort cleanly
// (leaving the key UP) when Stop closes abort or the keyer shuts down.
func (k *serialKeyer) mark(d time.Duration, abort chan struct{}) bool {
k.setKey(true)
ok := k.wait(d, abort)
k.setKey(false)
return ok
}
func (k *serialKeyer) gap(d time.Duration, abort chan struct{}) bool { return k.wait(d, abort) }
func (k *serialKeyer) wait(d time.Duration, abort chan struct{}) bool {
if d <= 0 {
return true
}
t := time.NewTimer(d)
defer t.Stop()
select {
case <-t.C:
return true
case <-abort:
return false
case <-k.stop:
return false
}
}
// sleep is a non-abortable pause (used for the short PTT lead-in).
func (k *serialKeyer) sleep(d time.Duration) {
if d <= 0 {
return
}
t := time.NewTimer(d)
defer t.Stop()
select {
case <-t.C:
case <-k.stop:
}
}
// dits returns the element (character-speed) dit and the spacing (Farnsworth)
// dit as durations, read live so a speed change mid-message takes effect.
func (k *serialKeyer) dits() (elem, space time.Duration) {
k.mu.Lock()
w, f := k.wpm, k.farns
k.mu.Unlock()
if w < 5 {
w = 5
}
if w > 99 {
w = 99
}
elem = time.Duration(float64(time.Millisecond) * 1200.0 / float64(w))
space = elem
if f > 0 && f < w {
space = time.Duration(float64(time.Millisecond) * 1200.0 / float64(f))
}
return elem, space
}
+98 -2
View File
@@ -49,6 +49,16 @@ type Config struct {
AutoSpace bool `json:"autospace"` // auto letter-space AutoSpace bool `json:"autospace"` // auto letter-space
UsePTT bool `json:"use_ptt"` // key PTT (Key/PTT output) UsePTT bool `json:"use_ptt"` // key PTT (Key/PTT output)
SerialEcho bool `json:"serial_echo"` // device echoes sent chars back to host SerialEcho bool `json:"serial_echo"` // device echoes sent chars back to host
// Type selects the keyer engine on this serial port:
// "" / "k1el" → a K1EL WinKeyer chip (the default, everything above applies)
// "serial" → the PC bit-bangs Morse on a control line (no WinKeyer chip):
// the "hardware CW keying" a Yaesu SCU-17 / generic interface
// uses. WPM / Weight / Farnsworth / LeadIn / Tail / UsePTT still
// apply; the paddle/sidetone/ratio fields are WinKeyer-only.
Type string `json:"type"`
CWKeyLine string `json:"cw_key_line"` // serial: "dtr" (CW on DTR, PTT on RTS — default) | "rts"
CWInvert bool `json:"cw_invert"` // serial: invert line polarity (active-LOW) for both key and PTT
} }
func (c Config) normalised() Config { func (c Config) normalised() Config {
@@ -93,6 +103,7 @@ type Manager struct {
status Status status Status
stopRead chan struct{} stopRead chan struct{}
doneRead chan struct{} doneRead chan struct{}
serial *serialKeyer // non-nil when cfg.Type == "serial" (DTR/RTS line keying)
onStatus func(Status) onStatus func(Status)
onEcho func(string) // chars the device echoes back as it keys them onEcho func(string) // chars the device echoes back as it keys them
@@ -130,6 +141,9 @@ func (m *Manager) Connect(cfg Config) error {
if strings.TrimSpace(cfg.Port) == "" { if strings.TrimSpace(cfg.Port) == "" {
return fmt.Errorf("winkeyer: no serial port selected") return fmt.Errorf("winkeyer: no serial port selected")
} }
if cfg.Type == "serial" {
return m.connectSerial(cfg)
}
m.Disconnect() // drop any existing link first m.Disconnect() // drop any existing link first
p, err := serial.Open(cfg.Port, &serial.Mode{ p, err := serial.Open(cfg.Port, &serial.Mode{
@@ -175,6 +189,47 @@ func (m *Manager) Connect(cfg Config) error {
return nil return nil
} }
// connectSerial opens the port for line-keying (DTR=CW / RTS=PTT) — no K1EL
// handshake, no read loop. The PC bit-bangs the Morse itself (see serialcw.go).
func (m *Manager) connectSerial(cfg Config) error {
m.Disconnect() // drop any existing link first
p, err := serial.Open(cfg.Port, &serial.Mode{
BaudRate: cfg.Baud,
DataBits: 8,
Parity: serial.NoParity,
StopBits: serial.OneStopBit,
})
if err != nil {
return fmt.Errorf("winkeyer: open %s: %w", cfg.Port, err)
}
// The keyer updates busy state as it keys; mirror it into status + notify.
sk := newSerialKeyer(p, cfg, func(busy bool) {
m.mu.Lock()
changed := m.status.Busy != busy
m.status.Busy = busy
m.mu.Unlock()
if changed {
m.emit()
}
})
m.mu.Lock()
m.port = p
m.serial = sk
m.cfg = cfg
m.status = Status{Connected: true, WPM: cfg.WPM, Port: cfg.Port}
m.mu.Unlock()
line := "DTR (CW) / RTS (PTT)"
if strings.EqualFold(cfg.CWKeyLine, "rts") {
line = "RTS (CW) / DTR (PTT)"
}
applog.Printf("winkeyer: serial CW keyer on %s — %s, PTT=%v", cfg.Port, line, cfg.UsePTT)
m.emit()
return nil
}
// applyConfig pushes the keying parameters to the device. // applyConfig pushes the keying parameters to the device.
func (m *Manager) applyConfig(c Config) error { func (m *Manager) applyConfig(c Config) error {
cmds := [][]byte{ cmds := [][]byte{
@@ -256,7 +311,12 @@ func (m *Manager) SetSpeed(wpm int) error {
if wpm > 99 { if wpm > 99 {
wpm = 99 wpm = 99
} }
if err := m.write([]byte{0x02, byte(wpm)}); err != nil { m.mu.Lock()
sk := m.serial
m.mu.Unlock()
if sk != nil {
sk.SetSpeed(wpm)
} else if err := m.write([]byte{0x02, byte(wpm)}); err != nil {
return err return err
} }
m.mu.Lock() m.mu.Lock()
@@ -283,18 +343,39 @@ func (m *Manager) Send(text string) error {
if out == "" { if out == "" {
return nil return nil
} }
m.mu.Lock()
sk := m.serial
m.mu.Unlock()
if sk != nil {
sk.Send(out)
return nil
}
return m.write([]byte(out)) return m.write([]byte(out))
} }
// Stop aborts the current message and clears the keyer buffer (command 0x0A). // Stop aborts the current message and clears the keyer buffer (command 0x0A).
func (m *Manager) Stop() error { func (m *Manager) Stop() error {
m.mu.Lock()
sk := m.serial
m.mu.Unlock()
if sk != nil {
sk.Stop()
return nil
}
return m.write([]byte{0x0A}) return m.write([]byte{0x0A})
} }
// Backspace removes the most recent character from the keyer's send buffer, // Backspace removes the most recent character from the keyer's send buffer,
// IF it hasn't been keyed yet (command 0x08). Used by "send on typing" mode // IF it hasn't been keyed yet (command 0x08). Used by "send on typing" mode
// so a fast typo can be corrected before it goes on the air. // so a fast typo can be corrected before it goes on the air. The serial line
// keyer has no buffer to un-key from, so backspace is a no-op there.
func (m *Manager) Backspace() error { func (m *Manager) Backspace() error {
m.mu.Lock()
sk := m.serial
m.mu.Unlock()
if sk != nil {
return nil
}
return m.write([]byte{0x08}) return m.write([]byte{0x08})
} }
@@ -313,14 +394,29 @@ func (m *Manager) write(b []byte) error {
func (m *Manager) Disconnect() { func (m *Manager) Disconnect() {
m.mu.Lock() m.mu.Lock()
p := m.port p := m.port
sk := m.serial
stop, done := m.stopRead, m.doneRead stop, done := m.stopRead, m.doneRead
m.port = nil m.port = nil
m.serial = nil
m.stopRead = nil m.stopRead = nil
m.doneRead = nil m.doneRead = nil
connected := m.status.Connected connected := m.status.Connected
m.status = Status{Connected: false} m.status = Status{Connected: false}
m.mu.Unlock() m.mu.Unlock()
if sk != nil {
// Serial line keyer: stop the worker (drops the key/PTT lines) then close.
sk.Close()
if p != nil {
_ = p.Close()
}
if connected {
applog.Printf("winkeyer: serial CW keyer disconnected")
m.emit()
}
return
}
if p != nil { if p != nil {
_, _ = p.Write([]byte{0x00, 0x03}) // Host Close _, _ = p.Write([]byte{0x00, 0x03}) // Host Close
_ = p.Close() _ = p.Close()
+1 -1
View File
@@ -21,7 +21,7 @@ import (
const ( const (
// appVersion is stamped on every heartbeat (and could feed the About box). // appVersion is stamped on every heartbeat (and could feed the About box).
appVersion = "0.20.10" appVersion = "0.20.11"
// posthogHost is the PostHog ingestion endpoint. EU cloud by default; change // posthogHost is the PostHog ingestion endpoint. EU cloud by default; change
// to https://us.i.posthog.com for a US project. // to https://us.i.posthog.com for a US project.