Im 90% sure the issue is in the implementation of the digitalPulse function for the ESP32.
Im having very similiar issues with trying to drive a servo(LDX218) with ESP32 and Espruino. Im using the Espruino servo tutorial here . Having tried the servo module and using the digitalPulse command directly on its own and in setInterval().
Im 90% sure the issue is in the implementation of the digitalPulse function for the ESP32. I have put a logic analyser on the pulsed pin and it seems the pulse width is always about 600us in response to a digitalPulse(D4,1,x) command no matter what the value of x. Where x should be the length of the pulse in milli seconds. I should really compare to the output of digitalpulse on an espruino Pico to be 100%.
Ive also put the anayser on a servo test board, so can compare to a pulse signal that works.
@JumJum explains, at the time of implementation, in the docs here, that the function was not 100% tested. So maybe never worked or something has changed.
Any way it needs further investigation. The digitalPulse function code is here. And the ESP32 RTM functionality the code uses is described here . This RTM doc may be better explainations with examples than was available at the original implementation so maybe comparing to examples would find the issue. (also theres a risk examples may not be applicable in our older ESp32 sdk version. )
Any help appreciated, I was trying to sort out what I thought was a relatively easy WIFI servo driver for a PTZ streaming camera for a charity .