SwitecX12 library for microstepper + ESP32

Hi all,

Im using a switec x27.168 stepper motor for a project Im working. Running this stepper straight from the arduino pins, I did not find it was smooth enough, so I followed the advice here:
https://guy.carpenter.id.au/gaugette/2017/04/29/switecx25-quad-driver-tests/
And bought some AX1201728SG microstepping controllers with 12 microsteps per step.

I also use his switecX12 library to drive it. Using an arduino uno/nano, this combination works very well, its very smooth, Im quite happy with this:

However, my project needs a ESP32, and then I run in to problems. When I compile the 'hello world' sample code on gaugette blog, which moves the needle back and forth without using acceleration or the X12 library, it still works. Not perfect, but the same as on an arduino. But when using the X12 library, after zeroing, the stepper keeps running CCW (slowly). Here is a video where you see it first running 'hello world'. Then I try the X12 sample code, and it goes quite wrong:

Ive tried different pins, I tried to adjust acceleration settings and some timing parameters, but all to no avail. I suspect it has something to do with the timers being used, but I cant see a solution. Does anyone have any ideas?

Solved it. Its the same problem and solution as described in this pull request:

Interesting stuff, I'm also thinking about going the AX route. Actually I don't really mind the motion all that much going from one number to the next sporadically but I will use it as a temperature gauge and somehow, even with averaging, the x27 tremors wildly in a very small working area. As the temperature of a car normally will not fluctuate that much the trembling of the needle and the accompanied noise are quite irritating.