Skip to content

Commit f375324

Browse files
committed
Fix transient encoder error when error checking enabled
1 parent ca06135 commit f375324

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/hal/drivers/mesa-hostmot2/encoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static void hm2_encoder_read_control_register(hostmot2_t *hm2) {
138138
e->reset_quadrature_error = 1;
139139
hm2_encoder_force_write(hm2);
140140
}
141-
int state = (hm2->encoder.read_control_reg[i] & HM2_ENCODER_CONTROL_MASK) & HM2_ENCODER_QUADRATURE_ERROR;
141+
int state = ((hm2->encoder.read_control_reg[i] & HM2_ENCODER_CONTROL_MASK) & HM2_ENCODER_QUADRATURE_ERROR) && e->prev_quadrature_error_enable;
142142
if ((*e->hal.pin.quadrature_error == 0) && state) {
143143
HM2_ERR("Encoder %d: quadrature count error\n", i);
144144
}

0 commit comments

Comments
 (0)