I'm stuck on figuring out how to actively choose a new speed and have my motors accel/decel from current to the new speed. The code below ramps up to the right speed, but on the new speed command it pops to Zero then starts the second speed. I suspect the delays are part of the issue, but still unsure how to resolve.

My goal will be to have 10x motors spinning at their own constant speed. When a new set of speeds are received, each motor will adjust to their new desired RPM.

thanks for any help!

Code:
#include <StepControl.h>

Stepper motor_1(10, 9);         // STEP pin: 10, DIR pin: 9
Stepper motor_2(5, 9);         // STEP pin: 5, DIR pin: 9
StepControl<> controller;    // Use default settings 

void setup(){
  motor_1
    .setPullInSpeed(800)
    .setAcceleration(40000); //lower = slow. ?won't go above max speed
}

void loop() {

  motor_1.setMaxSpeed(4000);
  controller.rotateAsync(motor_1);    // Do the move
  delay(10000); //how long to run for. at time, start decel
  
  motor_1.setMaxSpeed(400);
  controller.rotateAsync(motor_1, motor_2);    // Do the move
  delay(5000);
}