feat: the Yaesu console follows the mode — CW gets its own controls
Microphone gain and VOX are meaningless in CW: the rig ignores both, so showing them is showing dead controls. They are hidden, and a CW card takes their place with keyer speed (KS), break-in (BI) and ZIN (ZI), the zero-in that retunes so the station being received lands on the operator's own pitch. ZIN is a one-shot with no state, so it is a plain button rather than a chip that would look latched, and no settings read-back follows — the frequency change arrives through the normal poll like any other. The keyer values are read on the slow beat whatever the mode, so the card is already populated the instant the operator switches to CW instead of filling in a poll cycle later. Which controls show is decided by the RIG's mode, not the logged one: the logged mode can be a digital sub-mode the radio knows nothing about.
This commit is contained in:
@@ -55,6 +55,10 @@ type YaesuTXState struct {
|
||||
NRLevel int `json:"nr_level"` // 1-15
|
||||
Narrow bool `json:"narrow"` // NAR filter
|
||||
VOX bool `json:"vox"`
|
||||
// CW-only controls. Read (and shown) only in CW, where MIC and VOX mean
|
||||
// nothing and these are what an operator reaches for.
|
||||
KeySpeed int `json:"key_speed"` // WPM
|
||||
BreakIn bool `json:"break_in"`
|
||||
}
|
||||
|
||||
// YaesuController is the typed escape the Manager exposes for the panel, in the
|
||||
@@ -75,6 +79,9 @@ type YaesuController interface {
|
||||
SetYaesuNRLevel(int) error
|
||||
SetYaesuNarrow(bool) error
|
||||
SetYaesuVOX(bool) error
|
||||
SetYaesuKeySpeed(int) error
|
||||
SetYaesuBreakIn(bool) error
|
||||
YaesuZeroIn() error
|
||||
SetYaesuSplit(bool) error
|
||||
SetYaesuSplitOffset(int64) error
|
||||
SetYaesuBand(string) error
|
||||
@@ -173,6 +180,15 @@ func (y *Yaesu) readPanelSettings() {
|
||||
if v, ok := y.askNum("VX;", "VX", 1); ok {
|
||||
y.panel.VOX = v != 0
|
||||
}
|
||||
// CW keyer. Read unconditionally — it is two more queries on the SLOW beat,
|
||||
// and having the value ready means the CW card is populated the instant the
|
||||
// operator switches mode rather than a poll cycle later.
|
||||
if v, ok := y.askNum("KS;", "KS", 3); ok {
|
||||
y.panel.KeySpeed = v
|
||||
}
|
||||
if v, ok := y.askNum("BI;", "BI", 1); ok {
|
||||
y.panel.BreakIn = v != 0
|
||||
}
|
||||
}
|
||||
|
||||
// askNum sends a query and reads a fixed-width decimal field out of the reply.
|
||||
@@ -563,3 +579,28 @@ func (y *Yaesu) SetYaesuSplitOffset(offsetHz int64) error {
|
||||
y.panel.SplitTXHz = tx
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetYaesuKeySpeed sets the internal keyer speed in words per minute. The rig
|
||||
// clamps to its own 4-60 range; clamping here too keeps a slider from sending a
|
||||
// value that would simply be ignored, which reads as a dead control.
|
||||
func (y *Yaesu) SetYaesuKeySpeed(wpm int) error {
|
||||
return y.setAndRefresh(fmt.Sprintf("KS%03d;", clampInt(wpm, 4, 60)))
|
||||
}
|
||||
|
||||
// SetYaesuBreakIn toggles CW break-in (BK).
|
||||
func (y *Yaesu) SetYaesuBreakIn(on bool) error {
|
||||
return y.setAndRefresh(fmt.Sprintf("BI%d;", boolDigit(on)))
|
||||
}
|
||||
|
||||
// YaesuZeroIn is the CW ZIN function: the rig retunes itself so the station
|
||||
// being received lands exactly on the operator's CW pitch. It is a one-shot
|
||||
// action with no state to read back, so no settings refresh follows — and the
|
||||
// frequency change arrives through the normal poll like any other.
|
||||
func (y *Yaesu) YaesuZeroIn() error {
|
||||
y.mu.Lock()
|
||||
defer y.mu.Unlock()
|
||||
if y.port == nil {
|
||||
return fmt.Errorf("yaesu: not connected")
|
||||
}
|
||||
return y.write("ZI;")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user