fix(elecraft): calibrate the S-meter, and stop the SWR spike lingering
The S-unit mapping was provisional, waiting for a real radio. One arrived: side by side with a K3's own display, raw 5 reads S7 and raw 9 reads S9+20, so S9 sits near raw 6.5 — not 9 — and each raw step above it is worth ~8 dB. The old scale showed everything two S-units low. The SWR meter borrowed the power meter's needle inertia — hold the peak, then close a quarter of the gap per poll. The K3 throws a brief SWR spike as an FT8 frame ends, and that decay turned one bad sample into twelve seconds of red on the next transmission. SWR now holds the peak for the same 1.5 s and then snaps back to the live reading: it is a warning light, not a needle.
This commit is contained in:
@@ -349,7 +349,7 @@ func (k *Kenwood) readTXMeters() {
|
||||
if v, ok := k.askNum("SW;", "SW", 3); ok {
|
||||
k.panel.SWRRaw = v
|
||||
if v > 0 {
|
||||
k.panel.SWR = float64(k.swrPeak.update(v, now)) / 10
|
||||
k.panel.SWR = float64(k.swrPeak.updateSnap(v, now)) / 10
|
||||
}
|
||||
}
|
||||
if k.metersLogged >= 20 {
|
||||
|
||||
@@ -905,3 +905,22 @@ func yaesuSplitCommand(cmd, vfo string, on bool) string {
|
||||
}
|
||||
return cmd + "0;"
|
||||
}
|
||||
|
||||
// updateSnap is update for a meter where lingering is misinformation: the peak
|
||||
// stands for the hold, then the display returns to the live sample AT ONCE.
|
||||
// Made for the K3's SWR — the radio throws a brief SWR spike as an FT8 frame
|
||||
// ends, and the quarter-of-the-gap decay above turned that one bad sample into
|
||||
// twelve seconds of alarming red on the next transmission. A needle's inertia
|
||||
// suits a power meter; an SWR reading is a warning light, and a warning that
|
||||
// fades slowly reads as a fault that is slowly getting better.
|
||||
func (m *meterPeak) updateSnap(sample int, now time.Time) int {
|
||||
if sample >= m.val {
|
||||
m.val, m.at = sample, now
|
||||
return m.val
|
||||
}
|
||||
if now.Sub(m.at) < meterHold {
|
||||
return m.val
|
||||
}
|
||||
m.val, m.at = sample, now
|
||||
return m.val
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user