File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -393,6 +393,9 @@ void BLDCMotor::loopFOC() {
393
393
// - if target is not set it uses motor.target value
394
394
void BLDCMotor::move (float new_target) {
395
395
396
+ // set internal target variable
397
+ if (_isset (new_target)) target = new_target;
398
+
396
399
// downsampling (optional)
397
400
if (motion_cnt++ < motion_downsample) return ;
398
401
motion_cnt = 0 ;
@@ -410,8 +413,6 @@ void BLDCMotor::move(float new_target) {
410
413
411
414
// if disabled do nothing
412
415
if (!enabled) return ;
413
- // set internal target variable
414
- if (_isset (new_target)) target = new_target;
415
416
416
417
// calculate the back-emf voltage if KV_rating available U_bemf = vel*(1/KV)
417
418
if (_isset (KV_rating)) voltage_bemf = shaft_velocity/(KV_rating*_SQRT3)/_RPM_TO_RADS;
Original file line number Diff line number Diff line change @@ -283,6 +283,9 @@ void StepperMotor::loopFOC() {
283
283
// - if target is not set it uses motor.target value
284
284
void StepperMotor::move (float new_target) {
285
285
286
+ // set internal target variable
287
+ if (_isset (new_target) ) target = new_target;
288
+
286
289
// downsampling (optional)
287
290
if (motion_cnt++ < motion_downsample) return ;
288
291
motion_cnt = 0 ;
@@ -301,8 +304,6 @@ void StepperMotor::move(float new_target) {
301
304
// if disabled do nothing
302
305
if (!enabled) return ;
303
306
304
- // set internal target variable
305
- if (_isset (new_target) ) target = new_target;
306
307
307
308
// calculate the back-emf voltage if KV_rating available U_bemf = vel*(1/KV)
308
309
if (_isset (KV_rating)) voltage_bemf = shaft_velocity/(KV_rating*_SQRT3)/_RPM_TO_RADS;
You can’t perform that action at this time.
0 commit comments