Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/BLDCMotor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ void BLDCMotor::loopFOC() {
// - if target is not set it uses motor.target value
void BLDCMotor::move(float new_target) {

// set internal target variable
if(_isset(new_target)) target = new_target;

// downsampling (optional)
if(motion_cnt++ < motion_downsample) return;
motion_cnt = 0;
Expand All @@ -410,8 +413,6 @@ void BLDCMotor::move(float new_target) {

// if disabled do nothing
if(!enabled) return;
// set internal target variable
if(_isset(new_target)) target = new_target;

// calculate the back-emf voltage if KV_rating available U_bemf = vel*(1/KV)
if (_isset(KV_rating)) voltage_bemf = shaft_velocity/(KV_rating*_SQRT3)/_RPM_TO_RADS;
Expand Down
5 changes: 3 additions & 2 deletions src/StepperMotor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ void StepperMotor::loopFOC() {
// - if target is not set it uses motor.target value
void StepperMotor::move(float new_target) {

// set internal target variable
if(_isset(new_target) ) target = new_target;

// downsampling (optional)
if(motion_cnt++ < motion_downsample) return;
motion_cnt = 0;
Expand All @@ -301,8 +304,6 @@ void StepperMotor::move(float new_target) {
// if disabled do nothing
if(!enabled) return;

// set internal target variable
if(_isset(new_target) ) target = new_target;

// calculate the back-emf voltage if KV_rating available U_bemf = vel*(1/KV)
if (_isset(KV_rating)) voltage_bemf = shaft_velocity/(KV_rating*_SQRT3)/_RPM_TO_RADS;
Expand Down