Your system uses the commands "FILTER0", "FILTER1" etc to control your motor.
But the only useful information in those commands is the 0 and the 1. The letters "FILTER" are just a waste of time.
I would modify the code so it just needs to send (and receive) a single number or character to determine what action to take.
Then it will probably be easier to figure out why some commands are not being interpreted properly.
...R