feat(omnirig): say which of its two CW bits means CW on this rig
Reported on an IC-7610 shared through OmniRig: clicking a CW spot put the radio in CW-R every time, and the only way out was to edit the OmniRig rig file by hand. OmniRig's model has two CW modes, PM_CW_U and PM_CW_L, and nothing in it says which one an .ini calls plain CW. Icom rig files disagree with each other — on some PM_CW_U is CI-V mode 0x03 (CW), on others 0x07 (CW-R) — so asking for "CW" is a question with two right answers and OpsLog was only ever giving one of them. Settings ▸ CAT ▸ OmniRig now carries the answer for THIS rig, and it is pushed to a radio that is already connected rather than waiting for a reconnect: which bit a mode maps to is not worth dropping the link, and with it WSJT-X's rigctl session. Same shape as the Yaesu RTTY sideband, for the same reason. Nothing changes for anyone whose rig file already agrees with us. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
@@ -121,6 +121,12 @@ const (
|
||||
keyCATOmniRigNum = "cat.omnirig.rig" // 1 or 2
|
||||
// Which VFO to believe when OmniRig names one. "" = trust the rig file.
|
||||
keyCATOmniRigVFO = "cat.omnirig.vfo" // "" | "A" | "B"
|
||||
// OmniRig's model has two CW modes — PM_CW_U and PM_CW_L — and nothing says
|
||||
// which one an .ini file calls plain CW. Icom files disagree with each other:
|
||||
// on some, PM_CW_U is CI-V mode 0x03 (CW) and on others it is 0x07 (CW-R).
|
||||
// An operator clicking a CW spot on an IC-7610 landed in CW-R and had to edit
|
||||
// the rig file to get out of it. This says which bit means CW on THIS rig.
|
||||
keyCATOmniRigCWLower = "cat.omnirig.cw_lower" // "1" → send PM_CW_L for CW
|
||||
// Put the RADIO in USB for a digital mode instead of asking for the mode by
|
||||
// name. Every backend, because the reason is the radio, not the link.
|
||||
keyCATDigiUSB = "cat.digi_usb"
|
||||
@@ -483,6 +489,9 @@ type CATSettings struct {
|
||||
// the .ini: an IC-7610 file was seen declaring VFO B permanently while the
|
||||
// operator worked on the main VFO, so OpsLog wrote to A and read B.
|
||||
OmniRigVFO string `json:"omnirig_vfo"` // "" | "A" | "B"
|
||||
// OmniRigCWLower sends PM_CW_L instead of PM_CW_U when the mode is CW — for
|
||||
// the rig files whose PM_CW_U is the REVERSE sideband. See the key comment.
|
||||
OmniRigCWLower bool `json:"omnirig_cw_lower"`
|
||||
// DigiAsUSB puts the radio in USB when a digital mode is selected, rather
|
||||
// than naming the mode. What the QSO is LOGGED as never changes.
|
||||
DigiAsUSB bool `json:"digi_as_usb"`
|
||||
@@ -8366,7 +8375,7 @@ func (a *App) GetCATSettings() (CATSettings, error) {
|
||||
if a.settings == nil {
|
||||
return CATSettings{Backend: "omnirig", OmniRigNum: 1, PollMs: 250}, fmt.Errorf("db not initialized")
|
||||
}
|
||||
m, err := a.settings.GetMany(a.ctx, keyCATEnabled, keyCATBackend, keyCATOmniRigNum, keyCATOmniRigVFO, keyCATFlexHost, keyCATFlexPort, keyCATFlexSpots, keyCATFlexDVKDax, keyCATFlexDecodeSpots, keyCATFlexDecodeSecs, keyCATXieguPort, keyCATXieguBaud, keyCATXieguAddr, keyCATXieguPTTLine, keyCATYaesuPort, keyCATYaesuBaud, keyCATYaesuRTTYUSB, keyCATKenwoodPort, keyCATKenwoodBaud, keyCATKenwoodHost, keyCATKenwoodLink, keyCATYaesuLowLines, keyCATKenwoodLowLines, keyCATKenwoodDataMode, keyCATIcomPort, keyCATIcomBaud, keyCATIcomAddr, keyCATIcomNetHost, keyCATIcomNetUser, keyCATIcomNetPass, keyCATIcomNetAudio, keyCATTCIHost, keyCATTCIPort, keyCATTCISpots, keyCATPttHotkeyEnabled, keyCATPttHotkey, keyCATPttHotkeyToggle, keyCATPollMs, keyCATDelayMs, keyCATOffsetOn, keyCATOffsetHz, keyCATDigitalDefault, keyCATShareEnabled, keyCATSharePort, keyCATShareProto, keyCATShareTCIPort, keyCATDigiUSB)
|
||||
m, err := a.settings.GetMany(a.ctx, keyCATEnabled, keyCATBackend, keyCATOmniRigNum, keyCATOmniRigVFO, keyCATOmniRigCWLower, keyCATFlexHost, keyCATFlexPort, keyCATFlexSpots, keyCATFlexDVKDax, keyCATFlexDecodeSpots, keyCATFlexDecodeSecs, keyCATXieguPort, keyCATXieguBaud, keyCATXieguAddr, keyCATXieguPTTLine, keyCATYaesuPort, keyCATYaesuBaud, keyCATYaesuRTTYUSB, keyCATKenwoodPort, keyCATKenwoodBaud, keyCATKenwoodHost, keyCATKenwoodLink, keyCATYaesuLowLines, keyCATKenwoodLowLines, keyCATKenwoodDataMode, keyCATIcomPort, keyCATIcomBaud, keyCATIcomAddr, keyCATIcomNetHost, keyCATIcomNetUser, keyCATIcomNetPass, keyCATIcomNetAudio, keyCATTCIHost, keyCATTCIPort, keyCATTCISpots, keyCATPttHotkeyEnabled, keyCATPttHotkey, keyCATPttHotkeyToggle, keyCATPollMs, keyCATDelayMs, keyCATOffsetOn, keyCATOffsetHz, keyCATDigitalDefault, keyCATShareEnabled, keyCATSharePort, keyCATShareProto, keyCATShareTCIPort, keyCATDigiUSB)
|
||||
if err != nil {
|
||||
return CATSettings{}, err
|
||||
}
|
||||
@@ -8472,6 +8481,7 @@ func (a *App) GetCATSettings() (CATSettings, error) {
|
||||
if out.DigitalDefault == "" {
|
||||
out.DigitalDefault = "FT8"
|
||||
}
|
||||
out.OmniRigCWLower = m[keyCATOmniRigCWLower] == "1"
|
||||
if v := strings.ToUpper(strings.TrimSpace(m[keyCATOmniRigVFO])); v == "A" || v == "B" {
|
||||
out.OmniRigVFO = v
|
||||
}
|
||||
@@ -8588,6 +8598,7 @@ func (a *App) SaveCATSettings(s CATSettings) error {
|
||||
keyCATBackend: s.Backend,
|
||||
keyCATOmniRigNum: strconv.Itoa(s.OmniRigNum),
|
||||
keyCATOmniRigVFO: strings.ToUpper(strings.TrimSpace(s.OmniRigVFO)),
|
||||
keyCATOmniRigCWLower: boolStr(s.OmniRigCWLower),
|
||||
keyCATDigiUSB: boolStr(s.DigiAsUSB),
|
||||
keyCATFlexHost: strings.TrimSpace(s.FlexHost),
|
||||
keyCATFlexPort: strconv.Itoa(s.FlexPort),
|
||||
@@ -16338,6 +16349,9 @@ func (a *App) reloadCAT() {
|
||||
if s.Enabled && s.Backend == "yaesu" && a.cat != nil {
|
||||
_ = a.cat.YaesuDo(func(y cat.YaesuController) error { y.SetRTTYUpper(s.YaesuRTTYUSB); return nil })
|
||||
}
|
||||
if s.Enabled && s.Backend == "omnirig" && a.cat != nil {
|
||||
_ = a.cat.OmniRigDo(func(o cat.OmniRigController) error { o.SetCWLower(s.OmniRigCWLower); return nil })
|
||||
}
|
||||
// Nothing about the link changed → leave it connected. See catLinkSig.
|
||||
if sig := catLinkSig(s); sig == a.catSig {
|
||||
applog.Printf("cat: settings saved, link unchanged — staying connected")
|
||||
@@ -16362,7 +16376,7 @@ func (a *App) reloadCAT() {
|
||||
// Spawning OmniRig.exe ourselves (even with /Embedding) on every
|
||||
// reloadCAT raised the existing instance's window to the front,
|
||||
// which is what Log4OM avoids by relying entirely on COM activation.
|
||||
a.cat.Start(cat.NewOmniRig(s.OmniRigNum, s.OmniRigVFO))
|
||||
a.cat.Start(cat.NewOmniRig(s.OmniRigNum, s.OmniRigVFO, s.OmniRigCWLower))
|
||||
case "flex":
|
||||
// Native FlexRadio (SmartSDR) TCP API — no OmniRig needed.
|
||||
fb := cat.NewFlex(s.FlexHost, s.FlexPort, s.FlexSpots)
|
||||
|
||||
Reference in New Issue
Block a user