Task Scheduler & AccelStepper

Hi everyone, I'm working on a project where I'm using Task Scheduler and AccelStepper libraries.
My problem is that the stepper dont turn but on 28byj-48 driver I can see that 2 of leds are static on.

After some test I discovered that if the stepper part of the code I put in loop its working but not in task callback.

Here is my code

#include <TaskScheduler.h>
#include <AccelStepper.h>

AccelStepper stepper1(AccelStepper::FULL4WIRE, 1, 2, 3, 4);


// Callback methods prototypes
void t1Callback();

//Tasks
Task t1(0, 1, &t1Callback);

Scheduler runner;


void t1Callback() {
    Serial.print("t1: ");
    Serial.println(millis());
  
    stepper1.setMaxSpeed(800.0);
    stepper1.setAcceleration(300.0);
    stepper1.moveTo(512);
    stepper1.run();
}

void setup () {
  Serial.begin(9600);
  runner.init();
  
  runner.addTask(t1);
  Serial.println("added t1");
  
  delay(5000);
  
  t1.enable();
  Serial.println("Enabled t1");
}


void loop () {
  runner.execute();
}

Could you help me please to understand this

The line

stepper1.run();

should be in loop() so it gets called as often as possible.

...R

Robin2:
The line

stepper1.run();

should be in loop() so it gets called as often as possible.

...R

Or, you need to completely rewrite your code to use blocking methods to make the code wait until the stepper has stepped the required number of times.

Which approach you use depends entirely on what value you see the TaskScheduler library adding to your project.