fix(icom): verify the data flag after a mode set, and correct it with 0x26
The IC-7760 acknowledges the 1A 06 data-mode command and stays in USB-D anyway, which left the operator unable to get back to plain USB from the console at all. After every mode set the flag is read back; on a mismatch it is said again with 0x26 — mode, data flag and filter in one frame, the form the newer rigs actually honour. Only on a mismatch, so rigs that predate 0x26 never see the command.
This commit is contained in:
@@ -559,6 +559,18 @@ func (b *IcomSerial) SetMode(mode string) error {
|
||||
}
|
||||
// Filter 0x01 (FIL1) is the conventional default for the data-mode set.
|
||||
_ = b.execIdempotent("set data mode", civ.CmdExtra, civ.SubDataMode, dataByte, 0x01)
|
||||
// Trust, then verify: the IC-7760 acknowledges 1A 06 and stays in USB-D
|
||||
// anyway, which left an operator unable to get back to plain USB at all.
|
||||
// When the readback disagrees, say it again with 0x26 — mode, data flag and
|
||||
// filter in one frame, the command the newer rigs actually honour. Only on
|
||||
// a mismatch, so rigs that predate 0x26 never see it.
|
||||
if got := b.readDataMode(); got != data {
|
||||
if err := b.execIdempotent("set mode+data (0x26)", civ.CmdModeDataFil, 0x00, code, dataByte, 0x01); err != nil {
|
||||
applog.Printf("icom: data flag stuck at %v after mode %s, and 0x26 failed too: %v", got, mode, err)
|
||||
} else {
|
||||
applog.Printf("icom: data flag stuck after 1A06, corrected via 0x26 (mode %s)", mode)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user