Skip to content
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

Limited reading performance due to strange delay(40) in code #13

Closed
walchko opened this issue Jan 3, 2021 · 8 comments
Closed

Limited reading performance due to strange delay(40) in code #13

walchko opened this issue Jan 3, 2021 · 8 comments

Comments

@walchko
Copy link

walchko commented Jan 3, 2021

  • Arduino board: PyQT
  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.13

Thanks for all you do, you really do make great hardware/software!

I am trying to read the pressure sensor at ~200Hz with some other sensors and set it as:

if (!bmp.begin_I2C()) {
        while (1){
            Serial.println("BMP3 NOT Found!");
            delay(1000);
        }
    }
    bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
    bmp.setOutputDataRate(BMP3_ODR_200_HZ);

However, when I execute bmp.performReading(), the performance is no where near ~200Hz unless I comment this performRead out. Looking at this function in github here, there is a delay(40) for some reason. This delay would limit the reading to no more than 25Hz ... why? The sensor is capable of faster performance, not sure why you are hamstringing it like this ... maybe there is a more efficient way to do this?

Thanks again!

@ladyada
Copy link
Member

ladyada commented Jan 3, 2021

pretty sure we got it from bosch's official self-test code :/
https://github.com/BoschSensortec/BMP3-Sensor-API/blob/master/self-test/bmp3_selftest.c#L153
do you wanna maybe ask them? on one hand i agree, there's no reason for it. on the other hand i find that its best to stick to the official example as much as possible since They May Know Things :D

@mjs513
Copy link
Contributor

mjs513 commented Jan 6, 2021

Just as a follow up to this - has there been any resolution.

Reason. I was testing on a Teensy 4.0 and getting a "Failed to perform reading :(" error. I came across this and commented out the delay(40) and it magically started working. Guess its time to read the manual.

@walchko
Copy link
Author

walchko commented Jan 7, 2021 via email

@mjs513
Copy link
Contributor

mjs513 commented Jan 7, 2021

Thanks for the reply. Just for reference I did try the sketch on the Uno, Due, Mega and a Teensy 3.5 with the delay(40) removed and it seemed to work with an issue.

@ladyada
Copy link
Member

ladyada commented Jan 8, 2021

can someone please submit a PR? we'd review and merge!

@mjs513
Copy link
Contributor

mjs513 commented Jan 9, 2021

Thanks for incorporating the change.

@walchko
Copy link
Author

walchko commented Jan 9, 2021

Thanks @mjs513 ... I wasn't going to be able to get to this until tomorrow. I will close this now.

@walchko walchko closed this as completed Jan 9, 2021
@ladyada
Copy link
Member

ladyada commented Jan 9, 2021

thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants