feat(icom): the ATU can be taken out of line
TUNE (1C 01 02) started a cycle; nothing sent the 0 that puts the tuner back through. An ATU chip beside SPLIT now toggles it, and the tuner state is read on the slow front-panel beat so the radio's own TUNER button stays in sync.
This commit is contained in:
+3
-1
@@ -602,7 +602,8 @@ type IcomTXState struct {
|
||||
Att int `json:"att"` // dB attenuation, 0=off
|
||||
Filter int `json:"filter"` // 1 | 2 | 3 (FIL1/2/3)
|
||||
// Antenna (IC-7610 = ANT1/ANT2).
|
||||
Antenna int `json:"antenna"` // 1 | 2 (0 = unknown)
|
||||
Antenna int `json:"antenna"` // 1 | 2 (0 = unknown)
|
||||
ATUOn bool `json:"atu_on"` // internal tuner engaged
|
||||
// Filter fine controls: Twin PBT + manual notch (0-100, 50 = centre).
|
||||
PBTInner int `json:"pbt_inner"`
|
||||
PBTOuter int `json:"pbt_outer"`
|
||||
@@ -641,6 +642,7 @@ type IcomController interface {
|
||||
SetMicGain(int) error
|
||||
SetIcomSplit(bool) error
|
||||
SetIcomSplitOffset(bool, int64) error
|
||||
SetATU(bool) error
|
||||
TuneATU() error
|
||||
SetScope(bool) error // enable/disable the spectrum-scope waveform stream
|
||||
SetScopeMode(bool) error // true = fixed span, false = center-on-VFO
|
||||
|
||||
@@ -530,6 +530,13 @@ func (b *IcomSerial) refreshFrontPanel() {
|
||||
b.dsp.Filter = int(f)
|
||||
b.dspMu.Unlock()
|
||||
}
|
||||
case 2:
|
||||
// Tuner in/out — the radio's own TUNER button changes it mid-session.
|
||||
if v, ok := b.readSwitchSub(civ.CmdATU, civ.SubATU); ok {
|
||||
b.dspMu.Lock()
|
||||
b.dsp.ATUOn = v == 1
|
||||
b.dspMu.Unlock()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2041,6 +2048,17 @@ func (b *IcomSerial) TuneATU() error {
|
||||
return b.exec(civ.CmdATU, civ.SubATU, 0x02)
|
||||
}
|
||||
|
||||
// SetATU engages or DISENGAGES the internal tuner (0x1C 0x01: 1 = in line,
|
||||
// 0 = through). Tune existed without this, which meant a tuner once engaged
|
||||
// could not be taken out of line again from the console.
|
||||
func (b *IcomSerial) SetATU(on bool) error {
|
||||
if err := b.exec(civ.CmdATU, civ.SubATU, boolByte(on)); err != nil {
|
||||
return err
|
||||
}
|
||||
b.setCache(func(s *IcomTXState) { s.ATUOn = on })
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *IcomSerial) setCache(fn func(*IcomTXState)) {
|
||||
b.dspMu.Lock()
|
||||
fn(&b.dsp)
|
||||
|
||||
Reference in New Issue
Block a user