If you change motor speed during a runForward or runBackward move on an ESP32-S3, the motor won't begin ramping to the next speed until the next step of the currently applied speed.
This is a problem when changing from very slow to very fast speeds, where a single motor step could take ~10s. In the attached example, there's a ~10s delay before the motor starts moving at the desired 500 steps/sec. I'd expect it to start moving at 500 steps/sec basically instantly.
#include <Arduino.h>
#include "FastAccelStepper.h"
#define PIN_M1_EN 4
#define PIN_M1_STP 17
#define PIN_M1_DIR 18
FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper *x = NULL;
void setup() {
Serial.begin(115200);
engine.init();
x = engine.stepperConnectToPin(PIN_M1_STP, FasDriver::RMT);
if (x)
{
x->setDirectionPin(PIN_M1_DIR);
x->setEnablePin(PIN_M1_EN);
x->setAutoEnable(true);
x->enableOutputs();
x->setSpeedInHz(500); // 500 steps/s
x->setAcceleration(500);
}
Serial.println("Starting...\n");
x->setSpeedInMilliHz(100);
x->runForward();
delay(10);
x->setSpeedInHz(500);
x->runForward();
}
void loop() {}
If you change motor speed during a
runForwardorrunBackwardmove on an ESP32-S3, the motor won't begin ramping to the next speed until the next step of the currently applied speed.This is a problem when changing from very slow to very fast speeds, where a single motor step could take ~10s. In the attached example, there's a ~10s delay before the motor starts moving at the desired 500 steps/sec. I'd expect it to start moving at 500 steps/sec basically instantly.