fix: Flex with multiple slices opened was always showing slice A s-meter.
This commit is contained in:
@@ -37,7 +37,7 @@ type FlexState = {
|
||||
};
|
||||
|
||||
type FlexSlice = { index: number; letter: string; freq_hz: number; mode?: string; band?: string; active: boolean; tx: boolean };
|
||||
type Meter = { id: number; src?: string; name?: string; unit?: string; value: number; lo: number; hi: number };
|
||||
type Meter = { id: number; src?: string; name?: string; unit?: string; slice?: number; value: number; lo: number; hi: number };
|
||||
|
||||
const ZERO: FlexState = {
|
||||
available: false, rf_power: 0, tune_power: 0, tune: false, transmitting: false,
|
||||
@@ -356,7 +356,15 @@ export function FlexPanel({ onCWSpeed, onReportRST }: { onCWSpeed?: (wpm: number
|
||||
// Radio meters (exclude the amplifier's, which we show separately).
|
||||
const radio = (name: string) => meters.find((m) =>
|
||||
(m.name || '').toUpperCase().includes(name) && !(m.src || '').toUpperCase().includes('AMP'));
|
||||
const sig = radio('LEVEL') || radio('SIGNAL');
|
||||
// Per-slice (SLC) meters — S-meter — exist once PER SLICE, so pick the
|
||||
// one for the ACTIVE slice; otherwise we'd always show slice A's level.
|
||||
const activeSlice = (st.slices || []).find((s) => s.active)?.index ?? -1;
|
||||
const sliceMeter = (name: string) => {
|
||||
const m = meters.filter((x) => (x.name || '').toUpperCase().includes(name) && !(x.src || '').toUpperCase().includes('AMP'));
|
||||
if (m.length === 0) return undefined;
|
||||
return m.find((x) => (x.src || '').toUpperCase().includes('SLC') && x.slice === activeSlice) || m[0];
|
||||
};
|
||||
const sig = sliceMeter('LEVEL') || sliceMeter('SIGNAL');
|
||||
const fwd = radio('FWDPWR');
|
||||
const swr = radio('SWR');
|
||||
// Mic input level + speech-compression (voltage & PA temp live in the
|
||||
|
||||
@@ -321,7 +321,6 @@ function EditDialog({
|
||||
<Label>{t('udpp.name')}</Label>
|
||||
<Input
|
||||
autoFocus
|
||||
placeholder={draft.direction === 'inbound' ? t('udpp.namePhInbound') : t('udpp.namePhOutbound')}
|
||||
value={draft.name}
|
||||
onChange={(e) => setDraft((d) => ({ ...d, name: e.target.value }))}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user