pyokagan / DanceDance

0 stars 0 forks source link

taskI2C does not detect transmission errors #5

Open pyokagan opened 7 years ago

pyokagan commented 7 years ago

taskI2C does not detect I2C transmission errors. Instead, it will just return junk data.

This is because the MPU6050 library does not pass any errors from the I2CDev library to us, so we'll need to modify the MPU6050 library to do that.

We'll decide on how to properly handle the errors later, for now detecting the errors is fine. If an error occurs, just don't submit the sample to taskComm for transmission.

pyokagan commented 7 years ago

Also, perhaps bad connections to the wires may cause the MPU to reset. Happened before to me when I was shaking the MPU vigorously. taskI2C also does not detect such an occurrence, and as a result just ends up reading zeroes from the MPU and sending them to taskComm for transmission. It would be good if taskI2C detects that the MPU has powered-off-and-on-again and re-initializes the MPU.

Additionally, we may wish to make taskI2C more resilient to initialization errors -- If we fail to initialize an MPU, we re-try initializing it periodically. Use case: a wire just happened to be loose when the arduino was booting up.

pyokagan commented 7 years ago

@myduyhoanglong Can handle this?

myduyhoanglong commented 7 years ago

Sure