DexterInd / BrickPi_C

BrickPi Library in C
12 stars 11 forks source link

Improve read from uart #17

Closed ghost closed 8 years ago

ghost commented 8 years ago

Use select and ioct to check if the needed bytes are available instead of polling. Read only one message from uart at a time to be sure to no corrupt the next one.

Fix most of the synchronization issue that leads to corrupted read messages. Reduce CPU usage and latency. Call to usleep(10000) in the main loop can be remove without any synchronization issues and corrupted message. More measure per second can be retrived from BrickPi.

ghost commented 8 years ago

This PR fix the issue I have with the motor's encoders but not with the sensors. I need to investigate more.

DexterInd commented 8 years ago

Sure, we look forward to your next pull request!