Open dhalbert opened 1 month ago
I'm not sure if the sensor_id
argument is necessary, since different instantiations could be distinguished by object identity.
This is not so easy to fix, because the underlying library we use, https://github.com/ceva-dsp/sh2, is not re-entrant and only supports one sensor at a time. The SparkFun library is derived from ours; this problem was brought up there: https://github.com/sparkfun/SparkFun_BNO08x_Arduino_Library/issues/3 and then an issue was opened on the original library: https://github.com/ceva-dsp/sh2/issues/9 This was November 2023, not sure if there will be any movement on this.
It's not just one sensor per bus either - it's just ONE sensor. Period.
I found out that the SparkFun BNO080 old library (https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library) works well with more than one BNO085 sensors on i2c bus. There are 2 addresses, so you can get up to 4x bno085 working on esp32 (with 2x i2c ports). But it does not work with SPI for some reason.. For my project I need 5x sensors, so I am using sparkfun bno080 for 4x sensors over i2c and one with sparkfun bno08x over spi.
Attempting to create more than one
Adafruit_BNO08x
fails, becausei2c_dev
is astatic
global, and gets discarded and re-created on the second call to theAdafruit_BNO08x
constructor. I believe thei2c_dev
should be a field in the device object.See https://discord.com/channels/327254708534116352/537365760008257569/1273319381597687828 for a thread about this.