Stepper motor with accelerometer! problem!

Can you explain in English what your complex IF statement is intended to do?

...R