Skip to content

Commit bed08d7

Browse files
committed
index search bugfix
1 parent 0a99d94 commit bed08d7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Therefore this is an attempt to:
2121
> NEXT RELEASE 📢: <span class="simple">Simple<span class="foc">FOC</span>library</span> v2.2.2
2222
> - GenericCurrentSense bugfix and testing
2323
> - bugfix leonardo #170
24+
> - bugfix - no index search after specifying natural direction
2425
> - Odrive example code see `examples/hardware_specific/odrive_example`
2526
> - Low level API restructuring
2627
> - Driver API

src/BLDCMotor.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,13 @@ int BLDCMotor::alignSensor() {
162162
int exit_flag = 1; //success
163163
SIMPLEFOC_DEBUG("MOT: Align sensor.");
164164

165+
// check if sensor needs zero search
166+
if(sensor->needsSearch()) exit_flag = absoluteZeroSearch();
167+
// stop init if not found index
168+
if(!exit_flag) return exit_flag;
169+
165170
// if unknown natural direction
166171
if(!_isset(sensor_direction)){
167-
// check if sensor needs zero search
168-
if(sensor->needsSearch()) exit_flag = absoluteZeroSearch();
169-
// stop init if not found index
170-
if(!exit_flag) return exit_flag;
171172

172173
// find natural direction
173174
// move one electrical revolution forward

0 commit comments

Comments
 (0)