forked from lucysrausch/hoverboard-firmware-hack
Add: Condition on motor control calculation
- The motors control calculation is done only if the motor is enabled to correctly initialize the controller.
This commit is contained in:
12
Src/bldc.c
12
Src/bldc.c
@ -142,8 +142,10 @@ void DMA1_Channel1_IRQHandler(void) {
|
||||
rtU_Left.b_hallC = hall_wl;
|
||||
rtU_Left.r_DC = pwml;
|
||||
|
||||
/* Step the controller */
|
||||
BLDC_controller_step(rtM_Left);
|
||||
/* Step the controller if motor is enabled*/
|
||||
if (enable) {
|
||||
BLDC_controller_step(rtM_Left);
|
||||
}
|
||||
|
||||
/* Get motor outputs here */
|
||||
ul = rtY_Left.DC_phaA;
|
||||
@ -171,8 +173,10 @@ void DMA1_Channel1_IRQHandler(void) {
|
||||
rtU_Right.b_hallC = hall_wr;
|
||||
rtU_Right.r_DC = pwmr;
|
||||
|
||||
/* Step the controller */
|
||||
BLDC_controller_step(rtM_Right);
|
||||
/* Step the controller if motor is enabled*/
|
||||
if (enable) {
|
||||
BLDC_controller_step(rtM_Right);
|
||||
}
|
||||
|
||||
/* Get motor outputs here */
|
||||
ur = rtY_Right.DC_phaA;
|
||||
|
Reference in New Issue
Block a user