Closed derrell closed 8 years ago
Hi, @derrell thanks for the thoughtful issue report.
The adaptor should definitely return an error gracefully when no such i2c device is connected vs the current ugly behaviour. If the driver was also more robust, that would be good, but the adaptor seems like the place to catch this, and we'd accept a PR with gratitude.
Fixed with cylon-intel-iot pull request 19, now merged (6a13201). Thanks.
The updated cylon-intel-iot does not seem to have been pushed to the npm repository. Do you have a schedule for doing that, or "as requested," or ... ? (Please consider this such a request. :-) )
OK, done:
To git@github.com:hybridgroup/cylon-intel-iot.git
* [new tag] v0.8.1 -> v0.8.1
+ cylon-intel-iot@0.8.1
Thank you again for your contributions!
Since this has now been released, I am closing this issue. Please reopen if needed, and thanks again.
When the BMP180 sensor is not installed, the following code crashes. Backtrace provided at end. The reason is that the provided buffer is "expected" to contain data, but if no sensor is installed, there is no data.
Backtrace:
I don't know the API coordination defined by cylon, between sensors and higher-level code. Should Adaptor.prototype.i2cRead be returning an error? Or should Bmp180.prototype.readCoefficients be checking the callback value from this.connection.i2cRead and detecting the empty buffer there? Regardless, something in the call chain needs to handle the missing data. If you let me know how cylon handles this in general, I can provide a pull request to fix it.