ProgramFilters.bog (10.7 KB)
- Create the slots above in the ProgramObject (names/types must match).
- inMode (StatusEnum, ordinal 0..7):
0 = Kalman1D
1 = AnomAvg4 (abs(in - avg(prev4)) <= delta → pass in, else anomaly action)
2 = AnomAlt4 (abs(in - in1 + in2 - in3) <= delta → out=avg(in,in1,in2,in3), else anomaly action)
3 = AnomDiff1 (abs(in - in1) <= delta → pass in, else anomaly action)
4 = Median10 (median of 11 samples: current + 10 previous)
5 = Median20 (median of 21 samples: current + 20 previous)
6 = RC (y = y + (in - y)/K, K=1..255)
7 = WinAvg8 (moving average of last 8 samples)
3) inAnomAction (StatusEnum, ordinal 0..4) is used ONLY for modes 1..3 when anomaly detected:
0 = HoldLast (use last out)
1 = MeanPrev4 (use avg(prev4))
2 = Prev1 (use previous sample)
3 = ClampPrev4 (clamp in into [avg(prev4)-delta .. avg(prev4)+delta])
4 = Median10Prev (use median of previous Median10 window; if not ready → MeanPrev4) - History protection: on anomaly, the stored sample is the chosen action output (so spikes do not pollute buffers).
- RC: inK is rounded to int and clamped 1..255. Kalman: Q/R must be >0.
- If inEn=false: out=in and state tracks input. If inReset=true: clear state and out=in for that cycle.
- Runs periodically via Clock.schedule(); change EXEC_PERIOD_MS if needed.
BitToComments
BitToComments.bog (4.0 KB)



