Momentary buttons and wifi

In the very beginning of loop Your code steps the motor.
Later, down in the code moveCurtain etc. is also stepping the motor.
This looks wrong to me.