feat: added record qso dvk
This commit is contained in:
@@ -27,6 +27,9 @@ type Backend interface {
|
||||
// Implementations decide USB vs LSB (typically by current freq) and
|
||||
// generic vs specific digital modes (most rigs just have DATA).
|
||||
SetMode(mode string) error
|
||||
// SetPTT keys (on=true) or unkeys the transmitter. Used by the Digital
|
||||
// Voice Keyer to put the rig into TX while a message plays.
|
||||
SetPTT(on bool) error
|
||||
}
|
||||
|
||||
// RigState is the snapshot exchanged with the frontend.
|
||||
@@ -161,6 +164,11 @@ func (m *Manager) SetMode(mode string) error {
|
||||
return m.exec(func(b Backend) error { return b.SetMode(mode) })
|
||||
}
|
||||
|
||||
// SetPTT dispatches a transmit on/off request to the CAT goroutine.
|
||||
func (m *Manager) SetPTT(on bool) error {
|
||||
return m.exec(func(b Backend) error { return b.SetPTT(on) })
|
||||
}
|
||||
|
||||
// exec marshals a backend operation onto the CAT goroutine. Returns the
|
||||
// operation's error or a "busy"/"not running" error if dispatch failed.
|
||||
func (m *Manager) exec(fn func(Backend) error) error {
|
||||
|
||||
@@ -319,6 +319,43 @@ func (o *OmniRig) SetMode(mode string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetPTT keys or unkeys the rig via OmniRig's SetTx(PM_RX|PM_TX). Used by the
|
||||
// Digital Voice Keyer to put the rig into TX while a voice message plays.
|
||||
func (o *OmniRig) SetPTT(on bool) error {
|
||||
if o.rig == nil {
|
||||
debugLog.Printf("OmniRig.SetPTT(%v): NOT CONNECTED", on)
|
||||
return fmt.Errorf("not connected")
|
||||
}
|
||||
status, statusStr, writeable := int64(-1), "", int64(-1)
|
||||
if v, err := oleutil.GetProperty(o.rig, "Status"); err == nil {
|
||||
status = v.Val
|
||||
}
|
||||
if v, err := oleutil.GetProperty(o.rig, "StatusStr"); err == nil {
|
||||
statusStr = v.ToString()
|
||||
}
|
||||
if v, err := oleutil.GetProperty(o.rig, "WriteableParams"); err == nil {
|
||||
writeable = v.Val
|
||||
}
|
||||
txWriteable := writeable != -1 && writeable&pmTX != 0
|
||||
param, name := pmRX, "PM_RX"
|
||||
if on {
|
||||
param, name = pmTX, "PM_TX"
|
||||
}
|
||||
debugLog.Printf("OmniRig.SetPTT(%v): status=%d(%s) writeableParams=0x%X PM_TX-writeable=%v → Tx=%s",
|
||||
on, status, statusStr, writeable, txWriteable, name)
|
||||
if on && !txWriteable {
|
||||
debugLog.Printf("OmniRig.SetPTT: ⚠ this rig's OmniRig .ini does NOT expose TX keying (PM_TX not writeable). " +
|
||||
"Use VOX or serial RTS/DTR PTT instead.")
|
||||
}
|
||||
// OmniRig has NO SetTx method (that returns "unknown name"); the Tx
|
||||
// parameter is set via the writeable Tx PROPERTY (PM_TX / PM_RX).
|
||||
if _, err := oleutil.PutProperty(o.rig, "Tx", int32(param)); err != nil {
|
||||
debugLog.Printf("OmniRig.SetPTT error: %v", err)
|
||||
return fmt.Errorf("set Tx=%s: %w", name, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ===== OmniRig enum decoders =====
|
||||
|
||||
// Bit flags from OmniRig type library (RigParamX enum in OmniRig_TLB.pas).
|
||||
@@ -328,6 +365,8 @@ func (o *OmniRig) SetMode(mode string) error {
|
||||
// too low which causes every mode to map to the slot below it (AM → DIG_L,
|
||||
// FT8 → SSB_L, etc.).
|
||||
const (
|
||||
pmRX int64 = 1 << 20 // 0x00100000 — PM_RX (receive)
|
||||
pmTX int64 = 1 << 21 // 0x00200000 — PM_TX (transmit / PTT on)
|
||||
pmCWU int64 = 1 << 23 // 0x00800000
|
||||
pmCWL int64 = 1 << 24 // 0x01000000
|
||||
pmSSBU int64 = 1 << 25 // 0x02000000
|
||||
|
||||
Reference in New Issue
Block a user