diff --git a/app.go b/app.go index 7892297..bd5d564 100644 --- a/app.go +++ b/app.go @@ -814,6 +814,33 @@ func (a *App) startup(ctx context.Context) { a.lookup = lookup.NewManager(a.cache) a.reloadLookupProviders() + // CAT manager: emit pushes state to the frontend via Wails events, and + // forwards frequency/mode to any outbound UDP emitters (PstRotator, N1MM). + // Started HERE — before the (possibly slow, remote) MySQL logbook connect + // below — because the rig link only needs the local settings, and blocking it + // behind a 10–30s MySQL dial made the FlexRadio (and every CAT backend) take + // that long to come up at launch. + a.cat = cat.NewManager(func(s cat.RigState) { + // DIAGNOSTIC: the manager only fires this on a USER-relevant change, so a + // burst of these lines = the frontend is being re-rendered rapidly (the + // "screen flickers" symptom). Shows WHAT is churning — connection flap, + // or freq/split/mode oscillating between slices during FT8. + applog.Printf("cat:state → connected=%v freq=%d rx=%d split=%v mode=%s band=%s", + s.Connected, s.FreqHz, s.RxFreqHz, s.Split, s.Mode, s.Band) + if a.ctx != nil { + wruntime.EventsEmit(a.ctx, "cat:state", s) + } + a.emitRadioUDP(s) + // Drive station relays by the current frequency/band (PstRotator-style + // automatic control). Cheap cached-flag check keeps this a no-op when the + // feature is off; when on, run off this callback so a slow relay board never + // stalls rig-state processing. + if a.relayAutoOn.Load() { + go a.applyRelayAuto(s.FreqHz, s.Band) + } + }) + a.reloadCAT() + // The QSO logbook lives where the ACTIVE PROFILE points it: the local SQLite // file, or a per-profile shared MySQL database. Switching profiles switches // the logbook (see switchLogbook). One-time: adopt any legacy config.json @@ -908,28 +935,6 @@ func (a *App) startup(ctx context.Context) { fmt.Printf("OpsLog: clublog cty.xml loaded — %d exceptions (%s)\n", n, d) } }() - // CAT manager: emit pushes state to the frontend via Wails events, and - // forwards frequency/mode to any outbound UDP emitters (PstRotator, N1MM). - a.cat = cat.NewManager(func(s cat.RigState) { - // DIAGNOSTIC: the manager only fires this on a USER-relevant change, so a - // burst of these lines = the frontend is being re-rendered rapidly (the - // "screen flickers" symptom). Shows WHAT is churning — connection flap, - // or freq/split/mode oscillating between slices during FT8. - applog.Printf("cat:state → connected=%v freq=%d rx=%d split=%v mode=%s band=%s", - s.Connected, s.FreqHz, s.RxFreqHz, s.Split, s.Mode, s.Band) - if a.ctx != nil { - wruntime.EventsEmit(a.ctx, "cat:state", s) - } - a.emitRadioUDP(s) - // Drive station relays by the current frequency/band (PstRotator-style - // automatic control). Cheap cached-flag check keeps this a no-op when the - // feature is off; when on, run off this callback so a slow relay board never - // stalls rig-state processing. - if a.relayAutoOn.Load() { - go a.applyRelayAuto(s.FreqHz, s.Band) - } - }) - a.reloadCAT() // POTA: background poller of api.pota.app so cluster spots can be tagged // when the DX station is currently activating a park. Best-effort.