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:
EmanuelFeru
2019-07-01 21:06:01 +02:00
parent 8d21a73a09
commit 4f1348882b

View File

@ -142,9 +142,11 @@ void DMA1_Channel1_IRQHandler(void) {
rtU_Left.b_hallC = hall_wl; rtU_Left.b_hallC = hall_wl;
rtU_Left.r_DC = pwml; rtU_Left.r_DC = pwml;
/* Step the controller */ /* Step the controller if motor is enabled*/
BLDC_controller_step(rtM_Left); if (enable) {
BLDC_controller_step(rtM_Left);
}
/* Get motor outputs here */ /* Get motor outputs here */
ul = rtY_Left.DC_phaA; ul = rtY_Left.DC_phaA;
vl = rtY_Left.DC_phaB; vl = rtY_Left.DC_phaB;
@ -171,8 +173,10 @@ void DMA1_Channel1_IRQHandler(void) {
rtU_Right.b_hallC = hall_wr; rtU_Right.b_hallC = hall_wr;
rtU_Right.r_DC = pwmr; rtU_Right.r_DC = pwmr;
/* Step the controller */ /* Step the controller if motor is enabled*/
BLDC_controller_step(rtM_Right); if (enable) {
BLDC_controller_step(rtM_Right);
}
/* Get motor outputs here */ /* Get motor outputs here */
ur = rtY_Right.DC_phaA; ur = rtY_Right.DC_phaA;