fix(icom net): a sleeping rig keeps its session, and the console is reachable

From an operator's log: an IC-7760 in standby, and OpsLog dialling and
dropping every forty seconds for as long as it was left there — control
link up, login OK, token renewed, and not one CI-V answer.

lastGoodAt bounds "the link answers but no CI-V comes back". It belongs
to a session and was never cleared when a new one opened, so a rig that
went to standby half an hour ago handed every fresh session a
half-hour-old last good read: past the grace before the first command was
even sent. Torn down at once, redialled twenty seconds later, torn down
again. Cleared on connect, the rule reads as it was written — silent
since connect is a rig in standby, and the session is kept so it can be
woken.

The console it is woken from was missing too. It appeared only once the
live CAT state said "icom", which a sleeping rig never says, so the ON
button was absent at the one moment it exists for. It now follows the
CONFIGURED radio — which also had to start following a radio switched
from the status bar, instead of waiting for a trip through Settings and a
Save that changed nothing.
This commit is contained in:
2026-09-06 17:35:53 +02:00
parent 381a7fdc40
commit 507d1f0882
4 changed files with 79 additions and 7 deletions
+6 -2
View File
@@ -4,11 +4,15 @@
"date": "",
"en": [
"FT map: the callsign, square and report show on hover again. The invisible circle that catches the clicks sits on top of the dot, so it takes the hover too — and the label was bound only to the dot underneath, which left the map silent from the moment the stations became clickable.",
"ADIF export: a record is written on one line again. ADDRESS is a multi-line field by the standard and callbooks and other loggers fill it that way — “Kabul”, four blank lines, “Afghanistan” — and OpsLog wrote it out as it was, so a record ran down a dozen lines with the next apparently starting in the middle of the page. Line breaks inside a value are now joined with a comma, which is how an address reads on one line anyway. The files were always valid (ADIF counts bytes); they were unreadable."
"ADIF export: a record is written on one line again. ADDRESS is a multi-line field by the standard and callbooks and other loggers fill it that way — “Kabul”, four blank lines, “Afghanistan” — and OpsLog wrote it out as it was, so a record ran down a dozen lines with the next apparently starting in the middle of the page. Line breaks inside a value are now joined with a comma, which is how an address reads on one line anyway. The files were always valid (ADIF counts bytes); they were unreadable.",
"Icom over the network: a rig left in standby no longer sits in a dial-and-drop loop. The clock that bounds “the control link answers but no CI-V comes back” belongs to a session and was never cleared when a new one opened, so every fresh session started already past its grace — torn down at once, redialled twenty seconds later, and torn down again for as long as the radio was asleep. Silent since connect is now read as what it is: a rig in standby, with the session kept so it can be woken.",
"The Icom console appears whenever the configured radio is an Icom, not only once the rig is talking — the console is where the power-ON button lives, so it used to be missing at the one moment it was needed. The consoles configured backend also follows a radio switched from the status bar, instead of waiting for a trip through Settings and a Save that changed nothing."
],
"fr": [
"Carte FTx : lindicatif, le locator et le report réapparaissent au survol. Le cercle invisible qui capte les clics est au-dessus du point, donc il capte aussi le survol — et l’étiquette n’était liée quau point du dessous, ce qui rendait la carte muette dès que les stations sont devenues cliquables.",
"Export ADIF : un enregistrement tient de nouveau sur une ligne. ADDRESS est un champ multiligne selon la norme, et les callbooks comme les autres logiciels le remplissent ainsi — « Kabul », quatre lignes vides, « Afghanistan » — quOpsLog recopiait tel quel : un enregistrement s’étalait sur une douzaine de lignes, le suivant semblant commencer au milieu de la page. Les retours à la ligne dans une valeur sont désormais réunis par une virgule, ce qui est de toute façon la façon de lire une adresse sur une ligne. Les fichiers étaient valides (lADIF compte les octets) ; ils étaient illisibles."
"Export ADIF : un enregistrement tient de nouveau sur une ligne. ADDRESS est un champ multiligne selon la norme, et les callbooks comme les autres logiciels le remplissent ainsi — « Kabul », quatre lignes vides, « Afghanistan » — quOpsLog recopiait tel quel : un enregistrement s’étalait sur une douzaine de lignes, le suivant semblant commencer au milieu de la page. Les retours à la ligne dans une valeur sont désormais réunis par une virgule, ce qui est de toute façon la façon de lire une adresse sur une ligne. Les fichiers étaient valides (lADIF compte les octets) ; ils étaient illisibles.",
"Icom en réseau : un poste laissé en veille ne tourne plus en boucle connexion/déconnexion. Lhorloge qui borne « la liaison de contrôle répond mais aucun CI-V ne revient » appartient à une session et n’était jamais remise à zéro à louverture de la suivante : chaque nouvelle session démarrait déjà au-delà de son délai de grâce — coupée aussitôt, rappelée vingt secondes plus tard, recoupée, aussi longtemps que la radio dormait. « Silencieux depuis la connexion » se lit désormais pour ce que cest : un poste en veille, dont on garde la session pour pouvoir le réveiller.",
"La console Icom saffiche dès que la radio configurée est un Icom, et pas seulement quand le poste parle — cest là que se trouve le bouton dallumage, il manquait donc au seul moment où il servait. Le backend configuré suit aussi un changement de radio fait depuis la barre d’état, au lieu dattendre un passage dans les réglages et un « Enregistrer » qui ne changeait rien."
]
},
{
+28 -5
View File
@@ -305,8 +305,12 @@ function FreqWheelDisplay({ mhz, onNudge, className, placeholder = '—.——
// pill. The full message stays in the tooltip. Recognises the common cases
// (OmniRig not installed, not registered) and otherwise truncates.
// RadioChip — the CAT status chip, and the radio picker behind it.
function RadioChip({ catUp, catState, onOpenSettings }: {
function RadioChip({ catUp, catState, onOpenSettings, onRadioSwitched }: {
catUp: boolean; catState: any; onOpenSettings: () => void;
// Switching radio here IS a settings change — the chosen entry becomes the CAT
// settings — so whatever reads those has to be told. Two Icoms swapped for one
// another never change the live backend name, and nothing else would notice.
onRadioSwitched?: () => void;
}) {
const [radios, setRadios] = useState<any[]>([]);
const [open, setOpen] = useState(false);
@@ -371,7 +375,7 @@ function RadioChip({ catUp, catState, onOpenSettings }: {
onClick={() => {
setOpen(false);
if (r.active) return;
SetActiveRadio(r.id).then(load).catch(() => {});
SetActiveRadio(r.id).then(() => { load(); onRadioSwitched?.(); }).catch(() => {});
}}
className={cn('flex w-full items-center gap-2 px-2.5 py-1 text-left text-xs hover:bg-muted',
r.active && 'font-semibold text-primary')}
@@ -717,6 +721,15 @@ export default function App() {
// hide the rig ON/OFF buttons on USB, where the interface is unpowered when the
// rig is off so power-ON can't work).
const [catBackend, setCatBackend] = useState('');
// icomConfigured is "this station's radio IS an Icom", from the settings
// rather than from the link.
//
// The console used to appear only once the rig was talking. Switching to an
// Icom that was switched OFF therefore showed no console at all — and the
// console is where the ON button lives, so the one moment the button exists
// for was the one moment it could not be reached.
const icomConfigured = catBackend === 'icom' || catBackend === 'icom-net';
const icomShown = catState.backend === 'icom' || icomConfigured;
// Live space-weather (solar flux / sunspots / A / K) for the header strip.
// Loaded on mount, refreshed on the backend 'solar:update' event, plus a slow
// fallback poll. These same numbers are stamped onto each logged QSO.
@@ -3265,6 +3278,15 @@ export default function App() {
setCatBackend(c.backend ?? '');
} catch {}
}, []);
// The configured backend follows every way the radio can change: the CAT
// panel's Save, a switch from the status bar's radio list, and the link
// itself reporting a different backend. It was read once at launch and after
// a Settings save only — so switching radio from the status bar left the
// console configured for the previous rig, and the Icom power buttons stayed
// hidden until the operator went into Settings and pressed Save for no
// reason.
useEffect(() => { loadCATCfg(); }, [catState.backend, loadCATCfg]);
const loadLists = useCallback(async () => {
try {
const l: ListsSettings = await GetListsSettings();
@@ -8020,7 +8042,7 @@ export default function App() {
</TabsTrigger>
)}
{catState.backend === 'flex' && <TabsTrigger value="flex">Flex Console</TabsTrigger>}
{catState.backend === 'icom' && <TabsTrigger value="icom">Icom Console</TabsTrigger>}
{icomShown && <TabsTrigger value="icom">Icom Console</TabsTrigger>}
{catState.backend === 'yaesu' && <TabsTrigger value="yaesu">Yaesu Console</TabsTrigger>}
{(catState.backend === 'elecraft' || catState.backend === 'kenwood') && <TabsTrigger value="elecraft">{t('k3.console')}</TabsTrigger>}
{catState.backend === 'tci' && <TabsTrigger value="tci">{t('tcip.console')}</TabsTrigger>}
@@ -8796,7 +8818,7 @@ export default function App() {
</TabsContent>
)}
{catState.backend === 'icom' && (
{icomShown && (
<TabsContent value="icom" className="flex-1 min-h-0 p-0">
<IcomPanel isNetwork={catBackend === 'icom-net'} onReportRST={(r) => { setRstSent(r); rstUserEditedRef.current = true; }} />
</TabsContent>
@@ -8967,6 +8989,7 @@ export default function App() {
catUp={catUp}
catState={catState}
onOpenSettings={() => { setSettingsSection('cat'); setShowSettings(true); }}
onRadioSwitched={loadCATCfg}
/>
<Chip
on={rotatorHeading.enabled && rotatorHeading.ok}
@@ -9212,7 +9235,7 @@ export default function App() {
onSaved={onSettingsSaved}
onMainPaneChanged={onSettingsPaneChanged}
flexAvailable={catState.backend === 'flex'}
icomAvailable={catState.backend === 'icom'}
icomAvailable={icomShown}
yaesuAvailable={catState.backend === 'yaesu'}
elecraftAvailable={catState.backend === 'elecraft' || catState.backend === 'kenwood'}
tciAvailable={catState.backend === 'tci'}
+30
View File
@@ -60,3 +60,33 @@ func TestIcomSilenceBackoff(t *testing.T) {
t.Errorf("backoff overshot the ceiling: %s", g)
}
}
// A new session must not be judged on the previous one's silence.
//
// From an operator's log: a rig switched to standby, then a dial-and-drop loop
// every forty seconds for as long as it was left there. lastGoodAt bounds "the
// link answers but no CI-V comes back"; it belongs to a session, and it was
// never cleared when a new one opened, so every fresh session started already
// past the grace — and the Icom console, where the power-ON button lives,
// blinked away on every pass.
func TestAFreshSessionStartsWithACleanSilenceClock(t *testing.T) {
b := &IcomSerial{
lastGoodAt: time.Now().Add(-30 * time.Minute), // a session from before standby
readFails: 9,
silentGrace: icomSilentGraceMax,
}
// What Connect does once the transport is open, before anything is sent.
b.lastGoodAt = time.Time{}
b.readFails = 0
b.silentGrace = icomSilentGrace
if !b.lastGoodAt.IsZero() {
t.Fatal("the previous session's last good read survived into this one")
}
tolerate := func(lastGood time.Time, silentFor, grace time.Duration) bool {
return lastGood.IsZero() || silentFor < grace
}
if !tolerate(b.lastGoodAt, time.Hour, b.silentGrace) {
t.Error("a session silent since connect was torn down — that is a rig in standby, and where the ON button has to work")
}
}
+15
View File
@@ -232,6 +232,21 @@ func (b *IcomSerial) Connect() error {
_ = port.SetRTS(false)
b.port = port
b.model = civ.ModelName(b.rigAddr)
// A NEW SESSION IS NOT JUDGED ON THE OLD ONE'S SILENCE.
//
// lastGoodAt bounds "the control link answers but no CI-V comes back". It
// belongs to a session, and it was never cleared when a new one opened —
// so a rig that went to standby half an hour ago handed every fresh session
// a half-hour-old "last good read", which is past the grace before the first
// command is even sent. The session was torn down at once, redialled twenty
// seconds later, and torn down again: a loop with no way out, and the Icom
// console (with its power-ON button) blinking away on every pass.
//
// Cleared, the rule reads as it was written: silent since connect is a rig in
// standby, and the session is kept so the operator can wake it.
b.lastGoodAt = time.Time{}
b.readFails = 0
b.silentGrace = icomSilentGrace
// Start the reader before any request: recv() now waits on respCh, which only
// the reader feeds. respCh is buffered so a burst (or the scope stream) never