void loop ()
{
// Handling the steps of one motor
if ( (millis () - Steptimer) >= Stepinterval)
digitalWrite(solenoidPin, HIGH); //Switch Solenoid ON
digitalWrite(dirPin, HIGH);
MoveStepper ();
digitalWrite(solenoidPin, LOW); //Switch Solenoid OFF
} // end of loop
another
if(micros()-StepperTime > StepInterval)
{
ToolJustChanged=HandleGrayCode(); //Check before we step. Last step may have been the one that changed tools.
ExecuteStep();
StepperTime=micros();
}
https://forum.arduino.cc/t/replacing-delay-between-steps/973689/17
esp32 gcode interpreter with delay()