fix: bug where scope is now showing on IC7300
This commit is contained in:
@@ -210,17 +210,25 @@ func (b *IcomSerial) Connect() error {
|
||||
go b.netScopeFeeder(sc.ScopeChan(), b.readerDone)
|
||||
}
|
||||
|
||||
// Best-effort model identification: ask the rig for its own CI-V address.
|
||||
// Best-effort model identification: ask the rig for its own CI-V address. The
|
||||
// 0x19 ID read returns the rig's FACTORY default address (e.g. 0x94 for an
|
||||
// IC-7300) regardless of the address it's currently OPERATING on — so it's the
|
||||
// reliable model signal even when the user runs the rig at a non-default CI-V
|
||||
// address (a common trick to make CAT "just work" at 0x98).
|
||||
idAddr := b.rigAddr // fallback: the configured address if the ID read fails
|
||||
if err := b.write(civ.CmdReadID, civ.SubPTT); err == nil {
|
||||
if f, err := b.recv(icomReadTimeout, func(d civ.Decoded) bool {
|
||||
return d.Cmd == civ.CmdReadID && len(d.Data) >= 2 && d.Data[0] == 0x00
|
||||
}); err == nil {
|
||||
b.model = civ.ModelName(f.Data[1])
|
||||
idAddr = f.Data[1]
|
||||
}
|
||||
}
|
||||
// Dual-scope rigs (IC-7610/9700) prefix each waveform frame with a main/sub
|
||||
// selector byte; single-scope rigs (IC-7300…) do not.
|
||||
b.dualScope = b.rigAddr == 0x98 || b.rigAddr == 0xA2
|
||||
// selector byte; single-scope rigs (IC-7300…) do not. Decide from the
|
||||
// IDENTIFIED model, NOT the configured address: an IC-7300 run at 0x98 must
|
||||
// still parse single-scope frames (this was the "scope blank on the 7300" bug).
|
||||
b.dualScope = idAddr == 0x98 || idAddr == 0xA2
|
||||
// Defer the DSP snapshot until the rig actually answers CI-V. Over the network
|
||||
// the rig may still be booting (or off) at Connect, so an immediate readDSP
|
||||
// would time out and leave every control at 0 / off with no retry. ReadState
|
||||
@@ -590,7 +598,7 @@ func (b *IcomSerial) scopeLoop(spec chan civ.Decoded, done chan struct{}) {
|
||||
}
|
||||
continue
|
||||
}
|
||||
if rawN < 4 {
|
||||
if rawN < 24 {
|
||||
rawN++
|
||||
applog.Printf("icom scope raw #%d: len=%d data=[% X]", rawN, len(f.Data), f.Data)
|
||||
}
|
||||
@@ -696,6 +704,13 @@ func (b *IcomSerial) assembleSweep(regions map[byte][]byte, total byte) {
|
||||
// and 0x27 0x11 turns the waveform data OUTPUT over CI-V on. While on, the reader
|
||||
// routes every 0x27 frame to scopeLoop.
|
||||
func (b *IcomSerial) SetScope(on bool) error {
|
||||
if on {
|
||||
// Context for the scope-diagnostic log: which rig + whether we expect the
|
||||
// dual-scope (main/sub) frame layout. If the IC-7300 (single scope) streams
|
||||
// but nothing shows, compare its `icom scope raw` frames against this.
|
||||
applog.Printf("icom scope: enable on rig=%q addr=0x%02X dualScope=%v (expect %s frame layout)",
|
||||
b.model, b.rigAddr, b.dualScope, map[bool]string{true: "27 00 [MS] [seq] [total] …", false: "27 00 [seq] [total] …"}[b.dualScope])
|
||||
}
|
||||
// Some firmwares don't ack 0x27 sets; a timeout here isn't fatal, so log and
|
||||
// continue rather than abort the second command.
|
||||
if err := b.exec(civ.CmdScope, civ.SubScopeOnOff, boolByte(on)); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user