feat(tci): the transmit meters, and no temperature invented
TX_POWER and TX_SWR are read-only commands the radio answers when asked, so they are asked for on each poll of a KEYED radio and not at all otherwise: a receiving station pays nothing for meters nobody is watching. Both appear next to the S-meter only while transmitting, because showing them the rest of the time would show the last thing that happened as if it were now. An SWR of 0 draws as '—' rather than as 1.0. A perfect match on an antenna nobody has measured is the one reading an operator should never be handed. There is no temperature. The protocol's command list has TX_POWER and TX_SWR and nothing thermal at all — so rather than leave the question hanging, it is written down where the next person will look for it. A temperature invented from something else, on a transmitter, is exactly the kind of number somebody would trust.
This commit is contained in:
@@ -68,6 +68,17 @@ type TCIPanelState struct {
|
||||
// several times a second while receiving.
|
||||
SMeter int `json:"smeter"`
|
||||
|
||||
// TXPowerW and TXSWR are the transmit meters. READ-ONLY in TCI, and only
|
||||
// answered while transmitting — asked for on every poll of a keyed radio,
|
||||
// see ReadState.
|
||||
//
|
||||
// There is no temperature in this protocol. The command list has TX_POWER
|
||||
// and TX_SWR and nothing thermal at all, so a temperature reading here would
|
||||
// have to be invented, and an invented temperature on a transmitter is the
|
||||
// kind of number somebody trusts.
|
||||
TXPowerW float64 `json:"tx_power_w"`
|
||||
TXSWR float64 `json:"tx_swr"`
|
||||
|
||||
// Modulations is what this radio will accept, straight from its own
|
||||
// announcement, so the mode buttons are the radio's and not a guess.
|
||||
Modulations []string `json:"modulations,omitempty"`
|
||||
@@ -194,6 +205,14 @@ func (t *TCI) handlePanel(name string, get func(int) string, args string) bool {
|
||||
if forRX0() {
|
||||
p.Lock = yes(get(1))
|
||||
}
|
||||
case "tx_power":
|
||||
if v, err := strconv.ParseFloat(strings.TrimSpace(get(0)), 64); err == nil {
|
||||
p.TXPowerW = v
|
||||
}
|
||||
case "tx_swr":
|
||||
if v, err := strconv.ParseFloat(strings.TrimSpace(get(0)), 64); err == nil {
|
||||
p.TXSWR = v
|
||||
}
|
||||
case "rx_smeter":
|
||||
if n, ok := num(get(1)); ok && forRX0() {
|
||||
p.SMeter = n
|
||||
|
||||
Reference in New Issue
Block a user