Closed
Description
NOTE This issue by @ATMakersBill transferred from original repo.
It looks like there's code to read the i2c bus and keep the results for future calls to joystick, acceleration, and buttons. However, the button code doesn't seem to update the buffer.
It looks like it would be possible to make fewer reads and improve performance. Here's my suggestion....
- Add an optional parameter to the init() that takes a maxAge parameter (default to .1sec?).
- In __read_data() keep track of whether it's been over maxAge since the last read. If not use the current buffer. If you do a read, update the last read time
- If maxAge is set to zero, then it would always fetch on every read.
- If maxAge is set to -1 then the data read calls would never call read_data: the user would need to call a public method (read_data()?) to fetch the data.
I think that would give full control to the clients of the library.