fix(elecraft): read the TX meters when the RADIO says it is transmitting
The transmit meters were read on k.tx, which records only that OpsLog keyed the radio. An operator using the front-panel PTT, a footswitch or the mic button therefore had a panel that believed the rig was receiving — and since the power and SWR bars are read only while transmitting, they were never read at all. IF carries the radio's own transmit bit; that is what decides now. The meter probe logs RAW answers rather than parsed numbers, and asks a wider set (SM, SMH, BG, SW, PO, TQ). A command answering in a shape we did not expect is the interesting case, and parsing hid it behind the same dash as a command the radio refused — which is what still stands between us and a working SWR reading on a K3.
This commit is contained in:
@@ -451,7 +451,12 @@ func (k *Kenwood) ReadState() (RigState, error) {
|
||||
// The panel rides on the same poll and the same held mutex: its own reader
|
||||
// would have to take turns on the serial port, and the K3 is slow enough
|
||||
// that two readers taking turns is what makes a dial lag.
|
||||
k.readPanel(s.Mode, s.Split, s.FreqHz)
|
||||
// f.TX, not k.tx: the radio is the one that knows it is transmitting. k.tx
|
||||
// only records that OPSLOG keyed it, so a carrier raised with the front-panel
|
||||
// PTT, a footswitch or the mic button left the panel showing a receiver — and
|
||||
// the transmit meters, which are read only while transmitting, were never
|
||||
// read at all for anyone who keys the radio by hand.
|
||||
k.readPanel(s.Mode, s.Split, s.FreqHz, f.TX)
|
||||
return s, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -135,14 +135,14 @@ func (k *Kenwood) RefreshKenwood() error {
|
||||
|
||||
// readPanel refreshes the panel. Called from ReadState with the mutex HELD, so
|
||||
// it shares the same serialised link as everything else.
|
||||
func (k *Kenwood) readPanel(mode string, split bool, txHz int64) {
|
||||
func (k *Kenwood) readPanel(mode string, split bool, txHz int64, txNow bool) {
|
||||
k.panel.Mode = mode
|
||||
k.panel.Split = split
|
||||
k.panel.SplitTXHz = 0
|
||||
if split {
|
||||
k.panel.SplitTXHz = txHz
|
||||
}
|
||||
k.panel.Transmitting = k.tx
|
||||
k.panel.Transmitting = k.tx || txNow
|
||||
k.panel.MetersProvisional = true
|
||||
|
||||
if k.panel.Transmitting {
|
||||
@@ -309,16 +309,7 @@ func kenwoodAGCValue(name string) int {
|
||||
// answered and what it said, next to the power SETTING: the meter that tracks a
|
||||
// known carrier at two different power levels is the power meter, and no amount
|
||||
// of reading the reference settles that as well as one transmission does.
|
||||
var kenwoodMeterProbes = []struct {
|
||||
cmd string
|
||||
prefix string
|
||||
digits int
|
||||
}{
|
||||
{"SM;", "SM", 4},
|
||||
{"BG;", "BG", 2},
|
||||
{"SW;", "SW", 4},
|
||||
{"PO;", "PO", 3},
|
||||
}
|
||||
var kenwoodMeterProbes = []string{"SM;", "SMH;", "BG;", "SW;", "PO;", "TQ;"}
|
||||
|
||||
// readTXMeters reads the transmit meters.
|
||||
func (k *Kenwood) readTXMeters() {
|
||||
@@ -342,12 +333,15 @@ func (k *Kenwood) readTXMeters() {
|
||||
return
|
||||
}
|
||||
k.metersLogged++
|
||||
// The RAW answers, not parsed numbers: a command that answers in a shape we
|
||||
// did not expect is the interesting case, and a parsed "-" hides it behind
|
||||
// the same dash as a command the radio refused.
|
||||
raw := make([]string, 0, len(kenwoodMeterProbes))
|
||||
for _, p := range kenwoodMeterProbes {
|
||||
if v, ok := k.askNum(p.cmd, p.prefix, p.digits); ok {
|
||||
raw = append(raw, fmt.Sprintf("%s=%d", strings.TrimSuffix(p.cmd, ";"), v))
|
||||
for _, cmd := range kenwoodMeterProbes {
|
||||
if r, err := k.ask(cmd); err == nil {
|
||||
raw = append(raw, strings.TrimSuffix(cmd, ";")+"→"+strings.TrimSuffix(r, ";"))
|
||||
} else {
|
||||
raw = append(raw, strings.TrimSuffix(p.cmd, ";")+"=-")
|
||||
raw = append(raw, strings.TrimSuffix(cmd, ";")+"→refused")
|
||||
}
|
||||
}
|
||||
debugLog.Printf("kenwood: TX meters at PC=%dW: %s (compare two power settings, and a known SWR)",
|
||||
|
||||
Reference in New Issue
Block a user