Emergency stop with AccelStepper

As i am trying to include a emergency stop imy sketch i do ran into a problem with the AccelStepper libray.

It has the function stepper.stop() with stops the stepper as fast as possible.
In m.h.o. that would be a direct stop as i want to use it as a emergency stop if the movement runs into a limit switch.
But is doesn't, its slows down and then stops.

Any suggestions how to solve this problem?

Harry

Set the acceleration to a high value before calling stop?

Do you want an orderly stop so that the stepper position can be known or do you want a crash stop and never mind losing the position.

If the latter perhaps you could toggle the enable pin on the driver board.

...R