MLX90393.begin() Status Problems
Closed this issue · 3 comments
Hey,
I am trying to use two MLX90393 boards vie I2C simultaneously (eventually I will need to use four). I have a script that yields what I believe to be believable measurements from both of the sensors. An issue arises though in that I print the status of both the boards on begin and more often than not they read 255 - we have yet to see both statuses return 0 at the same time and it is fairly normal for one to return 0 while the other returns 255. I do not know how much of an issue this really is since, as I mentioned, they seem to give valid measurements despite the status regularly reading failure.
What's more is that if we call the individual methods of the begin function and print the return (ie. mlx.checkStatus(mlx.reset()), mlx.setGainSel(7), etc.) those all return 0.
Here is the setup excerpt from the script:
#include <MLX90393.h>
MLX90393 mlx1;
MLX90393 mlx2;
void setup(){
Serial.begin(9600);
Serial.println("hello");
Wire.begin();
delay(1000);
uint8_t status = mlx1.begin(0, 0);
Serial.println(status);
uint8_t status2 = mlx2.begin(1, 0);
Serial.println(status2);
}
Yeah, I tried calling begin() several more times and it is only on the first time that an error is returned. I am just going to write in a couple begin() codes for each board and proceed as normal from there. The measurements seem to behave as expected anyways so I don't think it is really a problem. If I figure out why an error is being returned on the first begin() I will update this issue, but for now I think it is fine.
Thanks for reporting. I guess I could add a pre_begin(A1, A0) function which would only reset the part. You'd call pre_begin() for all parts addressable on the bus, then call begin() for them. I think the net result would be the same as two rounds of calling begin(), but no calls would fail (presumably).
I'm going to leave this open while I consider the approach and round up a few boards for testing.