From 3db49e12131817fb6870325d8af3c0b267dd51fc Mon Sep 17 00:00:00 2001 From: rouggy Date: Sun, 30 Aug 2026 03:02:06 +0200 Subject: [PATCH] debug(icom): say whether the split mode-align was accepted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 0x26 01 copy was fire-and-forget, and a real 7760's sub VFO kept yesterday's mode with nothing to show why — refused, or sent with a stale mode byte. The mode is read first when unknown, and both outcomes are logged. --- internal/cat/icomserial.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/cat/icomserial.go b/internal/cat/icomserial.go index e2500cb..f10e01e 100644 --- a/internal/cat/icomserial.go +++ b/internal/cat/icomserial.go @@ -1935,12 +1935,25 @@ func (b *IcomSerial) SetIcomSplitOffset(on bool, offsetHz int64) error { // yesterday's mode transmits FM into a CW pileup. 0x26 0x01 sets the // unselected VFO's mode + data flag in one frame; rigs that predate // 0x26 NAK it harmlessly and behave as they always did. + if b.curModeByte == 0 { + // A fresh session may not have read the mode yet — ask, or the copy + // below would send mode 0 (LSB) whatever the main is on. + if m, ok := b.readMode(); ok { + b.curModeByte = m + } + } if b.curModeByte != 0 { dataByte := byte(0) if got := b.readDataMode(); got { dataByte = 1 } - _ = b.exec(civ.CmdModeDataFil, 0x01, b.curModeByte, dataByte, 0x01) + // Logged, not discarded: the first version swallowed the error and a + // real 7760's sub VFO kept yesterday's mode with nothing to show why. + if err := b.exec(civ.CmdModeDataFil, 0x01, b.curModeByte, dataByte, 0x01); err != nil { + applog.Printf("icom: split mode-align (26 01 %02X %d) refused: %v", b.curModeByte, dataByte, err) + } else { + applog.Printf("icom: split mode-align OK (26 01 %02X %d)", b.curModeByte, dataByte) + } } } if err := b.exec(civ.CmdSplit, boolByte(on)); err != nil {