Skip to content

Commit 5231e5e

Browse files
author
Richard Unger
committed
change init logic - remove params from initFOC
1 parent d57d32d commit 5231e5e

File tree

5 files changed

+6
-28
lines changed

5 files changed

+6
-28
lines changed

src/BLDCMotor.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,13 @@ void BLDCMotor::enable()
126126
FOC functions
127127
*/
128128
// FOC initialization function
129-
int BLDCMotor::initFOC( float zero_electric_offset, Direction _sensor_direction) {
129+
int BLDCMotor::initFOC() {
130130
int exit_flag = 1;
131131

132132
motor_status = FOCMotorStatus::motor_calibrating;
133133

134134
// align motor if necessary
135135
// alignment necessary for encoders!
136-
if(_isset(zero_electric_offset)){
137-
// abosolute zero offset provided - no need to align
138-
zero_electric_angle = zero_electric_offset;
139-
// set the sensor direction - default CW
140-
sensor_direction = _sensor_direction;
141-
}
142-
143136
// sensor and motor alignment - can be skipped
144137
// by setting motor.sensor_direction and motor.zero_electric_angle
145138
_delay(500);

src/BLDCMotor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BLDCMotor: public FOCMotor
4949
* Function initializing FOC algorithm
5050
* and aligning sensor's and motors' zero position
5151
*/
52-
int initFOC( float zero_electric_offset = NOT_SET , Direction sensor_direction = Direction::CW) override;
52+
int initFOC() override;
5353
/**
5454
* Function running FOC algorithm in real-time
5555
* it calculates the gets motor angle and sets the appropriate voltages

src/StepperMotor.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,13 @@ void StepperMotor::enable()
9292
FOC functions
9393
*/
9494
// FOC initialization function
95-
int StepperMotor::initFOC( float zero_electric_offset, Direction _sensor_direction ) {
95+
int StepperMotor::initFOC() {
9696
int exit_flag = 1;
9797

9898
motor_status = FOCMotorStatus::motor_calibrating;
9999

100100
// align motor if necessary
101101
// alignment necessary for encoders!
102-
if(_isset(zero_electric_offset)){
103-
// abosolute zero offset provided - no need to align
104-
zero_electric_angle = zero_electric_offset;
105-
// set the sensor direction - default CW
106-
sensor_direction = _sensor_direction;
107-
}
108-
109102
// sensor and motor alignment - can be skipped
110103
// by setting motor.sensor_direction and motor.zero_electric_angle
111104
_delay(500);

src/StepperMotor.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,8 @@ class StepperMotor: public FOCMotor
5454
* and aligning sensor's and motors' zero position
5555
*
5656
* - If zero_electric_offset parameter is set the alignment procedure is skipped
57-
*
58-
* @param zero_electric_offset value of the sensors absolute position electrical offset in respect to motor's electrical 0 position.
59-
* @param sensor_direction sensor natural direction - default is CW
60-
*
6157
*/
62-
int initFOC( float zero_electric_offset = NOT_SET , Direction sensor_direction = Direction::CW) override;
58+
int initFOC() override;
6359
/**
6460
* Function running FOC algorithm in real-time
6561
* it calculates the gets motor angle and sets the appropriate voltages

src/common/base_classes/FOCMotor.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,8 @@ class FOCMotor
104104
* and aligning sensor's and motors' zero position
105105
*
106106
* - If zero_electric_offset parameter is set the alignment procedure is skipped
107-
*
108-
* @param zero_electric_offset value of the sensors absolute position electrical offset in respect to motor's electrical 0 position.
109-
* @param sensor_direction sensor natural direction - default is CW
110-
*
111107
*/
112-
virtual int initFOC(float zero_electric_offset = NOT_SET , Direction sensor_direction = Direction::CW)=0;
108+
virtual int initFOC()=0;
113109
/**
114110
* Function running FOC algorithm in real-time
115111
* it calculates the gets motor angle and sets the appropriate voltages
@@ -209,7 +205,7 @@ class FOCMotor
209205
// sensor related variabels
210206
float sensor_offset; //!< user defined sensor zero offset
211207
float zero_electric_angle = NOT_SET;//!< absolute zero electric angle - if available
212-
Direction sensor_direction = Direction::UNKNOWN; //!< if sensor_direction == Direction::CCW then direction will be flipped to CW
208+
Direction sensor_direction = Direction::CW; //!< default is CW. if sensor_direction == Direction::CCW then direction will be flipped compared to CW. Set to UNKNOWN to set by calibration
213209

214210
/**
215211
* Function providing BLDCMotor class with the

0 commit comments

Comments
 (0)