Skip to content

Commit 4acf3d6

Browse files
committed
voltage and current limiting handling bug #118
1 parent 396cffd commit 4acf3d6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/BLDCMotor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ void BLDCMotor::init() {
4242
// current control loop controls voltage
4343
PID_current_q.limit = voltage_limit;
4444
PID_current_d.limit = voltage_limit;
45+
}
46+
if(_isset(phase_resistance) || torque_controller != TorqueControlType::voltage){
4547
// velocity control loop controls current
4648
PID_velocity.limit = current_limit;
47-
}else if(!current_sense && _isset(phase_resistance)){
48-
PID_velocity.limit = current_limit;
4949
}else{
50+
// velocity control loop controls the voltage
5051
PID_velocity.limit = voltage_limit;
5152
}
5253
P_angle.limit = velocity_limit;

src/common/defaults.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define DEF_CURR_FILTER_Tf 0.005f //!< default currnet filter time constant
2929
#endif
3030
// default current limit values
31-
#define DEF_CURRENT_LIM 0.2f //!< 2Amps current limit by default
31+
#define DEF_CURRENT_LIM 2.0f //!< 2Amps current limit by default
3232

3333
// default monitor downsample
3434
#define DEF_MON_DOWNSMAPLE 100 //!< default monitor downsample

0 commit comments

Comments
 (0)