Having written high-order IIR biquad filters of my own, implemented in real-time by slow, low-powered ATMega32U4 AVR chips at 8MHz, this really seems easy and extremely useful for any pocekt scope. Uses include cleaning up 60Hz noise, determining whether a dedicated hardware filter is warranted in a circuit, detecting low-level oscillation/ringing, or even simply clarifying whether a particular circuit works at all.
Please, please, please consider integrating something like the following into BenF firmware 3.64. Please.
github.com/mirage335/Mirage335B … rmware.ino
//Macro function for low pass filter.
//Overuse can cause data and precision loss, especially with non-float variables.
#define lowPass(newValue, filteredValue, inertiaFloat) \
filteredValue = filteredValue + (inertiaFloat * (newValue - filteredValue));
//IIR Biquad Filter.
//Parameters b0, b1, b2, a1, a2 are filter coefficients. See http://gnuradio.4.n7.nabble.com/IIR-filter-td40994.html and http://www.earlevel.com/main/2013/10/13/biquad-calculator-v2/ .
//Data is returned in the float named [filteredValue] . This variable must be externally declared.
//State variables unique_d1_name and unique_d2_name should be statically declared floats.
#define IIRbiquad(newValue, filteredValue, unique_d1_name, unique_d2_name, b0, b1, b2, a1, a2) \
\
filteredValue = b0 * newValue + unique_d1_name; \
unique_d1_name = (float)b1 * (float)newValue + (float)a1 * filteredValue + unique_d2_name; \
unique_d2_name = (float)b2 * (float)newValue + (float)a2 * filteredValue;
//High Order IIR Biquad Filter.
//Parameters b0, b1, b2, a1, a2 are filter coefficients. See http://gnuradio.4.n7.nabble.com/IIR-filter-td40994.html and http://www.earlevel.com/main/2013/10/13/biquad-calculator-v2/ .
//Data is returned in the float named [filteredValue] .
#define highOrderIIRbiquad(newValue, filteredValue, stateOneArrayName, stateTwoArrayName, b0, b1, b2, a1, a2, filterOrder) \
static float stateOneArrayName[(filterOrder+1)]; \
static float stateTwoArrayName[(filterOrder+1)]; \
lowerOrderFilteredValue = newValue; \
\
for (filterLoop=0; filterLoop < filterOrder; filterLoop++) { \
IIRbiquad(lowerOrderFilteredValue, filteredValue, stateOneArrayName[filterLoop], stateTwoArrayName[filterLoop], b0, b1, b2, a1, a2) \
lowerOrderFilteredValue = filteredValue; \
}