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,8 +142,10 @@ void DMA1_Channel1_IRQHandler(void) {
rtU_Left.b_hallC = hall_wl;
rtU_Left.r_DC = pwml;
/* Step the controller */
/* 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 */
/* Step the controller if motor is enabled*/
if (enable) {
BLDC_controller_step(rtM_Right);
}
/* Get motor outputs here */
ur = rtY_Right.DC_phaA;