Another thought. if the motor is executing a series of commands then create a state machine with one state for each step. switch/case is useful for this as you can have "delay" states that use use millis() for timing and read inputs outside of the state machine in the loop() function.