-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug where begin()
would return false even on success
#43
Conversation
Please merge this. All the examples fail because of this bug. I can validate that this fix works. |
What specific sensor is being used and what is an example sketch that demonstrates this issue? The |
@caternuson if so that's direly bad design! (hopefully not yours, I gather you're speculating as much as the rest of us?)
If we can confirm that the base class is not intended to be used, or otherwise establish the design intent, I am happy to revise the PR accordingly! |
If you can provide more specifics, that would help. What is the hardware being used? What is the sketch that is not working? |
In my case I was in fact using the I don't need support, I just want to make the code good, and figured I'd be a good open source citizen by submitting a fix as I saw it. |
Here is my snippet of code that does not work as expected: #include <Adafruit_LSM6DS.h>
Adafruit_LSM6DS lsm6ds;
void setup() {
Serial.begin(115200);
...
if (!lsm6ds.begin_I2C(0x6b)) {
Serial.println("Failed to initialize LSM6DS");
while (1)
;
}
sensors_event_t a, g, t;
lsm6ds.getEvent(&a, &g, &t);
...
}
void loop() {
...
} The root cause is that |
@ketan That code is not in any of the examples from this repo. So not sure what your comment There is no specific What actual sensor are you using? Where did you get that example code from? |
@caternuson — I can see what you mean here. I was importing Problem exists between keyboard and chair. |
@ketan Cool. Glad it was that simple. If you are finding any out of date instructions - like in a Learn guide, please link that here so it can get updated. This library did change with time to support various LSM6DS series sensors. So it's possible there is some info somewhere else that did not get updated and is showing incorrect / out of date usage. @egnor What specific sensor are you using on your custom board? |
I'm using the LSM6DSM which has no explicit subclass. The main Learn guide gives examples but does not talk about what classes can and can't be used. For reference, it links to the doxygen output which includes an entry for the base As a process note @caternuson I would consider that this is a pull request (proposed change to the open source code), not a service ticket. Since you seem uninterested in accepting this PR, probably we should just close it, and I can open some other thread elsewhere about the right way to improve the documentation (at least) and code (ideally) to avoid this particular undocumented pitfall?? (Or you can just tell us to GTFO rather than trying to suggest improvements, if you don't have bandwidth to consider such things...?) |
Documentation has been updated to more explicitly reference |
Very simple change to fix a very simple bug where
LSM6DS::begin()
wouldn't return true even if it succeeded.