Feature Request: Async code
Closed this issue · 3 comments
One feature that would be very useful is asynchronous function calls for the motion9 call. Because there are a lot of calls to i2c
(a few hundred every second) there is a major issue with code blocking. Asynchronous function calls would remove this issue.
The current i2c
library allows you to pass callbacks, but it's not actually asynchronous. To make the code async would require migrating to i2c-bus. The i2c-bus
library is actively maintained, unlike the i2c
library (last update was 1 year ago and many open pull requests and issues).
I am happy to do the port from i2c
to i2c-bus
. For the end-developer, there library should not change, it's just that extra functions will be added. I would also remove all existing callback functions (since they are redundant).
cool, this is exactly what I want. Looking forward to see this PR. BTW, did anybody told you there is a bug in package.json file? the "dependency" should be lowercase "d" instead of "Dependency", otherwise it won't install any dependency.
The "d" issue has been fixed, although it looks like the package has not be published to NPM yet. But if you do a git clone
you will get the latest code. Note, there are other important enhancements in the latest code, like the ability to calibrate all three sensors on the MPU9250.
Thanks! Good to know. But still, npm install is way more convenient and cleaner than git clone/sub-module. So it is appreciated if you can publish you new code to npm. And one more feed-back: you are current depending on i2c ">=0.2.0", do we really need 0.2.0 or above now? if not, can you change it to ">=0.1.8"? You know, as a library, it's generally a good idea to loosen your requirements as much as you can. Which will benefit those users who may not have the freedom to upgrade to node 4 yet. Thanks again!