Changed initial motor setpoint to the current angle, so that motor doesn't make a violent move on startup

This commit is contained in:
copper280z
2024-01-13 12:58:35 -05:00
parent 8ee5d11fe5
commit 5554a35eea

View File

@@ -265,7 +265,10 @@ uint8_t configureFOC(void)
// SERIALPORT.printf("Current Sense init result: %i\n", ret);
// motor.linkCurrentSense(&currentsense);
motor.target = 10;
sensor.update();
float start_angle = motor.shaftAngle();
motor.target = start_angle;
SIMPLEFOC_DEBUG("Setting Motor target to current position");
motor.zero_electric_angle = NOT_SET;
motor.sensor_direction = Direction::UNKNOWN;