Skip to content

Commit 461ed57

Browse files
committed
shaft angle addded: forgotten the sensor direction
1 parent a64162c commit 461ed57

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/BLDCMotor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int BLDCMotor::initFOC( float zero_electric_offset, Direction _sensor_direction
102102
exit_flag *= alignSensor();
103103
// added the shaft_angle update
104104
sensor->update();
105-
shaft_angle = sensor->getAngle();
105+
shaft_angle = shaftAngle();
106106
}else if(monitor_port) monitor_port->println(F("MOT: No sensor."));
107107

108108
// aligning the current sensor - can be skipped
@@ -270,7 +270,6 @@ void BLDCMotor::loopFOC() {
270270
// This function will not have numerical issues because it uses Sensor::getMechanicalAngle()
271271
// which is in range 0-2PI
272272
electrical_angle = electricalAngle();
273-
274273
switch (torque_controller) {
275274
case TorqueControlType::voltage:
276275
// no need to do anything really

0 commit comments

Comments
 (0)