Skip to content

Make the filter state instance data#4

Open
edgar-bonet wants to merge 1 commit intooymotion:masterfrom
edgar-bonet:private-state
Open

Make the filter state instance data#4
edgar-bonet wants to merge 1 commit intooymotion:masterfrom
edgar-bonet:private-state

Conversation

@edgar-bonet
Copy link

@edgar-bonet edgar-bonet commented Apr 15, 2022

The filter state is presently stored in the global variables LPF, HPF and AHF. The fact that these are global means that all instances of EMGFilters share the same state, and thus interact with each other.

This pull request makes this state per-instance data, thus making it possible to use multiple filter instances.

Fixes #3.
Fixes #7.

Note: the patch looks big, but only because the indentation level changed for the methods of FILTER_2nd and FILTER_4th. If displayed as git diff -b, it is a small patch.

In order for multiple instances of EMGFilters to be able to work
independently, they must each store its own state. Make this state
private class members instead of global variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant