Millis() not working

Try this code and you will see the problem.

  do {
    stepper17.runSpeedToPosition();
    Serial.println(stepper17.distanceToGo());
  } while (stepper17.distanceToGo() != 3520);

The do..while executes once, presumably because the accelstepper library had not yet updated the value of distanceToGo, so that it is still equal to 3520.
After that, the loop starts over, and the stepper moves until distanceToGo() is zero, at which point the do..while loop will never exit.