aduio mail

This commit is contained in:
2026-06-05 02:29:49 +02:00
parent a2a29c66d2
commit 95fdc1ccd1
14 changed files with 673 additions and 126 deletions
+25 -31
View File
@@ -202,39 +202,33 @@ func (o *OmniRig) SetFrequency(hz int64) error {
debugLog.Printf("OmniRig.SetFrequency(%d Hz / %.6f MHz): rig=%q status=%d(%s) vfo=%q(raw=%d) split=%d writeableParams=0x%X",
hz, float64(hz)/1e6, rigType, status, statusStr, vfo, rawVfo, split, writeable)
// Pick the active VFO's specific property. Many rig .ini files only define
// a WRITE command for FreqA/FreqB but not the generic Freq.
prop := "FreqA"
switch vfo {
case "B", "BB", "BA":
prop = "FreqB"
case "A", "AA", "AB":
prop = "FreqA"
}
wroteOK := false
if _, err := oleutil.PutProperty(o.rig, prop, hz32); err != nil {
debugLog.Printf("OmniRig.SetFrequency: PutProperty(%s) error: %v", prop, err)
// Primary path: OmniRig's SetSimplexMode is the rig-agnostic "QSY here"
// 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.
// Clearing split is the right thing when tuning to a spot anyway.
if _, err := oleutil.CallMethod(o.rig, "SetSimplexMode", int32(hz32)); err == nil {
debugLog.Printf("OmniRig.SetFrequency: SetSimplexMode(%d) OK", hz32)
} else {
debugLog.Printf("OmniRig.SetFrequency: PutProperty(%s, %d) OK", prop, hz32)
wroteOK = true
}
// Belt-and-suspenders: when NOT in split, also write the generic Freq.
// Icom .ini files commonly honour Freq (CI-V "set operating frequency")
// but ignore FreqA/FreqB, so the rig changed mode but never moved — this
// is exactly the IC-9100 "mode changes, freq doesn't" symptom.
if split == 0 {
if _, err := oleutil.PutProperty(o.rig, "Freq", hz32); err != nil {
debugLog.Printf("OmniRig.SetFrequency: PutProperty(Freq) error: %v", err)
if !wroteOK {
return err
}
} else {
debugLog.Printf("OmniRig.SetFrequency: PutProperty(Freq, %d) OK", hz32)
debugLog.Printf("OmniRig.SetFrequency: SetSimplexMode unavailable (%v) — using property writes", err)
// Fallback: write the active VFO's property AND the generic Freq
// (always — some .ini honour only one, and split here is often misread).
prop := "FreqA"
switch vfo {
case "B", "BB", "BA":
prop = "FreqB"
}
okAny := false
for _, p := range []string{prop, "Freq"} {
if _, e := oleutil.PutProperty(o.rig, p, hz32); e != nil {
debugLog.Printf("OmniRig.SetFrequency: PutProperty(%s) error: %v", p, e)
} else {
debugLog.Printf("OmniRig.SetFrequency: PutProperty(%s, %d) OK", p, hz32)
okAny = true
}
}
if !okAny {
return fmt.Errorf("OmniRig: no writable frequency property for this rig")
}
} else if !wroteOK {
return fmt.Errorf("OmniRig: could not write %s and split is on (won't touch generic Freq)", prop)
}
// Read back all three immediately. OmniRig is async (the CAT command is