Fattoresaimon / ArduinoDuPPaLib

Libraries for DuPPa products on the Arduino IDE
GNU General Public License v3.0
41 stars 24 forks source link

Econder diagnostic question #8

Open u4mzu4 opened 4 years ago

u4mzu4 commented 4 years ago

Hello! I'm looking forward some diagnostic solution for this i2cEncoder, basically the I2C bus is already covered. Since I couldn't find any CRC or inverse stored register, how can I catch any HW failure? The best I've come up with:

int encoderErrorcounter; while (0 == Encoder.readCounterInt()) { encoderErrorcounter++; Encoder.writeCounter((int32_t)65535); if (encoderErrorcounter >= 5) { Serial.println("Encoder error!"); break; } }

Is there a better way? Or any hints welcome... Best regards, Andras