Skip to content

Commit afdbd9d

Browse files
committed
apply fix to stepper motor logic as well
1 parent d4e1c2c commit afdbd9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/StepperMotor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ StepperMotor::StepperMotor(int pp, float _R, float _KV, float _inductance)
1616
phase_resistance = _R;
1717
// save back emf constant KV = 1/K_bemf
1818
// usually used rms
19-
KV_rating = _KV*_SQRT2;
19+
KV_rating = _KV;
2020
// save phase inductance
2121
phase_inductance = _inductance;
2222

@@ -292,7 +292,7 @@ void StepperMotor::move(float new_target) {
292292
if(_isset(new_target) ) target = new_target;
293293

294294
// calculate the back-emf voltage if KV_rating available U_bemf = vel*(1/KV)
295-
if (_isset(KV_rating)) voltage_bemf = shaft_velocity/KV_rating/_RPM_TO_RADS;
295+
if (_isset(KV_rating)) voltage_bemf = shaft_velocity/(KV_rating*_SQRT3)/_RPM_TO_RADS;
296296
// estimate the motor current if phase reistance available and current_sense not available
297297
if(!current_sense && _isset(phase_resistance)) current.q = (voltage.q - voltage_bemf)/phase_resistance;
298298

0 commit comments

Comments
 (0)