mirror of https://github.com/rusefi/bldc.git
filter out zero encoder reading - can be caused by gnd short
This commit is contained in:
parent
8cc3ea519a
commit
e70be9e17a
|
@ -334,7 +334,7 @@ void encoder_tim_isr(void) {
|
|||
spi_end();
|
||||
|
||||
spi_val = pos;
|
||||
if(spi_check_parity(pos) && pos!=0xffff) {
|
||||
if(spi_check_parity(pos) && pos!=0xffff && pos!=0) { // all ones = disconnect, all zeros = short to gnd
|
||||
pos &= 0x3FFF;
|
||||
last_enc_angle = ((float)pos * 360.0) / 16384.0;
|
||||
UTILS_LP_FAST(spi_error_rate, 0.0, 1./AS5047_SAMPLE_RATE_HZ);
|
||||
|
|
Loading…
Reference in New Issue