Fix Send gauges showing intensity, zero when idle
- Send gauges now show waveform intensity (0-100) not strength ceiling - State.LastIntensityA/B tracks average intensity per tick - Zero when no pattern/stream active (was 25 due to IntensityOff 101 sentinel) - Recv gauges unchanged (device-reported strength 0-200)
This commit is contained in:
@@ -17,6 +17,7 @@ public class State
|
||||
|
||||
public int ActualA, ActualB;
|
||||
public int LastSentA, LastSentB;
|
||||
public int LastIntensityA, LastIntensityB;
|
||||
|
||||
public int MaxStrength = 200;
|
||||
public LimitMode LimitMode = LimitMode.Clamp;
|
||||
@@ -105,9 +106,14 @@ public class State
|
||||
DirtyA = false;
|
||||
DirtyB = false;
|
||||
|
||||
bool hasA = !StreamA.IsEmpty || (LoopFreqA != null && LoopIntA != null);
|
||||
bool hasB = !StreamB.IsEmpty || (LoopFreqB != null && LoopIntB != null);
|
||||
var (freqA, intA) = PopWave(StreamA, LoopFreqA, LoopIntA);
|
||||
var (freqB, intB) = PopWave(StreamB, LoopFreqB, LoopIntB);
|
||||
|
||||
LastIntensityA = hasA ? (intA[0] + intA[1] + intA[2] + intA[3]) / 4 : 0;
|
||||
LastIntensityB = hasB ? (intB[0] + intB[1] + intB[2] + intB[3]) / 4 : 0;
|
||||
|
||||
return (modeA, valA, modeB, valB, freqA, intA, freqB, intB);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user