Skip to content

Commit 925feb8

Browse files
committed
forgotten case for the position sensor
1 parent 1ab6512 commit 925feb8

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/common/base_classes/FOCMotor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ int FOCMotor::alignSensor() {
10521052
position_loop_sensor_direction = Direction::CW;
10531053
}
10541054
}
1055+
if(position_loop_sensor == sensor) position_loop_sensor_direction = sensor_direction;
10551056
// check pole pair number
10561057
pp_check_result = !(fabsf(moved*pole_pairs - _2PI) > 0.5f); // 0.5f is arbitrary number it can be lower or higher!
10571058
if( pp_check_result==false ) {

src/common/base_classes/FOCMotor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ class FOCMotor
315315
* - HallSensor
316316
*/
317317
Sensor* sensor;
318-
Sensor* position_loop_sensor; //!< optional second sensor used only for position control - if not provided the sensor linked with linkSensor will be used for position control as well
318+
Sensor* position_loop_sensor = nullptr; //!< optional second sensor used only for position control - if not provided the sensor linked with linkSensor will be used for position control as well
319319

320320
//!< CurrentSense link
321321
CurrentSense* current_sense;

0 commit comments

Comments
 (0)