chore(tci): cap the diagnostic logging per message type

The transmit meters are asked for four times a second while keyed, so
logging every arrival would fill an evening's log — and a diagnostic that
fills a log is one that gets switched off instead of read. Twenty of each
is enough to tell an answer from a silence, which is all it is for.
This commit is contained in:
2026-08-26 22:07:11 +02:00
parent 130c4e72e0
commit 27b342a5e7
+17 -6
View File
@@ -88,6 +88,8 @@ type TCIPanelState struct {
// arrives alongside.
type tciPanel struct {
st TCIPanelState
// logged counts what has been written per message type — see handlePanel.
logged map[string]int
}
// handlePanel takes the messages the console cares about.
@@ -112,12 +114,21 @@ func (t *TCI) handlePanel(name string, get func(int) string, args string) bool {
// this is our reading or its doing, and no amount of reasoning will.
switch name {
case "mute", "sql_enable", "sql_level", "tx_power", "tx_swr", "tune":
// Logged on arrival so an ANSWER can be told from a silence. The
// transmit meters are asked for four times a second while keyed and the
// log showed only the asking, which proves nothing on its own: a reply
// that arrived and failed to parse looks exactly like one that never
// came.
debugLog.Printf("TCI: %s:%s", name, args)
// Logged on arrival so an ANSWER can be told from a SILENCE: the log
// showed the transmit meters being asked for and nothing coming back,
// which on its own proves nothing — a reply that arrived and failed to
// parse leaves exactly the same trace as one that never came.
//
// Capped per message type. The meters are asked for four times a second
// while transmitting, and a diagnostic that fills an evening's log is
// one that gets switched off instead of read.
if t.panel.logged == nil {
t.panel.logged = map[string]int{}
}
if n := t.panel.logged[name]; n < 20 {
t.panel.logged[name] = n + 1
debugLog.Printf("TCI: %s:%s", name, args)
}
}
switch name {
case "protocol":