fix: PGXL status-bar chip and Station Control widget read OPERATE from the Flex when it reports the amp (the direct GSCP status doesn't carry operate state) — toggle then goes through FlexAmpOperate like the Flex panel; direct TCP link stays as fallback; log distinct raw PGXL status payloads to map unknown fields
This commit is contained in:
+22
-3
@@ -44,6 +44,7 @@ import {
|
||||
GetUIPref, GetActiveProfile, QuitApp,
|
||||
ReportLiveActivity, LiveLastQSOAgeSec,
|
||||
GetPGXLSettings, GetPGXLStatus, GetSPEStatus, GetACOMStatus, SPESetOperate, ACOMSetOperate, PGXLSetOperate,
|
||||
GetFlexState, FlexAmpOperate,
|
||||
} from '../wailsjs/go/main/App';
|
||||
import { Combobox } from '@/components/ui/combobox';
|
||||
import { applyAwardRefs } from '@/lib/awardRefs';
|
||||
@@ -452,8 +453,26 @@ export default function App() {
|
||||
useEffect(() => {
|
||||
if (!ampCfg.enabled) { setAmpSt({ connected: false }); return; }
|
||||
let alive = true;
|
||||
const get = ampCfg.type === 'pgxl' ? GetPGXLStatus : ampCfg.type.startsWith('acom') ? GetACOMStatus : GetSPEStatus;
|
||||
const tick = () => get().then((s: any) => alive && setAmpSt(s || { connected: false })).catch(() => {});
|
||||
// PGXL: the Flex reports the amp's OPERATE state authoritatively (the direct
|
||||
// GSCP status doesn't carry it), so merge GetFlexState in when a Flex sees
|
||||
// the amp — state AND toggle then go through the radio; the direct TCP link
|
||||
// remains the fallback (fan mode always uses it).
|
||||
const tick = ampCfg.type === 'pgxl'
|
||||
? () => Promise.all([
|
||||
GetPGXLStatus().catch(() => ({ connected: false })),
|
||||
GetFlexState().catch(() => null),
|
||||
]).then(([pg, fx]: any[]) => {
|
||||
if (!alive) return;
|
||||
const viaFlex = !!fx?.amp_available;
|
||||
setAmpSt({
|
||||
...(pg || {}),
|
||||
connected: !!pg?.connected || viaFlex,
|
||||
operate: viaFlex ? !!fx.amp_operate : !!pg?.operate,
|
||||
via_flex: viaFlex,
|
||||
});
|
||||
})
|
||||
: () => (ampCfg.type.startsWith('acom') ? GetACOMStatus : GetSPEStatus)()
|
||||
.then((s: any) => alive && setAmpSt(s || { connected: false })).catch(() => {});
|
||||
tick();
|
||||
const id = window.setInterval(tick, 2000);
|
||||
return () => { alive = false; window.clearInterval(id); };
|
||||
@@ -5160,7 +5179,7 @@ export default function App() {
|
||||
if (!ampSt.connected) { setSettingsSection('pgxl'); setShowSettings(true); return; }
|
||||
const want = !ampSt.operate;
|
||||
setAmpSt((s: any) => ({ ...s, operate: want }));
|
||||
(isPGXL ? PGXLSetOperate(want)
|
||||
(isPGXL ? (ampSt.via_flex ? FlexAmpOperate(want) : PGXLSetOperate(want))
|
||||
: ampCfg.type.startsWith('acom') ? ACOMSetOperate(want)
|
||||
: SPESetOperate(want)).catch(() => {});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user