fix(kpa): a settings save must not flick the KPA500's power switch — and the maps stay under the menus
startAmps tore down and rebuilt every amplifier client on any settings save, and closing a COM port makes the Windows driver drop DTR/RTS. On a KPA500 those lines ARE the power switch — so 'save' meant 'amplifier off twenty seconds later', exactly F1TPL's report, and the fix that held the lines while OPEN couldn't survive a close. An amplifier whose config is unchanged now keeps its running client across saves; the others still rebuild. Also: isolate on the FT Map panel — Leaflet's z-1000 panes were painting over the menu bar and the Preferences dialog, as the grid map's own comment warned.
This commit is contained in:
@@ -18677,19 +18677,51 @@ func (a *App) startAmps() {
|
||||
old := a.ampInsts
|
||||
a.ampInsts = map[string]*ampInst{}
|
||||
a.ampsMu.Unlock()
|
||||
for _, inst := range old {
|
||||
a.pgxl, a.spe, a.acom = nil, nil, nil
|
||||
list, err := a.GetAmplifiers()
|
||||
if err != nil {
|
||||
for _, inst := range old {
|
||||
go inst.stopAll()
|
||||
}
|
||||
return
|
||||
}
|
||||
// An amplifier whose configuration did not change keeps its RUNNING client
|
||||
// across a settings save. Rebuilding closes the serial port, and closing a
|
||||
// COM port makes the Windows driver drop DTR/RTS — which on a KPA500 is the
|
||||
// POWER SWITCH: every save of any Settings page was switching the amplifier
|
||||
// off (F1TPL's report). Reuse also spares the other amps a reconnect blink.
|
||||
reused := map[string]bool{}
|
||||
for _, c := range list {
|
||||
if !c.Enabled {
|
||||
continue
|
||||
}
|
||||
if o, ok := old[c.ID]; ok && o.cfg == c {
|
||||
reused[c.ID] = true
|
||||
if o.pgxl != nil && a.pgxl == nil {
|
||||
a.pgxl = o.pgxl
|
||||
}
|
||||
if o.spe != nil && a.spe == nil {
|
||||
a.spe = o.spe
|
||||
}
|
||||
if o.acom != nil && a.acom == nil {
|
||||
a.acom = o.acom
|
||||
}
|
||||
a.ampsMu.Lock()
|
||||
a.ampInsts[c.ID] = o
|
||||
a.ampsMu.Unlock()
|
||||
}
|
||||
}
|
||||
for id, inst := range old {
|
||||
if reused[id] {
|
||||
continue
|
||||
}
|
||||
// Stop() can block up to the dial timeout waiting for an in-progress
|
||||
// connect; tear down in the background so saving Settings (this runs on
|
||||
// the Wails RPC goroutine) doesn't freeze the UI.
|
||||
go inst.stopAll()
|
||||
}
|
||||
a.pgxl, a.spe, a.acom = nil, nil, nil
|
||||
list, err := a.GetAmplifiers()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, c := range list {
|
||||
if !c.Enabled {
|
||||
if !c.Enabled || reused[c.ID] {
|
||||
continue
|
||||
}
|
||||
isPGXL := c.Type == "" || c.Type == "pgxl"
|
||||
|
||||
Reference in New Issue
Block a user